Debian Codegraph @

.github/workflows/ci.yml

raw symbols SCIP
1 name: CI
2
3 on:
4 push:
5 branches:
6 - main
7 pull_request:
8
9 concurrency:
10 group: ${{ github.head_ref || github.run_id }}
11 cancel-in-progress: true
12
13 env:
14 POETRY_VIRTUALENVS_IN_PROJECT: "true"
15 UV_PYTHON_PREFERENCE: only-managed
16
17 jobs:
18 lint:
19 runs-on: ubuntu-latest
20 steps:
21 - uses: actions/checkout@v7
22 - name: Set up uv
23 uses: astral-sh/[email protected]
24 with:
25 enable-cache: false
26 python-version: "3.13"
27 - uses: pre-commit/[email protected]
28
29 # Make sure commit messages follow the conventional commits convention:
30 # https://www.conventionalcommits.org
31 commitlint:
32 name: Lint Commit Messages
33 runs-on: ubuntu-latest
34 steps:
35 - uses: actions/checkout@v7
36 with:
37 fetch-depth: 0
38 - uses: wagoid/commitlint-github-action@v6
39
40 test:
41 strategy:
42 fail-fast: false
43 matrix:
44 python-version:
45 - "3.11"
46 - "3.12"
47 - "3.13"
48 - "3.14"
49 os:
50 - ubuntu-latest
51 runs-on: ${{ matrix.os }}
52 continue-on-error: ${{ matrix.python-version == '3.14' }}
53 steps:
54 - uses: actions/checkout@v7
55 - name: Set up uv
56 id: setup-uv
57 uses: astral-sh/[email protected]
58 with:
59 enable-cache: true
60 python-version: ${{ matrix.python-version }}
61 - name: Install poetry
62 run: uv tool install poetry
63 - name: Cache poetry venv
64 id: cache-venv
65 uses: actions/cache@v6
66 with:
67 path: .venv
68 key: venv-v1-${{ runner.os }}-py${{ steps.setup-uv.outputs.python-version }}-${{ hashFiles('poetry.lock', 'pyproject.toml') }}
69 - name: Install Dependencies
70 if: steps.cache-venv.outputs.cache-hit != 'true'
71 run: |
72 poetry env use $(uv python find ${{ matrix.python-version }})
73 poetry install
74 - name: Test with Pytest
75 run: poetry run pytest --cov-report=xml
76 - name: Upload coverage to Codecov
77 uses: codecov/codecov-action@v7
78 with:
79 token: ${{ secrets.CODECOV_TOKEN }}
80
81 release:
82 runs-on: ubuntu-latest
83 environment: release
84
85 permissions:
86 id-token: write
87 contents: write
88
89 if: github.ref == 'refs/heads/main'
90 needs:
91 - test
92 - lint
93 - commitlint
94
95 steps:
96 - uses: actions/checkout@v7
97 with:
98 fetch-depth: 0
99
100 - name: Python Semantic Release
101 id: release
102 uses: python-semantic-release/[email protected]
103 with:
104 github_token: ${{ secrets.GITHUB_TOKEN }}
105
106 - name: Publish package to PyPI
107 uses: pypa/gh-action-pypi-publish@release/v1
108 if: steps.release.outputs.released == 'true'
109
110 - name: Publish package to GitHub Release
111 uses: python-semantic-release/[email protected]
112 if: steps.release.outputs.released == 'true'
113 with:
114 github_token: ${{ secrets.GITHUB_TOKEN }}