diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 4ac4614..b4ab95d 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -29,7 +29,7 @@ jobs: test_python: python3 # Installed Vim with checks - vim_version: installed - make_target: test + make_target: fast-test test_profile: vim-profile-installed.txt test_python: "python -m coverage run --append" @@ -44,22 +44,28 @@ jobs: with: fetch-depth: 10 - - name: Install Vint - if: matrix.vim_version == 'installed' - run: | - python -m pip install -q --user flake8 git+https://github.com/Vimjas/vint - - name: Install Vim if: matrix.vim_version != 'installed' run: | bash scripts/install-vim.sh echo "$HOME/vim/bin" >> $GITHUB_PATH + - name: Install Vint + if: matrix.make_target == 'fast-test' + run: | + python -m pip install -q --user flake8 git+https://github.com/Vimjas/vint + - name: Install Covimerage run: | python -m pip install -q --user covimerage python -m pip freeze + - name: Compile js and py + if: matrix.make_target == 'fast-test' + timeout-minutes: 10 + run: | + make clean_compiled all + - name: Test timeout-minutes: 10 run: | @@ -68,8 +74,20 @@ jobs: vim --version make --keep-going $MAKE_TARGET + - name: Commit and push + if: success() && matrix.make_target == 'fast-test' && github.ref_name == 'master' + run: | + if ! make fast-check; then + git config --local user.name 'github-actions[bot]' + git config --local user.email 'github-actions[bot]@users.noreply.github.com' + git remote set-url origin 'https://github-actions:${{ github.token }}@github.com/${{ github.repository }}' + git add js/vimlparser.js py/vimlparser.py + git commit -m 'generate js and py' + git push origin '${{ github.ref_name }}' + fi + - name: Coverage from Python - if: matrix.make_target == 'test' && success() + if: success() && matrix.make_target == 'fast-test' run: | # Coverage from Python (cannot be combined with non-branch data). if [[ -f .coverage_covimerage ]]; then @@ -78,7 +96,7 @@ jobs: fi - name: Codecov for Python - if: matrix.make_target == 'test' && success() + if: success() && matrix.make_target == 'fast-test' uses: codecov/codecov-action@v2 with: files: coverage.xml diff --git a/Makefile b/Makefile index 95dc597..52d05f2 100644 --- a/Makefile +++ b/Makefile @@ -14,8 +14,9 @@ py/vimlparser.py: autoload/vimlparser.vim py/pycompiler.vim py/vimlfunc.py clean_compiled: $(RM) $(COMPILED_FILES) -check: all - git diff --exit-code $(COMPILED_FILES) || { \ +check: all fast-check +fast-check: + @git diff --exit-code $(COMPILED_FILES) || { \ echo 'Compiled files were updated, but should have been included/committed.'; \ exit 1; } @@ -37,7 +38,7 @@ py/test: py/vimlparser.py test/run_command.sh $(TEST_PYTHON) py/vimlparser.py test/node_position/test_position.out: test/node_position/test_position.vim test/node_position/test_position.ok - vim -Nu test/vimrc -S test/node_position/test_position.vim + vim -Nu test/vimrc -i NONE -S test/node_position/test_position.vim diff -u test/node_position/test_position.ok test/node_position/test_position.out -.PHONY: all clean_compiled check test fast-test vim/test js/test py/test +.PHONY: all clean_compiled check fast-check test fast-test vim/test js/test py/test diff --git a/js/jscompiler.vim b/js/jscompiler.vim index 1a90bfd..8305323 100644 --- a/js/jscompiler.vim +++ b/js/jscompiler.vim @@ -897,7 +897,7 @@ function! s:parse_args() abort let v = args endif return v -endfunction: +endfunction function! s:main() abort try diff --git a/py/pycompiler.vim b/py/pycompiler.vim index aeec6b8..a387520 100644 --- a/py/pycompiler.vim +++ b/py/pycompiler.vim @@ -931,7 +931,7 @@ function! s:parse_args() abort let v = args endif return v -endfunction: +endfunction function! s:main() abort try diff --git a/scripts/jscompile.sh b/scripts/jscompile.sh index 7bf749c..e15d749 100755 --- a/scripts/jscompile.sh +++ b/scripts/jscompile.sh @@ -1,2 +1,2 @@ #!/bin/sh -vim -u NONE -i NONE -E -s -N --cmd 'set rtp+=.' -c 'exe "so" argv()[0]' -c q -- js/jscompiler.vim $* +vim -u NONE -i NONE -E -s -N -R -X --cmd 'set rtp+=.' -c 'exe "so" argv()[0]' -c q -- js/jscompiler.vim $* diff --git a/scripts/pycompile.sh b/scripts/pycompile.sh index 28894da..ea71cfa 100755 --- a/scripts/pycompile.sh +++ b/scripts/pycompile.sh @@ -1,2 +1,2 @@ #!/bin/sh -vim -u NONE -i NONE -E -s -N --cmd 'set rtp+=.' -c 'exe "so" argv()[0]' -c q -- py/pycompiler.vim $* +vim -u NONE -i NONE -E -s -N -R -X --cmd 'set rtp+=.' -c 'exe "so" argv()[0]' -c q -- py/pycompiler.vim $* diff --git a/test/run.bat b/test/run.bat index a2d81a7..1cd3578 100644 --- a/test/run.bat +++ b/test/run.bat @@ -1,5 +1,5 @@ @echo off -vim -Nu test/vimrc -S test/run.vim +vim -Nu test/vimrc -i NONE -S test/run.vim set EXIT=%ERRORLEVEL% if exist test.log type test.log exit /b %EXIT% diff --git a/test/run.sh b/test/run.sh index 2a3f08d..e95cd0e 100755 --- a/test/run.sh +++ b/test/run.sh @@ -1,5 +1,5 @@ #!/bin/sh -vim -Nu test/vimrc -S test/run.vim +vim -Nu test/vimrc -i NONE -S test/run.vim EXIT=$? [ -e test.log ] && cat test.log exit $EXIT