Debian Codegraph @

.github/workflows/test-and-publish.yml

raw
1 name: Test & Publish
2
3 on: [push, pull_request]
4
5 permissions:
6 contents: read
7
8 jobs:
9 test:
10 runs-on: ubuntu-latest
11 strategy:
12 fail-fast: false
13 matrix:
14 python-version: ["3.10", "3.11", "3.12", "3.13", "3.14", "pypy-3.11"]
15
16 steps:
17 - uses: actions/checkout@v4
18
19 - name: Set up Python ${{ matrix.python-version }}
20 uses: actions/setup-python@v5
21 with:
22 python-version: ${{ matrix.python-version }}
23
24 - name: Update pip
25 run: python -m pip install --upgrade pip
26 - name: Build and install python-doubleratchet
27 run: pip install .
28 - name: Install test dependencies
29 run: pip install .[test,lint]
30
31 - name: Type-check using mypy
32 if: ${{ !startsWith(matrix.python-version, 'pypy') }}
33 run: mypy doubleratchet/ examples/ tests/
34 - name: Lint using pylint
35 run: pylint doubleratchet/ examples/ tests/
36 - name: Format-check using Flake8
37 run: flake8 doubleratchet/ examples/ tests/
38 - name: Test using pytest
39 run: pytest
40
41 build:
42 name: Build source distribution and wheel
43 runs-on: ubuntu-latest
44
45 steps:
46 - uses: actions/checkout@v4
47
48 - name: Install build
49 run: pip install build
50
51 - name: Build source distribution and wheel
52 run: python -m build --sdist --wheel
53
54 - uses: actions/upload-artifact@v4
55 with:
56 name: dist
57 path: |
58 dist/*.tar.gz
59 dist/*.whl
60
61 publish:
62 needs: [test, build]
63 runs-on: ubuntu-latest
64 permissions:
65 id-token: write
66 if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v')
67
68 steps:
69 - uses: actions/download-artifact@v4
70 with:
71 path: dist
72 merge-multiple: true
73
74 - name: Publish package distributions to PyPI
75 uses: pypa/gh-action-pypi-publish@release/v1