Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

96 upgrade workflow due to deprecation #97

Merged
merged 24 commits into from
Aug 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
139ce3d
[QMI-096]
Aug 9, 2024
977173d
[QMI-096] Created a reusable-ci-workflows.yml that has workflows that…
Aug 9, 2024
dd1d72e
[QMI-096] It complained about the `secrets` part. Trying to change that.
Aug 9, 2024
72a6081
[QMI-096] I don't like secrets.
Aug 9, 2024
c4d00fe
[QMI-096] Moving all `env` variables also to reusable-ci-workflows.yml
Aug 9, 2024
58f1133
[QMI-096] Updating also JS node version for `setup-python@v4`.
Aug 12, 2024
e0984d7
[QMI-096] Updating also the CHANGELOG.md. And setup-python to v5 inst…
Aug 12, 2024
6969193
[QMI-096] Checking out main code in pull request before running reusa…
Aug 12, 2024
f6d8e27
[QMI-096] Checking out main code in pull request before running reusa…
Aug 12, 2024
9a7f0b3
[QMI-096] Checking out main code in pull request before running reusa…
Aug 12, 2024
e8a5a38
[QMI-096] Checking out main code in pull request before running reusa…
Aug 12, 2024
4b2dadd
[QMI-096] Checking out main code in pull request before running reusa…
Aug 12, 2024
ec51f92
[QMI-096] Checking out main code in pull request before running reusa…
Aug 12, 2024
086093e
[QMI-096] Checking out main code in pull request before running reusa…
Aug 12, 2024
e385556
[QMI-096] Checking out main code in pull request before running reusa…
Aug 12, 2024
e6fcfd6
[QMI-096] Checking out main code in pull request before running reusa…
Aug 12, 2024
02d2088
[QMI-096] Checking out main code in pull request before running reusa…
Aug 12, 2024
cfefeb9
[QMI-096] Checking out main code in pull request before running reusa…
Aug 12, 2024
ae618f1
[QMI-096] Checking out main code in pull request before running reusa…
Aug 12, 2024
0cd7625
[QMI-096] Checking out main code in pull request before running reusa…
Aug 12, 2024
4f922dd
[QMI-096] Updating the latest working solutions also to the `schedule…
Aug 12, 2024
fb0d7d1
[QMI-096] Still an issue with the artifacts namings.
Aug 12, 2024
0b9a199
[QMI-096] Still an issue with the artifacts namings.
Aug 12, 2024
a7a1db8
[QMI-096] Move BADGES_DIR directly to pull request CI file.
Aug 13, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
83 changes: 0 additions & 83 deletions .github/workflows/github-ci.yml

This file was deleted.

51 changes: 51 additions & 0 deletions .github/workflows/pull-request-ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
name: QMI Python CI runner on pull request

on:
pull_request:
branches: [ "main" ]
paths-ignore:
- README.md
- CHANGELOG.md
- .gitignore
- ACKNOWLEDGEMENTS.md
- LICENSE.md
- CONTRIBUTING.md
- TESTING.md

env:
BADGES_DIR: ".github/badges"

jobs:
build:
strategy:
max-parallel: 3
matrix:
python-version: ["3.8", "3.9", "3.10"]

uses: ./.github/workflows/reusable-ci-workflows.yml
with:
python-version: ${{ matrix.python-version }}
ref: ${{ github.head_ref }}

create-badges:
runs-on: ubuntu-latest
needs: build
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
ref: ${{ inputs.ref }}

- name: Generate and push badges
if: ${{ matrix.python-version == '3.10' }}
run: |
pip install anybadge
anybadge -o -l pylint -v $(tail -n 2 pylint.log | grep -o '[0-9]\{1,2\}\.[0-9]\{2\}' | head -n 1) -f $BADGES_DIR/pylint.svg 2=red 4=orange 8=yellow 10=green
anybadge -o -l mypy -v $([ -n "$(tail -n 1 mypy.log | grep -e '^Succes')" ] && echo pass || echo fail) -f $BADGES_DIR/mypy.svg fail=red pass=green
COVERAGE_PERC=$(grep "TOTAL" coverage.log | grep -Eo '[0-9.]+%' | sed 's/%//')
anybadge -o -l coverage -v $COVERAGE_PERC -f $BADGES_DIR/coverage.svg 60=red 80=orange 100=green
git config user.name "Badge Bot"
git config user.email "<>"
git add $BADGES_DIR/*.svg
git commit -m "Update badges" || true
git push || true
106 changes: 0 additions & 106 deletions .github/workflows/pull_request.yml

This file was deleted.

18 changes: 18 additions & 0 deletions .github/workflows/push-ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
name: QMI Python CI runner on push

on:
push:
paths-ignore:
- README.md
- CHANGELOG.md
- .gitignore
- ACKNOWLEDGEMENTS.md
- LICENSE.md
- CONTRIBUTING.md
- TESTING.md

jobs:
on_push:
uses: ./.github/workflows/reusable-ci-workflows.yml
with:
python-version: "3.11"
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,9 @@ jobs:
matrix:
python-version: ["3.8", "3.9", "3.10", "3.11"]
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
Expand Down
77 changes: 77 additions & 0 deletions .github/workflows/reusable-ci-workflows.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
name: Python CI Reusable Workflow

on:
workflow_call:
inputs:
python-version:
required: true
type: string
ref:
required: false
type: string

env:
PYLINT_MIN_SCORE: "9.00"
COVERAGE_MIN_PERC: "90"
COMPLEXITY_MAX_SCORE: "30"
SOURCE_DIRS: "qmi/"
BADGES_DIR: ".github/badges"
heevasti marked this conversation as resolved.
Show resolved Hide resolved

jobs:
ci-checks:
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v4
with:
ref: ${{ inputs.ref }}

- name: Set up Python ${{ inputs.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ inputs.python-version }}

- name: Install dependencies
run: |
sudo apt-get update -qy
sudo apt-get install -y bc
pip install --upgrade pip
pip install -e '.[dev]'

- name: Run pylint
run: |
pylint --score=yes --load-plugins=pylint.extensions.mccabe --max-complexity=$COMPLEXITY_MAX_SCORE $SOURCE_DIRS | tee pylint-${{ inputs.python-version }}.log
PYLINT_SCORE=$(tail -n 2 pylint-${{ inputs.python-version }}.log | grep -o '[0-9]\{1,2\}\.[0-9]\{2\}' | head -n 1)
echo "Pylint score: $PYLINT_SCORE"
exit $(echo "$PYLINT_SCORE < $PYLINT_MIN_SCORE" | bc)
- name: Upload pylint results
uses: actions/upload-artifact@v4
with:
name: pylint-results-${{ inputs.python-version }}
path: pylint-${{ inputs.python-version }}.log

- name: Run mypy
run: |
mypy --namespace-packages $SOURCE_DIRS | tee mypy-${{ inputs.python-version }}.log
if [ -n "$(tail -n 1 mypy-${{ inputs.python-version }}.log | grep -e '^Succes')" ]; then RESULT="pass"; else RESULT="fail"; fi
echo "Mypy result: $RESULT"
exit $([[ "$RESULT" == "pass" ]] && echo 0 || echo 1)
- name: Upload mypy results
uses: actions/upload-artifact@v4
with:
name: mypy-results-${{ inputs.python-version }}
path: mypy-${{ inputs.python-version }}.log

- name: Run coverage
run: |
coverage run --branch --source=$SOURCE_DIRS -m unittest discover --start-directory=tests --pattern="test_*.py"
coverage report --show-missing --fail-under=$COVERAGE_MIN_PERC | tee coverage-${{ inputs.python-version }}.log
COVERAGE_PERC=$(grep "TOTAL" coverage-${{ inputs.python-version }}.log | grep -Eo '[0-9.]+%' | sed 's/%//')
echo "Coverage: $COVERAGE_PERC%"
exit $(echo "$COVERAGE_PERC < $COVERAGE_MIN_PERC" | bc)
- name: Upload coverage results
uses: actions/upload-artifact@v4
with:
name: coverage-results-${{ inputs.python-version }}
path: coverage-${{ inputs.python-version }}.log
Loading