Debian Codegraph @

.github/workflows/ci.yml

raw
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 - uses: actions/setup-python@v5
19 with:
20 python-version: 3.x
21 - uses: pre-commit/[email protected]
22
23 # Make sure commit messages follow the conventional commits convention:
24 # https://www.conventionalcommits.org
25 commitlint:
26 name: Lint Commit Messages
27 runs-on: ubuntu-latest
28 steps:
29 - uses: actions/checkout@v4
30 with:
31 fetch-depth: 0
32 - uses: wagoid/[email protected]
33
34 test:
35 strategy:
36 fail-fast: false
37 matrix:
38 python-version:
39 - "3.9"
40 - "3.10"
41 - "3.11"
42 - "3.12"
43 - "3.13"
44 os:
45 - ubuntu-latest
46 - windows-latest
47 - macOS-latest
48 runs-on: ${{ matrix.os }}
49 steps:
50 - uses: actions/checkout@v4
51 - name: Set up Python
52 uses: actions/setup-python@v5
53 with:
54 python-version: ${{ matrix.python-version }}
55 - uses: snok/[email protected]
56 - name: Install Dependencies
57 run: poetry install
58 shell: bash
59 - name: Test with Pytest
60 run: poetry run pytest --cov-report=xml
61 shell: bash
62 - name: Upload coverage to Codecov
63 uses: codecov/codecov-action@v4
64 with:
65 token: ${{ secrets.CODECOV_TOKEN }}
66
67 release:
68 needs:
69 - test
70 - lint
71 - commitlint
72
73 runs-on: ubuntu-latest
74 environment: release
75 concurrency: release
76 permissions:
77 id-token: write
78 contents: write
79
80 steps:
81 - uses: actions/checkout@v4
82 with:
83 fetch-depth: 0
84 ref: ${{ github.head_ref || github.ref_name }}
85
86 # Do a dry run of PSR
87 - name: Test release
88 uses: python-semantic-release/[email protected]
89 if: github.ref_name != 'main'
90 with:
91 root_options: --noop
92
93 # On main branch: actual PSR + upload to PyPI & GitHub
94 - name: Release
95 uses: python-semantic-release/[email protected]
96 id: release
97 if: github.ref_name == 'main'
98 with:
99 github_token: ${{ secrets.GITHUB_TOKEN }}
100
101 - name: Publish package distributions to PyPI
102 uses: pypa/gh-action-pypi-publish@release/v1
103 if: steps.release.outputs.released == 'true'
104
105 - name: Publish package distributions to GitHub Releases
106 uses: python-semantic-release/upload-to-gh-release@main
107 if: steps.release.outputs.released == 'true'
108 with:
109 github_token: ${{ secrets.GITHUB_TOKEN }}