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 jobs:
14 lint:
15 runs-on: ubuntu-latest
16 steps:
17 - uses: actions/checkout@v4
18 - name: Install poetry
19 run: pipx install poetry
20 - uses: actions/setup-python@v5
21 with:
22 python-version: 3.x
23 cache: "poetry"
24 - name: Install Dependencies
25 run: |
26 poetry install
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@v4
36 with:
37 fetch-depth: 0
38 - uses: wagoid/[email protected]
39
40 test:
41 strategy:
42 fail-fast: false
43 matrix:
44 python-version:
45 - "3.10"
46 - "3.11"
47 - "3.12"
48 os:
49 - ubuntu-latest
50 runs-on: ${{ matrix.os }}
51 steps:
52 - uses: actions/checkout@v4
53 - name: Install poetry
54 run: pipx install poetry
55 - name: Set up Python
56 uses: actions/setup-python@v5
57 id: setup-python
58 with:
59 python-version: ${{ matrix.python-version }}
60 cache: "poetry"
61 - name: 🏗 Install dependencies
62 run: poetry install --no-interaction
63 - name: 🚀 Run pytest
64 run: poetry run pytest --cov src tests
65
66 release:
67 needs:
68 - test
69 - lint
70 - commitlint
71
72 runs-on: ubuntu-latest
73 environment: release
74 concurrency: release
75 permissions:
76 id-token: write
77 contents: write
78
79 steps:
80 - uses: actions/checkout@v4
81 with:
82 fetch-depth: 0
83 ref: ${{ github.head_ref || github.ref_name }}
84
85 # Do a dry run of PSR
86 - name: Test release
87 uses: python-semantic-release/[email protected]
88 if: github.ref_name != 'main'
89 with:
90 root_options: --noop
91
92 # On main branch: actual PSR + upload to PyPI & GitHub
93 - name: Release
94 uses: python-semantic-release/[email protected]
95 id: release
96 if: github.ref_name == 'main'
97 with:
98 github_token: ${{ secrets.GITHUB_TOKEN }}
99
100 - name: Publish package distributions to PyPI
101 uses: pypa/gh-action-pypi-publish@release/v1
102 if: steps.release.outputs.released == 'true'
103
104 - name: Publish package distributions to GitHub Releases
105 uses: python-semantic-release/upload-to-gh-release@main
106 if: steps.release.outputs.released == 'true'
107 with:
108 github_token: ${{ secrets.GITHUB_TOKEN }}