Skip to content

Commit f270139

Browse files
committed
Add commit and push setting to CI
1 parent abab7d5 commit f270139

File tree

2 files changed

+30
-11
lines changed

2 files changed

+30
-11
lines changed

.github/workflows/test.yml

Lines changed: 26 additions & 8 deletions
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

Lines changed: 4 additions & 3 deletions
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

@@ -40,4 +41,4 @@ test/node_position/test_position.out: test/node_position/test_position.vim test/
4041
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

0 commit comments

Comments
 (0)