|
1 | 1 | name: CI |
| 2 | + |
2 | 3 | on: |
3 | 4 | push: |
4 | 5 | branches: [main, develop] |
5 | 6 | pull_request: |
6 | 7 | branches: [main] |
| 8 | + release: |
| 9 | + types: [published] |
7 | 10 |
|
8 | 11 | 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 | + |
9 | 23 | test: |
10 | 24 | runs-on: ubuntu-latest |
| 25 | + needs: lint |
11 | 26 | strategy: |
12 | 27 | matrix: |
13 | 28 | python-version: ["3.11", "3.12"] |
|
16 | 31 | - uses: actions/setup-python@v5 |
17 | 32 | with: |
18 | 33 | python-version: ${{ matrix.python-version }} |
| 34 | + cache: pip |
19 | 35 | - 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