Skip to content

Commit 577e8c2

Browse files
committed
fix: fix release workflow
1 parent 8fc84ad commit 577e8c2

File tree

1 file changed

+185
-20
lines changed

1 file changed

+185
-20
lines changed

.github/workflows/release.yml

Lines changed: 185 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,38 +1,203 @@
1-
name: Release
1+
name: CI
2+
3+
env:
4+
POETRY_VIRTUALENVS_CREATE: true
25

36
on:
47
push:
5-
branches: [ main ]
8+
branches: [ main, develop ]
9+
pull_request:
610

711
jobs:
8-
release:
12+
lint:
913
runs-on: ubuntu-latest
10-
permissions:
11-
contents: write
12-
id-token: write
14+
timeout-minutes: 15
1315
steps:
1416
- uses: actions/checkout@v4
15-
1617
- uses: actions/setup-python@v5
1718
with:
18-
python-version: "3.11"
19+
python-version: '3.11'
20+
- uses: actions/cache@v4
21+
with:
22+
path: |
23+
~/.cache/pip
24+
~/.cache/pypoetry
25+
key: ${{ runner.os }}-poetry-${{ hashFiles('poetry.lock') }}
26+
restore-keys: |
27+
${{ runner.os }}-poetry-
28+
- uses: abatilo/actions-poetry@v3
29+
with:
30+
poetry-version: 1.8.3
31+
- name: Install deps
32+
timeout-minutes: 5
33+
run: poetry install
34+
- name: Lint
35+
run: poetry run flake8 src/ssspx
36+
- name: Docstring style
37+
run: poetry run pydocstyle src/ssspx
38+
- name: Docstring coverage
39+
run: poetry run interrogate -q -c pyproject.toml
40+
- name: Type check
41+
run: poetry run mypy src/ssspx
42+
- name: Security scan
43+
run: poetry run bandit -r src/ssspx -c bandit.yaml --severity-level high
44+
- name: Dependency audit
45+
timeout-minutes: 3
46+
run: poetry run pip-audit --ignore-vuln PYSEC-2022-42969
47+
- name: Deprecations up-to-date
48+
run: poetry run python tools/check_deprecations.py
49+
- name: Validate citation metadata
50+
run: poetry run cffconvert --validate --infile CITATION.cff
1951

20-
- name: Install Poetry
21-
uses: abatilo/actions-poetry@v3
52+
unit:
53+
needs: lint
54+
runs-on: ${{ matrix.os }}
55+
timeout-minutes: 20
56+
strategy:
57+
fail-fast: false
58+
matrix:
59+
os: [ubuntu-latest, macos-latest, windows-latest]
60+
python-version: ['3.9', '3.10', '3.11', '3.12']
61+
defaults:
62+
run:
63+
shell: bash
64+
steps:
65+
- uses: actions/checkout@v4
66+
- uses: actions/setup-python@v5
67+
with:
68+
python-version: ${{ matrix.python-version }}
69+
- uses: actions/cache@v4
70+
with:
71+
path: |
72+
~/.cache/pip
73+
~/.cache/pypoetry
74+
C:\\Users\\runneradmin\\AppData\\Local\\pip\\Cache
75+
C:\\Users\\runneradmin\\AppData\\Local\\pypoetry\\Cache
76+
key: ${{ runner.os }}-poetry-${{ hashFiles('poetry.lock') }}
77+
restore-keys: |
78+
${{ runner.os }}-poetry-
79+
- uses: abatilo/actions-poetry@v3
2280
with:
2381
poetry-version: 1.8.3
82+
- name: Install deps
83+
timeout-minutes: 5
84+
run: poetry install
85+
- name: Unit tests
86+
timeout-minutes: 10
87+
run: poetry run pytest -q --maxfail=1 --disable-warnings --cov=ssspx --cov-report=term-missing -m "not integration" --tb=short
2488

25-
- name: Install dependencies
26-
run: |
27-
poetry install
89+
integration:
90+
runs-on: ubuntu-latest
91+
timeout-minutes: 15
92+
needs: [lint, unit]
93+
steps:
94+
- uses: actions/checkout@v4
95+
- uses: actions/setup-python@v5
96+
with:
97+
python-version: '3.11'
98+
- uses: actions/cache@v4
99+
with:
100+
path: |
101+
~/.cache/pip
102+
~/.cache/pypoetry
103+
key: ${{ runner.os }}-poetry-${{ hashFiles('poetry.lock') }}
104+
restore-keys: |
105+
${{ runner.os }}-poetry-
106+
- uses: abatilo/actions-poetry@v3
107+
with:
108+
poetry-version: 1.8.3
109+
- name: Install deps
110+
timeout-minutes: 5
111+
run: poetry install
112+
- name: Integration tests
113+
timeout-minutes: 5
114+
run: poetry run pytest -q -m integration --tb=short
28115

29-
- name: Run tests
30-
run: |
31-
poetry run pytest -q --maxfail=1 --disable-warnings
116+
docs:
117+
runs-on: ubuntu-latest
118+
timeout-minutes: 10
119+
needs: [lint, unit]
120+
steps:
121+
- uses: actions/checkout@v4
122+
- uses: actions/setup-python@v5
123+
with:
124+
python-version: '3.11'
125+
- uses: actions/cache@v4
126+
with:
127+
path: |
128+
~/.cache/pip
129+
~/.cache/pypoetry
130+
key: ${{ runner.os }}-poetry-${{ hashFiles('poetry.lock') }}
131+
restore-keys: |
132+
${{ runner.os }}-poetry-
133+
- uses: abatilo/actions-poetry@v3
134+
with:
135+
poetry-version: 1.8.3
136+
- name: Install deps
137+
timeout-minutes: 5
138+
run: poetry install
139+
- name: Build docs
140+
run: poetry run mkdocs build --strict
32141

33-
- name: Semantic Release
142+
release:
143+
runs-on: ubuntu-latest
144+
timeout-minutes: 15
145+
needs: [integration, docs]
146+
if: github.ref == 'refs/heads/main' && github.event_name == 'push'
147+
steps:
148+
- uses: actions/checkout@v4
149+
- uses: actions/setup-python@v5
150+
with:
151+
python-version: '3.11'
152+
- uses: actions/cache@v4
153+
with:
154+
path: |
155+
~/.cache/pip
156+
~/.cache/pypoetry
157+
key: ${{ runner.os }}-poetry-${{ hashFiles('poetry.lock') }}
158+
restore-keys: |
159+
${{ runner.os }}-poetry-
160+
- uses: abatilo/actions-poetry@v3
161+
with:
162+
poetry-version: 1.8.3
163+
- name: Install deps
164+
timeout-minutes: 5
165+
run: poetry install
166+
- name: Build distributions
167+
run: poetry build
168+
- name: Upload artifacts
169+
uses: actions/upload-artifact@v4
170+
with:
171+
name: dist
172+
path: dist/*
173+
- name: Publish release
34174
env:
35175
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
36-
run: |
37-
poetry run semantic-release version
38-
poetry run semantic-release publish
176+
run: poetry run semantic-release publish --skip-build
177+
178+
extras:
179+
runs-on: ubuntu-latest
180+
timeout-minutes: 15
181+
needs: lint
182+
steps:
183+
- uses: actions/checkout@v4
184+
- uses: actions/setup-python@v5
185+
with:
186+
python-version: '3.11'
187+
- uses: actions/cache@v4
188+
with:
189+
path: |
190+
~/.cache/pip
191+
~/.cache/pypoetry
192+
key: ${{ runner.os }}-poetry-${{ hashFiles('poetry.lock') }}-numpy
193+
restore-keys: |
194+
${{ runner.os }}-poetry-
195+
- uses: abatilo/actions-poetry@v3
196+
with:
197+
poetry-version: 1.8.3
198+
- name: Install with extras
199+
timeout-minutes: 5
200+
run: poetry install -E numpy-backend
201+
- name: Unit tests with extras
202+
timeout-minutes: 5
203+
run: poetry run pytest -q --maxfail=1 --disable-warnings -m "not integration" --tb=short

0 commit comments

Comments
 (0)