moved up always() clause #377
Workflow file for this run
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: QMI Python CI runner on push | |
# This runner runs on regular push to a branch. | |
on: | |
push: | |
paths-ignore: | |
- README.md | |
- CHANGELOG.md | |
- .gitignore | |
- ACKNOWLEDGEMENTS.md | |
- LICENSE.md | |
- CONTRIBUTING.md | |
- TESTING.md | |
env: | |
# minimum pylint code quality score (max. 10) | |
PYLINT_MIN_SCORE: "9.00" | |
# minimum code coverage (goal: 90%; max. 100%) | |
COVERAGE_MIN_PERC: "100" | |
# maximum code complexity (goal: <= 30; unbounded) | |
COMPLEXITY_MAX_SCORE: "1" | |
# this should be a comma separated list | |
SOURCE_DIRS: "qmi/" | |
jobs: | |
on_push: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up Python-latest | |
uses: actions/setup-python@v4 | |
with: | |
python-version: "3.11" | |
- name: Install dependencies | |
run: | | |
sudo apt-get update -qy | |
sudo apt-get install -y bc | |
python3 --version | |
pip install --upgrade pip | |
pip install -e '.[dev]' | |
- name: pylint | |
if: always() | |
run: | | |
pip install pylint | |
pylint --score=yes --load-plugins=pylint.extensions.mccabe --max-complexity=$COMPLEXITY_MAX_SCORE $SOURCE_DIRS | tee pylint.log | |
SCORE=$( tail -n 2 pylint.log | grep -o '[0-9]\{1,2\}\.[0-9]\{2\}' | head -n 1 ) | |
echo $SCORE | |
echo $SCORE > pylint_score | |
# bc evaluates to `1` if relation is true | |
exit $( echo "$SCORE < $PYLINT_MIN_SCORE" | bc ) | |
- name: upload pylint test results | |
uses: actions/upload-artifact@v3 | |
with: | |
name: pylint-results | |
path: pylint.log | |
- name: mypy | |
if: always() | |
run: | | |
pip install mypy | |
mypy --namespace-packages $SOURCE_DIRS > mypy.log | |
if [ -n "$( tail -n 1 mypy.log | grep -e '^Succes' )" ]; then RESULT="pass"; else RESULT="fail"; fi | |
echo $RESULT | |
- name: upload mypy test results | |
uses: actions/upload-artifact@v3 | |
with: | |
name: mypy-results | |
path: mypy.log | |
- name: coverage | |
if: always() | |
run: | | |
pip install coverage | |
coverage run --branch --source=$SOURCE_DIRS -m unittest discover --start-directory=tests --pattern="test_*.py" | |
coverage report --show-missing --fail-under=$COVERAGE_MIN_PERC > coverage.log | |
- name: upload coverage results | |
uses: actions/upload-artifact@v3 | |
with: | |
name: coverage-results | |
path: coverage.log | |