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.9"
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/commitlint-github-action@v6
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 runs-on: ${{ matrix.os }}
47 steps:
48 - uses: actions/checkout@v4
49 - name: Set up Python
50 uses: actions/setup-python@v5
51 with:
52 python-version: ${{ matrix.python-version }}
53 - uses: snok/install-poetry@v1
54 - name: Install Dependencies
55 shell: bash
56 run: poetry install
57 - name: Test with Pytest
58 shell: bash
59 run: poetry run pytest --cov-report=xml
60 - name: Upload coverage to Codecov
61 uses: codecov/codecov-action@v5
62 with:
63 token: ${{ secrets.CODECOV_TOKEN }}
64
65 release:
66 runs-on: ubuntu-latest
67 environment: release
68 if: github.ref == 'refs/heads/main'
69 needs:
70 - test
71 - lint
72 - commitlint
73 permissions:
74 id-token: write
75 contents: write
76
77 steps:
78 - uses: actions/checkout@v4
79 with:
80 fetch-depth: 0
81
82 # Run semantic release:
83 # - Update CHANGELOG.md
84 # - Update version in code
85 # - Create git tag
86 # - Create GitHub release
87 - name: Python Semantic Release
88 id: release
89 uses: python-semantic-release/[email protected]
90 with:
91 github_token: ${{ secrets.GITHUB_TOKEN }}
92 - name: Upload package to PyPI
93 uses: pypa/gh-action-pypi-publish@release/v1
94 if: steps.release.outputs.released == 'true'
95 - name: Upload Github Release Assets
96 uses: python-semantic-release/[email protected]
97 if: steps.release.outputs.released == 'true'
98 with:
99 github_token: ${{ secrets.GITHUB_TOKEN }}
100 tag: ${{ steps.release.outputs.tag }}