Skip to content

Commit e6edd84

Browse files
authored
Merge pull request #186 from ichizok/update-jspy
Make CI generate js and py
2 parents 241784e + d5a9438 commit e6edd84

File tree

8 files changed

+37
-18
lines changed

8 files changed

+37
-18
lines changed

.github/workflows/test.yml

+26-8
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ jobs:
2929
test_python: python3
3030
# Installed Vim with checks
3131
- vim_version: installed
32-
make_target: test
32+
make_target: fast-test
3333
test_profile: vim-profile-installed.txt
3434
test_python: "python -m coverage run --append"
3535

@@ -44,22 +44,28 @@ jobs:
4444
with:
4545
fetch-depth: 10
4646

47-
- name: Install Vint
48-
if: matrix.vim_version == 'installed'
49-
run: |
50-
python -m pip install -q --user flake8 git+https://github.com/Vimjas/vint
51-
5247
- name: Install Vim
5348
if: matrix.vim_version != 'installed'
5449
run: |
5550
bash scripts/install-vim.sh
5651
echo "$HOME/vim/bin" >> $GITHUB_PATH
5752
53+
- name: Install Vint
54+
if: matrix.make_target == 'fast-test'
55+
run: |
56+
python -m pip install -q --user flake8 git+https://github.com/Vimjas/vint
57+
5858
- name: Install Covimerage
5959
run: |
6060
python -m pip install -q --user covimerage
6161
python -m pip freeze
6262
63+
- name: Compile js and py
64+
if: matrix.make_target == 'fast-test'
65+
timeout-minutes: 10
66+
run: |
67+
make clean_compiled all
68+
6369
- name: Test
6470
timeout-minutes: 10
6571
run: |
@@ -68,8 +74,20 @@ jobs:
6874
vim --version
6975
make --keep-going $MAKE_TARGET
7076
77+
- name: Commit and push
78+
if: success() && matrix.make_target == 'fast-test' && github.ref_name == 'master'
79+
run: |
80+
if ! make fast-check; then
81+
git config --local user.name 'github-actions[bot]'
82+
git config --local user.email 'github-actions[bot]@users.noreply.github.com'
83+
git remote set-url origin 'https://github-actions:${{ github.token }}@github.com/${{ github.repository }}'
84+
git add js/vimlparser.js py/vimlparser.py
85+
git commit -m 'generate js and py'
86+
git push origin '${{ github.ref_name }}'
87+
fi
88+
7189
- name: Coverage from Python
72-
if: matrix.make_target == 'test' && success()
90+
if: success() && matrix.make_target == 'fast-test'
7391
run: |
7492
# Coverage from Python (cannot be combined with non-branch data).
7593
if [[ -f .coverage_covimerage ]]; then
@@ -78,7 +96,7 @@ jobs:
7896
fi
7997
8098
- name: Codecov for Python
81-
if: matrix.make_target == 'test' && success()
99+
if: success() && matrix.make_target == 'fast-test'
82100
uses: codecov/codecov-action@v2
83101
with:
84102
files: coverage.xml

Makefile

+5-4
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,9 @@ py/vimlparser.py: autoload/vimlparser.vim py/pycompiler.vim py/vimlfunc.py
1414
clean_compiled:
1515
$(RM) $(COMPILED_FILES)
1616

17-
check: all
18-
git diff --exit-code $(COMPILED_FILES) || { \
17+
check: all fast-check
18+
fast-check:
19+
@git diff --exit-code $(COMPILED_FILES) || { \
1920
echo 'Compiled files were updated, but should have been included/committed.'; \
2021
exit 1; }
2122

@@ -37,7 +38,7 @@ py/test: py/vimlparser.py
3738
test/run_command.sh $(TEST_PYTHON) py/vimlparser.py
3839

3940
test/node_position/test_position.out: test/node_position/test_position.vim test/node_position/test_position.ok
40-
vim -Nu test/vimrc -S test/node_position/test_position.vim
41+
vim -Nu test/vimrc -i NONE -S test/node_position/test_position.vim
4142
diff -u test/node_position/test_position.ok test/node_position/test_position.out
4243

43-
.PHONY: all clean_compiled check test fast-test vim/test js/test py/test
44+
.PHONY: all clean_compiled check fast-check test fast-test vim/test js/test py/test

js/jscompiler.vim

+1-1
Original file line numberDiff line numberDiff line change
@@ -897,7 +897,7 @@ function! s:parse_args() abort
897897
let v = args
898898
endif
899899
return v
900-
endfunction:
900+
endfunction
901901

902902
function! s:main() abort
903903
try

py/pycompiler.vim

+1-1
Original file line numberDiff line numberDiff line change
@@ -931,7 +931,7 @@ function! s:parse_args() abort
931931
let v = args
932932
endif
933933
return v
934-
endfunction:
934+
endfunction
935935

936936
function! s:main() abort
937937
try

scripts/jscompile.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
#!/bin/sh
2-
vim -u NONE -i NONE -E -s -N --cmd 'set rtp+=.' -c 'exe "so" argv()[0]' -c q -- js/jscompiler.vim $*
2+
vim -u NONE -i NONE -E -s -N -R -X --cmd 'set rtp+=.' -c 'exe "so" argv()[0]' -c q -- js/jscompiler.vim $*

scripts/pycompile.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
#!/bin/sh
2-
vim -u NONE -i NONE -E -s -N --cmd 'set rtp+=.' -c 'exe "so" argv()[0]' -c q -- py/pycompiler.vim $*
2+
vim -u NONE -i NONE -E -s -N -R -X --cmd 'set rtp+=.' -c 'exe "so" argv()[0]' -c q -- py/pycompiler.vim $*

test/run.bat

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
@echo off
2-
vim -Nu test/vimrc -S test/run.vim
2+
vim -Nu test/vimrc -i NONE -S test/run.vim
33
set EXIT=%ERRORLEVEL%
44
if exist test.log type test.log
55
exit /b %EXIT%

test/run.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#!/bin/sh
2-
vim -Nu test/vimrc -S test/run.vim
2+
vim -Nu test/vimrc -i NONE -S test/run.vim
33
EXIT=$?
44
[ -e test.log ] && cat test.log
55
exit $EXIT

0 commit comments

Comments
 (0)