Add test coverage information #22
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: syntax | |
on: | |
pull_request: | |
branches: | |
- "**" | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
timeout-minutes: 10 | |
steps: | |
- name: Check out repository | |
uses: actions/checkout@v3 | |
with: | |
ref: ${{ github.event.pull_request.head.sha }} | |
- name: Get changed files | |
id: changed-files | |
uses: tj-actions/changed-files@v39 | |
with: | |
files: | | |
**/*.py | |
- name: Prepare python env | |
if: ${{ steps.changed-files.outputs.all_changed_files }} | |
run: | | |
python -m venv env | |
source env/bin/activate | |
pip install -U pip | |
pip install -r test-requirements.txt | |
pip install isort[colors] colorama black pylint | |
- name: Run pylint | |
id: pylint | |
if: ${{ steps.changed-files.outputs.all_changed_files }} | |
run: | | |
delimiter='$(openssl rand -hex 8)' | |
echo 'report<<$(delimiter)' >> $GITHUB_OUTPUT | |
source env/bin/activate | |
pylint ${{ steps.changed-files.outputs.all_changed_files }} --exit-zero >> $GITHUB_OUTPUT | |
echo '$(delimiter)' >> $GITHUB_OUTPUT | |
- name: Post pylint output | |
uses: mshick/add-pr-comment@v2 | |
if: ${{ steps.changed-files.outputs.all_changed_files }} | |
with: | |
message: | | |
<details> | |
<summary>pylint output</summary> | |
``` | |
${{ steps.pylint.outputs.report }} | |
``` | |
</details> | |
message-id: pylint-report | |
- name: Run black | |
if: ${{ steps.changed-files.outputs.all_changed_files }} | |
run: env/bin/black ${{ steps.changed-files.outputs.all_changed_files }} --check --diff --color | |
- name: Run isort | |
if: ${{ steps.changed-files.outputs.all_changed_files }} | |
run: env/bin/isort ${{ steps.changed-files.outputs.all_changed_files }} --diff --color --check-only |