Skip to content

Commit

Permalink
Add commit and push setting to CI
Browse files Browse the repository at this point in the history
  • Loading branch information
ichizok committed Jan 15, 2022
1 parent abab7d5 commit f270139
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 11 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
7 changes: 4 additions & 3 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 @@ -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

0 comments on commit f270139

Please sign in to comment.