Skip to content

Commit c4e3e39

Browse files
committed
ci: full CI with OIDC PyPI publish + TestPyPI gate + codecov
1 parent 692c29e commit c4e3e39

1 file changed

Lines changed: 61 additions & 2 deletions

File tree

.github/workflows/ci.yml

Lines changed: 61 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,28 @@
11
name: CI
2+
23
on:
34
push:
45
branches: [main, develop]
56
pull_request:
67
branches: [main]
8+
release:
9+
types: [published]
710

811
jobs:
12+
lint:
13+
runs-on: ubuntu-latest
14+
steps:
15+
- uses: actions/checkout@v4
16+
- uses: actions/setup-python@v5
17+
with:
18+
python-version: "3.11"
19+
- run: pip install ruff mypy
20+
- run: ruff check .
21+
- run: ruff format --check .
22+
923
test:
1024
runs-on: ubuntu-latest
25+
needs: lint
1126
strategy:
1227
matrix:
1328
python-version: ["3.11", "3.12"]
@@ -16,6 +31,50 @@ jobs:
1631
- uses: actions/setup-python@v5
1732
with:
1833
python-version: ${{ matrix.python-version }}
34+
cache: pip
1935
- run: pip install -e ".[dev]"
20-
- run: ruff check .
21-
- run: pytest tests/ -v --cov --cov-report=xml
36+
- run: pytest tests/ -v --cov=psae_folio --cov-report=xml --cov-report=term-missing
37+
- uses: codecov/codecov-action@v4
38+
if: matrix.python-version == '3.11'
39+
with:
40+
files: coverage.xml
41+
flags: psae-folio
42+
fail_ci_if_error: false
43+
44+
publish-testpypi:
45+
runs-on: ubuntu-latest
46+
needs: test
47+
if: github.event_name == 'release'
48+
environment: testpypi
49+
permissions:
50+
id-token: write
51+
steps:
52+
- uses: actions/checkout@v4
53+
- uses: actions/setup-python@v5
54+
with:
55+
python-version: "3.11"
56+
- run: pip install build && python -m build
57+
- uses: pypa/gh-action-pypi-publish@release/v1
58+
with:
59+
repository-url: https://test.pypi.org/legacy/
60+
skip-existing: true
61+
62+
publish-pypi:
63+
runs-on: ubuntu-latest
64+
needs: publish-testpypi
65+
if: github.event_name == 'release'
66+
environment: pypi
67+
permissions:
68+
id-token: write
69+
steps:
70+
- uses: actions/checkout@v4
71+
- uses: actions/setup-python@v5
72+
with:
73+
python-version: "3.11"
74+
- run: pip install build && python -m build
75+
- name: Publish to PyPI (OIDC trusted publisher — no token needed if configured)
76+
uses: pypa/gh-action-pypi-publish@release/v1
77+
with:
78+
skip-existing: true
79+
env:
80+
TWINE_PASSWORD: ${{ secrets.PYPI_TOKEN }}

0 commit comments

Comments
 (0)