Skip to content

Commit ce3befd

Browse files
authored
Merge pull request #183 from ikostan/main
Merge from master
2 parents 382f9d9 + ccd9136 commit ce3befd

File tree

16 files changed

+618
-149
lines changed

16 files changed

+618
-149
lines changed

.github/workflows/codecov.yml

Lines changed: 19 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
11
---
2-
name: Codecov Coverage Report
2+
name: "Codecov Coverage Report"
33

4-
on: # yamllint disable-line rule:truthy
5-
push:
6-
branches: [ main ]
7-
pull_request:
8-
branches: [ main ]
4+
on: # yamllint disable-line rule:truthy
5+
# Makes it reusable; called by other workflows
6+
workflow_call:
7+
secrets:
8+
CODECOV_TOKEN:
9+
description: "CODECOV Auth Token"
10+
required: true
911

1012
jobs:
1113
run:
@@ -15,27 +17,28 @@ jobs:
1517
timeout-minutes: 10
1618
strategy:
1719
matrix:
18-
os: [ubuntu-latest]
20+
os: ["ubuntu-latest"]
1921
python-version: ["3.12"]
2022
steps:
21-
- uses: actions/checkout@main
22-
- name: Setup Python
23-
uses: actions/setup-python@main
23+
- uses: "actions/checkout@main"
24+
- name: "Setup Python"
25+
uses: "actions/setup-python@main"
2426
with:
2527
python-version: ${{ matrix.python-version }}
2628
- name: "Cache PIP Dependencies"
2729
uses: "actions/cache@v4"
2830
with:
2931
path: ~/.cache/pip
30-
key: ${{ runner.os }}-pip-${{ matrix.python-version }}-${{ hashFiles('requirements.txt') }}
32+
key: |
33+
${{ runner.os }}-pip-${{ matrix.python-version }}-${{ hashFiles('requirements.txt') }}
3134
restore-keys: |
3235
${{ runner.os }}-pip-${{ matrix.python-version }}-
3336
${{ runner.os }}-pip-
34-
- name: Install prerequisites
37+
- name: "Install prerequisites"
3538
run: |
3639
python -m pip install --upgrade pip setuptools wheel
3740
pip install -r requirements.txt
38-
- name: Install pytest, pytest-cov
41+
- name: "Install pytest, pytest-cov"
3942
run: |
4043
pip install pytest
4144
pip install pytest-cov
@@ -44,12 +47,12 @@ jobs:
4447
run: |
4548
python -c "import os; print(os.getcwd())"
4649
python -m pytest . --ignore=solutions --log-cli-level=INFO -v --cov-report term-missing --cov --cov-branch --cov-report=xml
47-
- name: List test files
50+
- name: "List test files"
4851
run: |
4952
ls *.xml
5053
# yamllint enable rule:line-length
51-
- name: Upload coverage to Codecov
52-
uses: codecov/codecov-action@v5.5.1
54+
- name: "Upload coverage to Codecov"
55+
uses: "codecov/codecov-action@v5.5.1"
5356
with:
5457
token: ${{ secrets.CODECOV_TOKEN }}
5558
files: coverage.xml

.github/workflows/flake8.yml

Lines changed: 9 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,9 @@
11
---
2-
name: "Flake8"
2+
name: "Flake8 Workflow"
33

4-
on: # yamllint disable-line rule:truthy
5-
push:
6-
branches: [ main ]
7-
paths:
8-
- '**/*.py'
9-
- 'requirements.txt'
10-
- '.pylintrc'
11-
pull_request:
12-
branches: [ main ]
13-
paths:
14-
- '**/*.py'
15-
- 'requirements.txt'
16-
- '.pylintrc'
4+
on: # yamllint disable-line rule:truthy
5+
# Makes it reusable; called by other workflows
6+
workflow_call:
177

188
permissions:
199
contents: "read"
@@ -33,21 +23,23 @@ jobs:
3323
- name: Set up Python ${{ matrix.python-version }}
3424
# This is the version of the action for setting up Python,
3525
# not the Python version.
36-
uses: actions/setup-python@v6
26+
uses: "actions/setup-python@v6"
3727
with:
3828
python-version: ${{ matrix.python-version }}
3929
- name: "Cache PIP Dependencies"
4030
uses: "actions/cache@v4"
4131
with:
4232
path: ~/.cache/pip
43-
key: ${{ runner.os }}-pip-${{ matrix.python-version }}-${{ hashFiles('requirements.txt') }}
33+
key: |
34+
${{ runner.os }}-pip-${{ matrix.python-version }}-${{ hashFiles('requirements.txt') }}
4435
restore-keys: |
4536
${{ runner.os }}-pip-${{ matrix.python-version }}-
4637
${{ runner.os }}-pip-
4738
# You can test your matrix by printing the current
4839
# Python version
4940
- name: "Display Python Version"
50-
run: python -c "import sys; print(sys.version)"
41+
run: |
42+
python -c "import sys; print(sys.version)"
5143
- name: "Install Dependencies"
5244
run: |
5345
python -m pip install --upgrade pip
Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
---
2+
name: "Main Pipeline"
3+
4+
on: # yamllint disable-line rule:truthy
5+
push:
6+
branches: [ main ]
7+
pull_request:
8+
branches: [ main ]
9+
10+
permissions:
11+
contents: "read"
12+
pull-requests: "read"
13+
14+
jobs:
15+
changed-files:
16+
runs-on: "ubuntu-latest"
17+
outputs:
18+
python_changed: ${{ steps.python-files.outputs.any_changed }}
19+
yaml_changed: ${{ steps.yaml-files.outputs.any_changed }}
20+
steps:
21+
- uses: "actions/checkout@v5"
22+
- name: "Get changed Python files"
23+
id: python-files
24+
uses: "tj-actions/changed-files@v47"
25+
with:
26+
files: |
27+
**/*.py
28+
requirements.txt
29+
.pylintrc
30+
- name: "Get changed YAML files"
31+
id: yaml-files
32+
uses: "tj-actions/changed-files@v47"
33+
with:
34+
files: |
35+
**/*.yml
36+
**/*.yaml
37+
38+
yamllint:
39+
name: "YAML Lint Workflow"
40+
needs:
41+
- "changed-files"
42+
if: needs.changed-files.outputs.yaml_changed == 'true'
43+
uses: "./.github/workflows/yamllint.yml"
44+
45+
ruff:
46+
name: "Ruff Lint and Format"
47+
needs:
48+
- "changed-files"
49+
- "yamllint"
50+
if: needs.changed-files.outputs.python_changed == 'true'
51+
uses: "./.github/workflows/ruff.yml"
52+
53+
pylint:
54+
name: "Pylint Workflow"
55+
needs:
56+
- "changed-files"
57+
- "yamllint"
58+
if: needs.changed-files.outputs.python_changed == 'true'
59+
uses: "./.github/workflows/pylint.yml"
60+
61+
flake8:
62+
name: "Flake8 Workflow"
63+
needs:
64+
- "changed-files"
65+
- "yamllint"
66+
if: needs.changed-files.outputs.python_changed == 'true'
67+
uses: "./.github/workflows/flake8.yml"
68+
69+
pytest:
70+
name: "Pytest Workflow"
71+
needs:
72+
- "ruff"
73+
- "pylint"
74+
- "flake8"
75+
uses: "./.github/workflows/pytest.yml"
76+
77+
codecov:
78+
name: "Codecov Coverage Report"
79+
needs:
80+
- "pytest"
81+
uses: "./.github/workflows/codecov.yml"
82+
secrets:
83+
CODECOV_TOKEN: "${{ secrets.CODECOV_TOKEN }}"

.github/workflows/pylint.yml

Lines changed: 26 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,9 @@
11
---
2-
name: "Pylint"
2+
name: "Pylint Workflow"
33

4-
on:
5-
push:
6-
branches: [ main ]
7-
paths:
8-
- '**/*.py'
9-
- 'requirements.txt'
10-
- '.pylintrc'
11-
pull_request:
12-
branches: [ main ]
13-
paths:
14-
- '**/*.py'
15-
- 'requirements.txt'
16-
- '.pylintrc'
4+
on: # yamllint disable-line rule:truthy
5+
# Makes it reusable; called by other workflows
6+
workflow_call:
177

188
jobs:
199
build:
@@ -25,25 +15,25 @@ jobs:
2515
matrix:
2616
python-version: ["3.12"]
2717
steps:
28-
- uses: "actions/checkout@v5"
29-
- name: Set up Python ${{ matrix.python-version }}
30-
uses: "actions/setup-python@v6"
31-
with:
32-
python-version: ${{ matrix.python-version }}
33-
- name: "Cache PIP Dependencies"
34-
uses: "actions/cache@v4"
35-
with:
36-
path: ~/.cache/pip
37-
key: |
38-
${{ runner.os }}-pip-${{ matrix.python-version }}-${{ hashFiles('requirements.txt') }}
39-
restore-keys: |
40-
${{ runner.os }}-pip-${{ matrix.python-version }}-
41-
${{ runner.os }}-pip-
42-
- name: "Install dependencies"
43-
run: |
44-
python -m pip install --upgrade pip
45-
pip install pylint
46-
pip install -r requirements.txt
47-
- name: "Analysing the code with pylint"
48-
run: |
49-
python -m pylint --verbose $(find . -name "*.py" ! -path "*/.venv/*" ! -path "*/venv/*") --rcfile=.pylintrc
18+
- uses: "actions/checkout@v5"
19+
- name: Set up Python ${{ matrix.python-version }}
20+
uses: "actions/setup-python@v6"
21+
with:
22+
python-version: ${{ matrix.python-version }}
23+
- name: "Cache PIP Dependencies"
24+
uses: "actions/cache@v4"
25+
with:
26+
path: ~/.cache/pip
27+
key: |
28+
${{ runner.os }}-pip-${{ matrix.python-version }}-${{ hashFiles('requirements.txt') }}
29+
restore-keys: |
30+
${{ runner.os }}-pip-${{ matrix.python-version }}-
31+
${{ runner.os }}-pip-
32+
- name: "Install dependencies"
33+
run: |
34+
python -m pip install --upgrade pip
35+
pip install pylint
36+
pip install -r requirements.txt
37+
- name: "Analysing the code with pylint"
38+
run: |
39+
python -m pylint --verbose $(find . -name "*.py" ! -path "*/.venv/*" ! -path "*/venv/*") --rcfile=.pylintrc

.github/workflows/pytest.yml

Lines changed: 26 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,9 @@
11
---
22
name: "Pytest Workflow"
33

4-
on:
5-
push:
6-
branches: [ main ]
7-
pull_request:
8-
branches: [ main ]
4+
on: # yamllint disable-line rule:truthy
5+
# Makes it reusable; called by other workflows
6+
workflow_call:
97

108
jobs:
119
test:
@@ -14,26 +12,26 @@ jobs:
1412
# indefinitely if something goes wrong
1513
timeout-minutes: 10
1614
steps:
17-
- name: "Checkout code"
18-
uses: "actions/checkout@v5"
19-
- name: "Set up Python 3.12"
20-
uses: "actions/setup-python@v6"
21-
with:
22-
python-version: "3.12"
23-
- name: "Cache PIP Dependencies"
24-
uses: "actions/cache@v4"
25-
with:
26-
path: ~/.cache/pip
27-
key: |
28-
${{ runner.os }}-pip-${{ matrix.python-version }}-${{ hashFiles('requirements.txt') }}
29-
restore-keys: |
30-
${{ runner.os }}-pip-${{ matrix.python-version }}-
31-
${{ runner.os }}-pip-
32-
- name: "Install dependencies"
33-
run: |
34-
python -m pip install --upgrade pip
35-
pip install -r requirements.txt
36-
pip install pytest
37-
- name: "Run pytest"
38-
run: |
39-
pytest . --verbose --ignore=solutions --log-cli-level=INFO
15+
- name: "Checkout code"
16+
uses: "actions/checkout@v5"
17+
- name: "Set up Python 3.12"
18+
uses: "actions/setup-python@v6"
19+
with:
20+
python-version: "3.12"
21+
- name: "Cache PIP Dependencies"
22+
uses: "actions/cache@v4"
23+
with:
24+
path: ~/.cache/pip
25+
key: |
26+
${{ runner.os }}-pip-${{ matrix.python-version }}-${{ hashFiles('requirements.txt') }}
27+
restore-keys: |
28+
${{ runner.os }}-pip-${{ matrix.python-version }}-
29+
${{ runner.os }}-pip-
30+
- name: "Install dependencies"
31+
run: |
32+
python -m pip install --upgrade pip
33+
pip install -r requirements.txt
34+
pip install pytest
35+
- name: "Run pytest"
36+
run: |
37+
pytest . --verbose --ignore=solutions --log-cli-level=INFO

.github/workflows/ruff.yml

Lines changed: 6 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,9 @@
11
---
22
name: "Ruff Lint and Format"
33

4-
on:
5-
push:
6-
branches: [ main ]
7-
paths:
8-
- '**/*.py'
9-
- 'requirements.txt'
10-
- '.pylintrc'
11-
pull_request:
12-
branches: [ main ]
13-
paths:
14-
- '**/*.py'
15-
- 'requirements.txt'
16-
- '.pylintrc'
4+
on: # yamllint disable-line rule:truthy
5+
# Makes it reusable; called by other workflows
6+
workflow_call:
177

188
jobs:
199
ruff:
@@ -31,7 +21,8 @@ jobs:
3121
uses: "actions/cache@v4"
3222
with:
3323
path: ~/.cache/pip
34-
key: ${{ runner.os }}-pip-${{ matrix.python-version }}-${{ hashFiles('requirements.txt') }}
24+
key: |
25+
${{ runner.os }}-pip-${{ matrix.python-version }}-${{ hashFiles('requirements.txt') }}
3526
restore-keys: |
3627
${{ runner.os }}-pip-${{ matrix.python-version }}-
3728
${{ runner.os }}-pip-
@@ -44,4 +35,4 @@ jobs:
4435
ruff check --output-format=github .
4536
- name: "Run Ruff format check"
4637
run: |
47-
ruff format --check .
38+
ruff format --check .

0 commit comments

Comments
 (0)