From abab7d5196c46128afd45d0bfc22bc04e2bd91d6 Mon Sep 17 00:00:00 2001 From: ichizok Date: Sat, 15 Jan 2022 01:12:59 +0900 Subject: [PATCH 1/3] Add '-i NONE' option to test command --- Makefile | 2 +- test/run.bat | 2 +- test/run.sh | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Makefile b/Makefile index 95dc5978..3eafa3cf 100644 --- a/Makefile +++ b/Makefile @@ -37,7 +37,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 diff --git a/test/run.bat b/test/run.bat index a2d81a77..1cd35783 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 2a3f08d6..e95cd0ee 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 From f270139d493343602cebaf81f31cdcf30cedfe72 Mon Sep 17 00:00:00 2001 From: ichizok Date: Sat, 15 Jan 2022 05:43:17 +0900 Subject: [PATCH 2/3] Add commit and push setting to CI --- .github/workflows/test.yml | 34 ++++++++++++++++++++++++++-------- Makefile | 7 ++++--- 2 files changed, 30 insertions(+), 11 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 4ac4614a..b4ab95d8 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 3eafa3cf..52d05f26 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; } @@ -40,4 +41,4 @@ test/node_position/test_position.out: test/node_position/test_position.vim test/ 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 From d5a9438ddbd775e89d92ed3acbd2c5eeb910f2bd Mon Sep 17 00:00:00 2001 From: ichizok Date: Mon, 17 Jan 2022 00:01:26 +0900 Subject: [PATCH 3/3] Fix jscompiler.vim and pycompiler.vim Remove the trailing colon at "endfunction" line --- js/jscompiler.vim | 2 +- py/pycompiler.vim | 2 +- scripts/jscompile.sh | 2 +- scripts/pycompile.sh | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/js/jscompiler.vim b/js/jscompiler.vim index 1a90bfde..83053234 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 aeec6b80..a387520c 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 7bf749cc..e15d7492 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 28894da6..ea71cfa2 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 $*