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