1- # This workflow will install Python dependencies, run tests and lint with a variety of Python versions
2- # For more information see: https://help.github.com/actions/language- and-framework-guides/using-python-with-github-actions
1+ # This workflow is for master branch only. It sets up python, lints with several analyzers,
2+ # runs tests, collects test coverage, makes a coverage comment and creates a coverage badge.
33
4- name : Python package
4+ name : Build master
55
6- on : [push, pull_request]
6+ on :
7+ push :
8+ branches : " master"
79
810jobs :
911 build :
1214 strategy :
1315 fail-fast : false
1416 matrix :
15- python-version : ["3.8", "3.9", "3.10" ]
17+ python-version : ["3.8"]
1618
1719 steps :
20+
1821 - uses : actions/checkout@v3
1922 - name : Set up Python ${{ matrix.python-version }}
2023 uses : actions/setup-python@v3
2326 - name : Install dependencies
2427 run : |
2528 python -m pip install --upgrade pip
26- python -m pip install pytest
27- if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
29+ pip install -r requirements.txt
30+
2831 - name : Lint with pylint
2932 run : |
3033 pylint pyformlang || true
@@ -34,20 +37,19 @@ jobs:
3437 - name : Test with pytest
3538 run : |
3639 pytest --showlocals -v pyformlang
40+
3741 - name : Build coverage file
38- if : ${{ matrix.python-version == '3.8'}}
3942 run : |
4043 pytest pyformlang --junitxml=pytest.xml --cov=pyformlang | tee ./pytest-coverage.txt
41- - name : Pytest coverage comment
42- if : ${{ matrix.python-version == '3.8'}}
44+ - name : Make coverage comment
4345 uses : MishaKav/pytest-coverage-comment@main
4446 id : coverageComment
4547 with :
4648 pytest-coverage-path : ./pytest-coverage.txt
4749 junitxml-path : ./pytest.xml
4850 default-branch : master
51+
4952 - name : Create coverage Badge
50- if : ${{ github.ref_name == 'master' && matrix.python-version == '3.8'}}
5153 uses : schneegans/dynamic-badges-action@v1.0.0
5254 with :
5355 auth : ${{ secrets.GIST_SECRET }}
0 commit comments