Skip to content

Commit

Permalink
Merge pull request #186 from ichizok/update-jspy
Browse files Browse the repository at this point in the history
Make CI generate js and py
  • Loading branch information
mattn authored Jan 16, 2022
2 parents 241784e + d5a9438 commit e6edd84
Show file tree
Hide file tree
Showing 8 changed files with 37 additions and 18 deletions.
34 changes: 26 additions & 8 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand All @@ -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: |
Expand All @@ -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
Expand All @@ -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
Expand Down
9 changes: 5 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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; }

Expand All @@ -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
2 changes: 1 addition & 1 deletion js/jscompiler.vim
Original file line number Diff line number Diff line change
Expand Up @@ -897,7 +897,7 @@ function! s:parse_args() abort
let v = args
endif
return v
endfunction:
endfunction

function! s:main() abort
try
Expand Down
2 changes: 1 addition & 1 deletion py/pycompiler.vim
Original file line number Diff line number Diff line change
Expand Up @@ -931,7 +931,7 @@ function! s:parse_args() abort
let v = args
endif
return v
endfunction:
endfunction

function! s:main() abort
try
Expand Down
2 changes: 1 addition & 1 deletion scripts/jscompile.sh
Original file line number Diff line number Diff line change
@@ -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 $*
2 changes: 1 addition & 1 deletion scripts/pycompile.sh
Original file line number Diff line number Diff line change
@@ -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 $*
2 changes: 1 addition & 1 deletion test/run.bat
Original file line number Diff line number Diff line change
@@ -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%
2 changes: 1 addition & 1 deletion test/run.sh
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit e6edd84

Please sign in to comment.