New updates on the proc flows #65
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: regression | |
on: | |
push: | |
paths: | |
- '**.py' | |
pull_request: | |
types: [opened, reopened] | |
jobs: | |
install_python: | |
strategy: | |
fail-fast: false | |
matrix: | |
python-version: ["3.7", "3.8", "3.9", "3.10"] | |
os: [ubuntu-latest, windows-latest] #, macos-latest] removed macos to see if it runs faster. I'll put it back later | |
# Dont install 3.10 for ubuntu. This one is done in the other job, so we can start running pylint and flake faster | |
exclude: | |
- os: ubuntu-latest | |
python-version: '3.10' | |
runs-on: $ | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/setup-python@v4 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- run: | | |
python -m pip install pylint pytest flake8 .[formulae] | |
echo "PYTHONPATH=$(pwd)" >> $GITHUB_ENV | |
install_python_2: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/setup-python@v4 | |
with: | |
python-version: '3.10' | |
- run: | | |
python -m pip install pylint pytest flake8 .[formulae] | |
echo "PYTHONPATH=$(pwd)" >> $GITHUB_ENV | |
pylint: # Just lint with 3.10 | |
runs-on: ubuntu-latest | |
needs: install_python_2 | |
steps: | |
- name: Set up Python 3.10 / Ubuntu | |
uses: actions/setup-python@v4 | |
with: | |
python-version: '3.10' | |
- run: | | |
pylint qas_editor --rcfile=$(git ls-files '.pylintrc') --output-format=text | tee ./pylint.log || pylint-exit $? | |
echo "PYLINT_SCORE=$(sed -n 's/^Your code has been rated at \([-0-9.]*\)\/.*/\1/p' ./pylint.log)" >> $GITHUB_ENV | |
flake8: # Just lint with 3.10 | |
runs-on: ubuntu-latest | |
needs: install_python_2 | |
steps: | |
- name: Set up Python 3.10 / Ubuntu | |
uses: actions/setup-python@v4 | |
with: | |
python-version: '3.10' | |
- name: Lint with flake8 | |
run: | | |
echo "FLAKE_ERRORS=$(flake8 qas_editor --count --exit-zero --statistics --output-file ./flake8.log)" >> $GITHUB_ENV | |
pytest: | |
needs: [install_python, install_python_2] | |
strategy: | |
fail-fast: false | |
matrix: | |
python-version: ["3.7", "3.8", "3.9", "3.10"] | |
os: [ubuntu-latest, macos-latest, windows-latest] | |
runs-on: $ | |
steps: | |
- name: Test with pytest | |
run: | | |
pytest ./test_lib | tee ./pytest.log | |
echo "PYTEST_MAX=$(sed -n 's/collected \([0-9]*\) items/\1/p' ./pytest.log)" >> $GITHUB_ENV | |
echo "PYTEST_SCORE=$(sed -n 's/^===.* \([0-9]*\) passed.*===/\1/p' ./pytest.log)" >> $GITHUB_ENV | |
badges: | |
# Not needed to run on parallell, plus may generate error while accessing gist, so lets avoid it | |
runs-on: ubuntu-latest | |
if: ${{ always() }} | |
needs: [pylint, flake8, pytest] | |
steps: | |
- name: Create Pylint Badge | |
uses: LucasWolfgang/dynamic-badges-action@master | |
with: | |
auth: ${{ secrets.GIST_SECRET }} | |
gistID: 344598a4a0f7b92a7889d998e33417c4 | |
filename: pylint_${{ matrix.python-version }}.json | |
label: Pylint | |
message: ${{ env.PYLINT_SCORE }} / 10.0 points | |
minColorRange: 6 | |
maxColorRange: 10 | |
valColorRange: ${{ env.PYLINT_SCORE }} | |
continue-on-error: true | |
- name: Create Flake8 Badge | |
uses: LucasWolfgang/dynamic-badges-action@master | |
with: | |
auth: ${{ secrets.GIST_SECRET }} | |
gistID: 344598a4a0f7b92a7889d998e33417c4 | |
filename: flake8_${{ matrix.python-version }}.json | |
label: Flake8 | |
message: ${{ env.FLAKE_ERRORS }} errors | |
minColorRange: 0 | |
maxColorRange: 50 | |
valColorRange: ${{ env.FLAKE_ERRORS }} | |
invertColorRange: 1 | |
continue-on-error: true | |
- name: Create Pytest Badge | |
uses: LucasWolfgang/dynamic-badges-action@master | |
with: | |
auth: ${{ secrets.GIST_SECRET }} | |
gistID: 344598a4a0f7b92a7889d998e33417c4 | |
filename: pytest_${{ matrix.python-version }}.json | |
label: Pytest | |
message: ${{ env.PYTEST_SCORE }} / ${{ env.PYTEST_MAX }} tests | |
minColorRange: 13 | |
maxColorRange: ${{ env.PYTEST_MAX }} | |
valColorRange: ${{ env.PYTEST_SCORE }} | |