Skip to content

Commit 4c51909

Browse files
authored
Setup workflows to match the current standard (#107)
* Extract setup in another action * Fix check docs job * Add weekly job * Add dependabot job for checking actions versions * Add weekly job to check for new python versions * Change action versions to hashes * Fix findings
1 parent a54f48a commit 4c51909

File tree

6 files changed

+106
-105
lines changed

6 files changed

+106
-105
lines changed
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
name: "CI common setup"
2+
description: "Setup python and install the Python SDK"
3+
inputs:
4+
python-version:
5+
description: "Set the Python version to be installed"
6+
required: false
7+
default: "3.10"
8+
extras:
9+
description: "Optional extras to install (e.g., 'dev', 'docs', or empty for none)"
10+
required: false
11+
default: "dev"
12+
runs:
13+
using: "composite"
14+
steps:
15+
- name: Set up Python ${{ inputs.python-version }}
16+
uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5.6.0
17+
with:
18+
python-version: ${{ inputs.python-version }}
19+
20+
- name: Install dependencies
21+
run: |
22+
python3 -m pip install --upgrade pip
23+
if [ -n "${{ inputs.extras }}" ]; then
24+
pip install .[${{ inputs.extras }}]
25+
else
26+
pip install .
27+
fi
28+
shell: bash

.github/dependabot.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
version: 2
2+
updates:
3+
# Enable version updates for GitHub Actions
4+
- package-ecosystem: "github-actions"
5+
directory: "/"
6+
schedule:
7+
interval: "weekly"
8+
open-pull-requests-limit: 10

.github/workflows/build.yml

Lines changed: 18 additions & 74 deletions
Original file line numberDiff line numberDiff line change
@@ -19,19 +19,11 @@ jobs:
1919
python: ['3.9', '3.10', '3.11', '3.12', '3.13']
2020
os: ['ubuntu-latest', 'windows-latest', 'macos-latest']
2121
steps:
22-
- name: Checkout code
23-
uses: actions/checkout@v4
24-
25-
- name: Set up Python ${{ matrix.python }}
26-
uses: actions/setup-python@v5
22+
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
23+
- uses: ./.github/actions/ci-setup
2724
with:
2825
python-version: ${{ matrix.python }}
2926

30-
- name: Install dependencies
31-
run: |
32-
python3 -m pip install --upgrade pip
33-
pip install .[dev]
34-
3527
- name: Print packages
3628
run: python3 -m pip list
3729

@@ -42,26 +34,16 @@ jobs:
4234
needs: setup
4335
runs-on: ubuntu-latest
4436
steps:
45-
- name: Checkout code
46-
uses: actions/checkout@v4
47-
48-
- name: Set up Python
49-
uses: actions/setup-python@v5
50-
with:
51-
python-version: '3.10'
52-
53-
- name: Install dependencies
54-
run: |
55-
python3 -m pip install --upgrade pip
56-
pip install .[dev]
37+
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
38+
- uses: ./.github/actions/ci-setup
5739

5840
- name: Run unit tests
5941
id: check
6042
run: python3 run_checks.py --utest
6143
continue-on-error: true
6244

6345
- name: Upload unit test report
64-
uses: actions/upload-artifact@v4
46+
uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f # v6.0.0
6547
with:
6648
name: unit-test-report
6749
path: reports/utest
@@ -74,26 +56,16 @@ jobs:
7456
needs: setup
7557
runs-on: ubuntu-latest
7658
steps:
77-
- name: Checkout code
78-
uses: actions/checkout@v4
79-
80-
- name: Set up Python
81-
uses: actions/setup-python@v5
82-
with:
83-
python-version: '3.10'
84-
85-
- name: Install dependencies
86-
run: |
87-
python3 -m pip install --upgrade pip
88-
pip install .[dev]
59+
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
60+
- uses: ./.github/actions/ci-setup
8961

9062
- name: Run coverage
9163
id: check
9264
run: python3 run_checks.py --cov
9365
continue-on-error: true
9466

9567
- name: Upload coverage report
96-
uses: actions/upload-artifact@v4
68+
uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f # v6.0.0
9769
with:
9870
name: coverage-report
9971
path: reports/coverage
@@ -106,26 +78,16 @@ jobs:
10678
needs: setup
10779
runs-on: ubuntu-latest
10880
steps:
109-
- name: Checkout code
110-
uses: actions/checkout@v4
111-
112-
- name: Set up Python
113-
uses: actions/setup-python@v5
114-
with:
115-
python-version: '3.10'
116-
117-
- name: Install dependencies
118-
run: |
119-
python3 -m pip install --upgrade pip
120-
pip install .[dev]
81+
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
82+
- uses: ./.github/actions/ci-setup
12183

12284
- name: Run lint
12385
id: check
12486
run: python3 run_checks.py --lint
12587
continue-on-error: true
12688

12789
- name: Upload lint report
128-
uses: actions/upload-artifact@v4
90+
uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f # v6.0.0
12991
with:
13092
name: pylint-report
13193
path: reports/pylint
@@ -138,26 +100,16 @@ jobs:
138100
needs: setup
139101
runs-on: ubuntu-latest
140102
steps:
141-
- name: Checkout code
142-
uses: actions/checkout@v4
143-
144-
- name: Set up Python
145-
uses: actions/setup-python@v5
146-
with:
147-
python-version: '3.10'
148-
149-
- name: Install dependencies
150-
run: |
151-
python3 -m pip install --upgrade pip
152-
pip install .[dev]
103+
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
104+
- uses: ./.github/actions/ci-setup
153105

154106
- name: Run pep8 codestyle check
155107
id: check
156108
run: python3 run_checks.py --pep8
157109
continue-on-error: true
158110

159111
- name: Upload codestyle report
160-
uses: actions/upload-artifact@v4
112+
uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f # v6.0.0
161113
with:
162114
name: codestyle-report
163115
path: reports/codestyle
@@ -170,18 +122,10 @@ jobs:
170122
needs: setup
171123
runs-on: ubuntu-latest
172124
steps:
173-
- name: Checkout code
174-
uses: actions/checkout@v4
175-
176-
- name: Set up Python
177-
uses: actions/setup-python@v5
125+
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
126+
- uses: ./.github/actions/ci-setup
178127
with:
179-
python-version: '3.10'
180-
181-
- name: Install dependencies
182-
run: |
183-
python3 -m pip install --upgrade pip
184-
pip install .[docs]
128+
extras: docs
185129

186130
- name: Generate documentation
187131
run: |
@@ -190,7 +134,7 @@ jobs:
190134
cd ..
191135
192136
- name: Upload documentation
193-
uses: actions/upload-artifact@v4
137+
uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f # v6.0.0
194138
with:
195139
name: docs_html
196140
path: docs/build/html

.github/workflows/documentation.yml

Lines changed: 6 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -11,21 +11,13 @@ jobs:
1111
build-docs:
1212
runs-on: ubuntu-latest
1313
steps:
14-
- name: Checkout code
15-
uses: actions/checkout@v4
14+
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
1615
with:
1716
fetch-depth: 0
1817
fetch-tags: true
19-
20-
- name: Set up Python
21-
uses: actions/setup-python@v5
18+
- uses: ./.github/actions/ci-setup
2219
with:
23-
python-version: '3.10'
24-
25-
- name: Install dependencies
26-
run: |
27-
python3 -m pip install --upgrade pip
28-
pip install .[docs]
20+
extras: docs
2921

3022
- name: Generate documentation
3123
run: |
@@ -34,10 +26,10 @@ jobs:
3426
cd ..
3527
3628
- name: Setup Pages
37-
uses: actions/configure-pages@v5
29+
uses: actions/configure-pages@983d7736d9b0ae728b81ab479565c72886d7745b # v5.0.0
3830

3931
- name: Upload artifact
40-
uses: actions/upload-pages-artifact@v3
32+
uses: actions/upload-pages-artifact@56afc609e74202658d3ffba0e8f6dda462b719fa # v3.0.1
4133
with:
4234
path: docs/build_versioned
4335

@@ -53,4 +45,4 @@ jobs:
5345
steps:
5446
- name: Deploy to GitHub Pages
5547
id: deployment
56-
uses: actions/deploy-pages@v4
48+
uses: actions/deploy-pages@d6db90164ac5ed86f2b6aed7e0febac5b3c0c03e # v4.0.5

.github/workflows/release.yml

Lines changed: 10 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -23,49 +23,42 @@ jobs:
2323
runs-on: ubuntu-latest
2424

2525
steps:
26-
- uses: actions/checkout@v4
26+
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
27+
- uses: ./.github/actions/ci-setup
2728

28-
- name: "Set up Python"
29-
uses: actions/setup-python@v3
30-
with:
31-
python-version: '3.10'
32-
33-
- name: "Install dependencies"
34-
run: |
35-
python3 -m pip install --upgrade pip
36-
python3 -m pip install .[dev]
37-
python3 -m pip install --upgrade twine build
29+
- name: "Upgrade dependencies"
30+
run: python3 -m pip install --upgrade twine build
3831

3932
- name: "Build package"
4033
run: |
4134
python3 -m build
4235
4336
- name: "Upload dist as artifact"
44-
uses: actions/upload-artifact@v4
37+
uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f # v6.0.0
4538
with:
4639
name: dist-artifact
4740
path: dist/
4841

4942
- name: "Download artifacts for unit tests"
50-
uses: actions/download-artifact@v4.1.7
43+
uses: actions/download-artifact@37930b1c2abaa49bbe596cd826c3c89aef350131 # v7.0.0
5144
with:
5245
name: unit-test-report
5346
path: reports/unit-test-report
5447

5548
- name: "Download artifacts for coverage"
56-
uses: actions/download-artifact@v4.1.7
49+
uses: actions/download-artifact@37930b1c2abaa49bbe596cd826c3c89aef350131 # v7.0.0
5750
with:
5851
name: coverage-report
5952
path: reports/coverage-report
6053

6154
- name: "Download artifacts for lint"
62-
uses: actions/download-artifact@v4.1.7
55+
uses: actions/download-artifact@37930b1c2abaa49bbe596cd826c3c89aef350131 # v7.0.0
6356
with:
6457
name: pylint-report
6558
path: reports/pylint-report
6659

6760
- name: "Download artifacts for codestyle"
68-
uses: actions/download-artifact@v4.1.7
61+
uses: actions/download-artifact@37930b1c2abaa49bbe596cd826c3c89aef350131 # v7.0.0
6962
with:
7063
name: codestyle-report
7164
path: reports/codestyle-report
@@ -100,7 +93,7 @@ jobs:
10093

10194
steps:
10295
- name: "Download dist artifact"
103-
uses: actions/download-artifact@v4
96+
uses: actions/download-artifact@37930b1c2abaa49bbe596cd826c3c89aef350131 # v7.0.0
10497
with:
10598
name: dist-artifact
10699
path: dist

.github/workflows/weekly.yml

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
name: Weekly Build
2+
3+
on:
4+
schedule:
5+
- cron: '0 0 * * 0' # Runs every Sunday at midnight UTC
6+
workflow_dispatch:
7+
8+
env:
9+
LATEST_KNOWN_PYTHON: '3.13'
10+
11+
jobs:
12+
build:
13+
uses: ./.github/workflows/build.yml
14+
15+
check-python-version:
16+
runs-on: ubuntu-latest
17+
steps:
18+
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
19+
20+
- name: Check for new Python versions
21+
run: |
22+
latest=$(curl -s https://endoflife.date/api/python.json | \
23+
jq -r '[.[] | select(.cycle | test("^3\\.[0-9]+$"))] | .[0].cycle')
24+
25+
echo "Latest stable Python: $latest"
26+
echo "Known latest: $LATEST_KNOWN_PYTHON"
27+
28+
if [ "$latest" != "$LATEST_KNOWN_PYTHON" ]; then
29+
echo "::warning::New Python version $latest is available! Manual update is required."
30+
31+
echo "## :warning: New Python Version Available" >> $GITHUB_STEP_SUMMARY
32+
echo "" >> $GITHUB_STEP_SUMMARY
33+
echo "Python **$latest** has been released (currently testing up to $LATEST_KNOWN_PYTHON)." >> $GITHUB_STEP_SUMMARY
34+
else
35+
echo "Python version is up to date."
36+
fi

0 commit comments

Comments
 (0)