Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
35 changes: 19 additions & 16 deletions .github/workflows/codecov.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
---
name: Codecov Coverage Report
name: "Codecov Coverage Report"

on: # yamllint disable-line rule:truthy
push:
branches: [ main ]
pull_request:
branches: [ main ]
on: # yamllint disable-line rule:truthy
# Makes it reusable; called by other workflows
workflow_call:
secrets:
CODECOV_TOKEN:
description: "CODECOV Auth Token"
required: true

jobs:
run:
Expand All @@ -15,27 +17,28 @@ jobs:
timeout-minutes: 10
strategy:
matrix:
os: [ubuntu-latest]
os: ["ubuntu-latest"]
python-version: ["3.12"]
steps:
- uses: actions/checkout@main
- name: Setup Python
uses: actions/setup-python@main
- uses: "actions/checkout@main"
- name: "Setup Python"
uses: "actions/setup-python@main"
with:
python-version: ${{ matrix.python-version }}
- name: "Cache PIP Dependencies"
uses: "actions/cache@v4"
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ matrix.python-version }}-${{ hashFiles('requirements.txt') }}
key: |
${{ runner.os }}-pip-${{ matrix.python-version }}-${{ hashFiles('requirements.txt') }}
restore-keys: |
${{ runner.os }}-pip-${{ matrix.python-version }}-
${{ runner.os }}-pip-
- name: Install prerequisites
- name: "Install prerequisites"
run: |
python -m pip install --upgrade pip setuptools wheel
pip install -r requirements.txt
- name: Install pytest, pytest-cov
- name: "Install pytest, pytest-cov"
run: |
pip install pytest
pip install pytest-cov
Expand All @@ -44,12 +47,12 @@ jobs:
run: |
python -c "import os; print(os.getcwd())"
python -m pytest . --ignore=solutions --log-cli-level=INFO -v --cov-report term-missing --cov --cov-branch --cov-report=xml
- name: List test files
- name: "List test files"
run: |
ls *.xml
# yamllint enable rule:line-length
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v5.5.1
- name: "Upload coverage to Codecov"
uses: "codecov/codecov-action@v5.5.1"
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: coverage.xml
Expand Down
26 changes: 9 additions & 17 deletions .github/workflows/flake8.yml
Original file line number Diff line number Diff line change
@@ -1,19 +1,9 @@
---
name: "Flake8"
name: "Flake8 Workflow"

on: # yamllint disable-line rule:truthy
push:
branches: [ main ]
paths:
- '**/*.py'
- 'requirements.txt'
- '.pylintrc'
pull_request:
branches: [ main ]
paths:
- '**/*.py'
- 'requirements.txt'
- '.pylintrc'
on: # yamllint disable-line rule:truthy
# Makes it reusable; called by other workflows
workflow_call:

permissions:
contents: "read"
Expand All @@ -33,21 +23,23 @@ jobs:
- name: Set up Python ${{ matrix.python-version }}
# This is the version of the action for setting up Python,
# not the Python version.
uses: actions/setup-python@v6
uses: "actions/setup-python@v6"
with:
python-version: ${{ matrix.python-version }}
- name: "Cache PIP Dependencies"
uses: "actions/cache@v4"
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ matrix.python-version }}-${{ hashFiles('requirements.txt') }}
key: |
${{ runner.os }}-pip-${{ matrix.python-version }}-${{ hashFiles('requirements.txt') }}
restore-keys: |
${{ runner.os }}-pip-${{ matrix.python-version }}-
${{ runner.os }}-pip-
# You can test your matrix by printing the current
# Python version
- name: "Display Python Version"
run: python -c "import sys; print(sys.version)"
run: |
python -c "import sys; print(sys.version)"
- name: "Install Dependencies"
run: |
python -m pip install --upgrade pip
Expand Down
83 changes: 83 additions & 0 deletions .github/workflows/lint_test_report.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
---
name: "Main Pipeline"

on: # yamllint disable-line rule:truthy
push:
branches: [ main ]
pull_request:
branches: [ main ]

permissions:
contents: "read"
pull-requests: "read"

jobs:
changed-files:
runs-on: "ubuntu-latest"
outputs:
python_changed: ${{ steps.python-files.outputs.any_changed }}
yaml_changed: ${{ steps.yaml-files.outputs.any_changed }}
steps:
- uses: "actions/checkout@v5"
- name: "Get changed Python files"
id: python-files
uses: "tj-actions/changed-files@v47"
with:
files: |
**/*.py
requirements.txt
.pylintrc
- name: "Get changed YAML files"
id: yaml-files
uses: "tj-actions/changed-files@v47"
with:
files: |
**/*.yml
**/*.yaml

yamllint:
name: "YAML Lint Workflow"
needs:
- "changed-files"
if: needs.changed-files.outputs.yaml_changed == 'true'
uses: "./.github/workflows/yamllint.yml"

ruff:
name: "Ruff Lint and Format"
needs:
- "changed-files"
- "yamllint"
if: needs.changed-files.outputs.python_changed == 'true'
uses: "./.github/workflows/ruff.yml"

pylint:
name: "Pylint Workflow"
needs:
- "changed-files"
- "yamllint"
if: needs.changed-files.outputs.python_changed == 'true'
uses: "./.github/workflows/pylint.yml"

flake8:
name: "Flake8 Workflow"
needs:
- "changed-files"
- "yamllint"
if: needs.changed-files.outputs.python_changed == 'true'
uses: "./.github/workflows/flake8.yml"

pytest:
name: "Pytest Workflow"
needs:
- "ruff"
- "pylint"
- "flake8"
uses: "./.github/workflows/pytest.yml"

codecov:
name: "Codecov Coverage Report"
needs:
- "pytest"
uses: "./.github/workflows/codecov.yml"
secrets:
CODECOV_TOKEN: "${{ secrets.CODECOV_TOKEN }}"
62 changes: 26 additions & 36 deletions .github/workflows/pylint.yml
Original file line number Diff line number Diff line change
@@ -1,19 +1,9 @@
---
name: "Pylint"
name: "Pylint Workflow"

on:
push:
branches: [ main ]
paths:
- '**/*.py'
- 'requirements.txt'
- '.pylintrc'
pull_request:
branches: [ main ]
paths:
- '**/*.py'
- 'requirements.txt'
- '.pylintrc'
on: # yamllint disable-line rule:truthy
# Makes it reusable; called by other workflows
workflow_call:

jobs:
build:
Expand All @@ -25,25 +15,25 @@ jobs:
matrix:
python-version: ["3.12"]
steps:
- uses: "actions/checkout@v5"
- name: Set up Python ${{ matrix.python-version }}
uses: "actions/setup-python@v6"
with:
python-version: ${{ matrix.python-version }}
- name: "Cache PIP Dependencies"
uses: "actions/cache@v4"
with:
path: ~/.cache/pip
key: |
${{ runner.os }}-pip-${{ matrix.python-version }}-${{ hashFiles('requirements.txt') }}
restore-keys: |
${{ runner.os }}-pip-${{ matrix.python-version }}-
${{ runner.os }}-pip-
- name: "Install dependencies"
run: |
python -m pip install --upgrade pip
pip install pylint
pip install -r requirements.txt
- name: "Analysing the code with pylint"
run: |
python -m pylint --verbose $(find . -name "*.py" ! -path "*/.venv/*" ! -path "*/venv/*") --rcfile=.pylintrc
- uses: "actions/checkout@v5"
- name: Set up Python ${{ matrix.python-version }}
uses: "actions/setup-python@v6"
with:
python-version: ${{ matrix.python-version }}
- name: "Cache PIP Dependencies"
uses: "actions/cache@v4"
with:
path: ~/.cache/pip
key: |
${{ runner.os }}-pip-${{ matrix.python-version }}-${{ hashFiles('requirements.txt') }}
restore-keys: |
${{ runner.os }}-pip-${{ matrix.python-version }}-
${{ runner.os }}-pip-
- name: "Install dependencies"
run: |
python -m pip install --upgrade pip
pip install pylint
pip install -r requirements.txt
- name: "Analysing the code with pylint"
run: |
python -m pylint --verbose $(find . -name "*.py" ! -path "*/.venv/*" ! -path "*/venv/*") --rcfile=.pylintrc
54 changes: 26 additions & 28 deletions .github/workflows/pytest.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
---
name: "Pytest Workflow"

on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
on: # yamllint disable-line rule:truthy
# Makes it reusable; called by other workflows
workflow_call:

jobs:
test:
Expand All @@ -14,26 +12,26 @@ jobs:
# indefinitely if something goes wrong
timeout-minutes: 10
steps:
- name: "Checkout code"
uses: "actions/checkout@v5"
- name: "Set up Python 3.12"
uses: "actions/setup-python@v6"
with:
python-version: "3.12"
- name: "Cache PIP Dependencies"
uses: "actions/cache@v4"
with:
path: ~/.cache/pip
key: |
${{ runner.os }}-pip-${{ matrix.python-version }}-${{ hashFiles('requirements.txt') }}
restore-keys: |
${{ runner.os }}-pip-${{ matrix.python-version }}-
${{ runner.os }}-pip-
- name: "Install dependencies"
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
pip install pytest
- name: "Run pytest"
run: |
pytest . --verbose --ignore=solutions --log-cli-level=INFO
- name: "Checkout code"
uses: "actions/checkout@v5"
- name: "Set up Python 3.12"
uses: "actions/setup-python@v6"
with:
python-version: "3.12"
- name: "Cache PIP Dependencies"
uses: "actions/cache@v4"
with:
path: ~/.cache/pip
key: |
${{ runner.os }}-pip-${{ matrix.python-version }}-${{ hashFiles('requirements.txt') }}
restore-keys: |
${{ runner.os }}-pip-${{ matrix.python-version }}-
${{ runner.os }}-pip-
- name: "Install dependencies"
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
pip install pytest
- name: "Run pytest"
run: |
pytest . --verbose --ignore=solutions --log-cli-level=INFO
21 changes: 6 additions & 15 deletions .github/workflows/ruff.yml
Original file line number Diff line number Diff line change
@@ -1,19 +1,9 @@
---
name: "Ruff Lint and Format"

on:
push:
branches: [ main ]
paths:
- '**/*.py'
- 'requirements.txt'
- '.pylintrc'
pull_request:
branches: [ main ]
paths:
- '**/*.py'
- 'requirements.txt'
- '.pylintrc'
on: # yamllint disable-line rule:truthy
# Makes it reusable; called by other workflows
workflow_call:

jobs:
ruff:
Expand All @@ -31,7 +21,8 @@ jobs:
uses: "actions/cache@v4"
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ matrix.python-version }}-${{ hashFiles('requirements.txt') }}
key: |
${{ runner.os }}-pip-${{ matrix.python-version }}-${{ hashFiles('requirements.txt') }}
restore-keys: |
${{ runner.os }}-pip-${{ matrix.python-version }}-
${{ runner.os }}-pip-
Expand All @@ -44,4 +35,4 @@ jobs:
ruff check --output-format=github .
- name: "Run Ruff format check"
run: |
ruff format --check .
ruff format --check .
Loading