Skip to content

Commit 72701ac

Browse files
committed
Updated workflow
1 parent 800df3c commit 72701ac

1 file changed

Lines changed: 36 additions & 25 deletions

File tree

‎.github/workflows/python-package.yml‎

Lines changed: 36 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -3,51 +3,66 @@
33

44
name: build
55

6-
env:
7-
package: dsff
8-
96
on:
107
push:
118
branches: [ "main" ]
129
pull_request:
1310
branches: [ "main" ]
1411

12+
permissions:
13+
actions: write
14+
id-token: write # for OIDC
15+
contents: read
16+
1517
jobs:
18+
prepare:
19+
runs-on: ubuntu-latest
20+
outputs:
21+
package: ${{ steps.pkg.outputs.package }}
22+
steps:
23+
- name: Compute package name from the repository's
24+
id: pkg
25+
run: |
26+
name="${GITHUB_REPOSITORY##*/}"
27+
echo "package=${name#python-}" >> $GITHUB_OUTPUT
1628
build:
29+
needs: prepare
1730
runs-on: ${{ matrix.os }}
1831
strategy:
1932
fail-fast: false
2033
matrix:
2134
os: [ubuntu-latest]
22-
python-version: ["3.10", "3.11", "3.12", "3.13"]
35+
python-version: ["3.9", "3.10", "3.11", "3.12", "3.13"]
36+
env:
37+
package: ${{ needs.prepare.outputs.package }}
2338
steps:
24-
- uses: actions/checkout@v3
39+
- uses: actions/checkout@v5
2540
- name: Set up Python ${{ matrix.python-version }}
26-
uses: actions/setup-python@v4
41+
uses: actions/setup-python@v6
2742
with:
2843
python-version: ${{ matrix.python-version }}
2944
- name: Install ${{ env.package }}
3045
run: |
3146
python -m pip install --upgrade pip
32-
python -m pip install flake8 pytest pytest-cov coverage
47+
python -m pip install pytest pytest-cov coverage
3348
pip install -r requirements.txt
3449
pip install .
35-
- name: Lint with flake8
36-
run: |
37-
# stop the build if there are Python syntax errors or undefined names
38-
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
39-
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
40-
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
4150
- name: Test ${{ env.package }} with pytest
4251
run: |
4352
pytest --cov=$package
4453
coverage:
45-
needs: build
54+
needs: [prepare, build]
4655
runs-on: ubuntu-latest
4756
env:
4857
cov_badge_path: docs/coverage.svg
58+
package: ${{ needs.prepare.outputs.package }}
59+
python_version: "3.13"
4960
steps:
50-
- uses: actions/checkout@v3
61+
- uses: actions/checkout@v5
62+
- name: Set up Python ${{ env.python_version }}
63+
uses: actions/setup-python@v6
64+
with:
65+
python-version: ${{ env.python_version }}
5166
- name: Install ${{ env.package }}
5267
run: |
5368
python -m pip install --upgrade pip
@@ -60,7 +75,7 @@ jobs:
6075
pytest --cov=$package --cov-report=xml
6176
genbadge coverage -i coverage.xml -o $cov_badge_path
6277
- name: Verify Changed files
63-
uses: tj-actions/verify-changed-files@v12
78+
uses: tj-actions/verify-changed-files@v20
6479
id: changed_files
6580
with:
6681
files: ${{ env.cov_badge_path }}
@@ -79,13 +94,13 @@ jobs:
7994
branch: ${{ github.ref }}
8095
deploy:
8196
runs-on: ubuntu-latest
82-
needs: coverage
97+
needs: [prepare, coverage]
8398
steps:
84-
- uses: actions/checkout@v3
99+
- uses: actions/checkout@v5
85100
with:
86101
fetch-depth: 0
87102
- name: Check for version change
88-
uses: dorny/paths-filter@v2
103+
uses: dorny/paths-filter@v4
89104
id: filter
90105
with:
91106
filters: |
@@ -98,12 +113,8 @@ jobs:
98113
awk '{if (match($0,"## Supporters")) exit; print}' README.md > README
99114
mv -f README README.md
100115
- if: steps.filter.outputs.version == 'true'
101-
name: Build ${{ env.package }} package
116+
name: Build ${{ needs.prepare.outputs.package }} package
102117
run: python3 -m pip install --upgrade build && python3 -m build
103118
- if: steps.filter.outputs.version == 'true'
104-
name: Upload ${{ env.package }} to PyPi
119+
name: Publish to PyPI
105120
uses: pypa/gh-action-pypi-publish@release/v1
106-
with:
107-
password: ${{ secrets.PYPI_API_TOKEN }}
108-
verbose: true
109-
verify_metadata: false

0 commit comments

Comments
 (0)