Debian Codegraph @

.github/workflows/ci.yaml

raw
1 # This workflow will install Python dependencies, run tests and lint with a variety of Python versions
2 # For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions
3
4 name: Python package
5
6 on:
7 pull_request:
8 push:
9 branches:
10 - master
11 tags:
12 - "v*"
13
14 jobs:
15 test:
16 runs-on: ${{ matrix.os }}
17 strategy:
18 fail-fast: false
19 matrix:
20 python-version:
21 - '3.9'
22 - '3.10'
23 - '3.11'
24 - '3.12'
25 - '3.13'
26 - '3.14'
27 - '3.15'
28 - 'pypy-3.11'
29 os: [ubuntu-latest, windows-latest, macos-latest]
30
31 name: ${{ matrix.os }} - ${{ matrix.python-version }}
32 steps:
33 - name: Set git to not change line endings
34 run: |
35 git config --global core.autocrlf false
36 git config --global core.eol lf
37 - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
38 - name: Get history and tags for SCM versioning to work
39 run: |
40 git fetch --prune --unshallow
41 git fetch --depth=1 origin +refs/tags/*:refs/tags/*
42 - name: Set up Python ${{ matrix.python-version }}
43 uses: actions/setup-python@5fda3b95a4ea91299a34e894583c3862153e4b97 # v7.0.0
44 with:
45 python-version: ${{ matrix.python-version }}
46 allow-prereleases: true
47 - name: Install dependencies
48 run: pip install tox
49 - name: Run tox
50 # Run tox using the version of Python in `PATH`
51 run: tox -e py,coverage_report-ci
52
53 dist:
54 runs-on: ubuntu-latest
55 needs: [test]
56 name: Build Python packages
57 steps:
58 - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
59 - name: Get history and tags for SCM versioning to work
60 run: |
61 git fetch --prune --unshallow
62 git fetch --depth=1 origin +refs/tags/*:refs/tags/*
63 - uses: actions/setup-python@5fda3b95a4ea91299a34e894583c3862153e4b97 # v7.0.0
64 with:
65 python-version: "3.12"
66 - name: Install dependencies
67 run: |
68 python -m pip install --upgrade pip
69 pip install --upgrade wheel setuptools build
70 - name: Build package
71 run: python -m build -s -w -o dist/
72 - uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
73 with:
74 name: dist
75 path: dist
76
77 dist_check:
78 runs-on: ubuntu-latest
79 needs: [dist]
80 name: Twine check
81 steps:
82 - uses: actions/setup-python@5fda3b95a4ea91299a34e894583c3862153e4b97 # v7.0.0
83 with:
84 python-version: "3.12"
85 - name: Install dependencies
86 run: pip install twine
87 - uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
88 with:
89 name: dist
90 path: dist
91 - run: twine check dist/*
92
93 dist_upload:
94 runs-on: ubuntu-latest
95 if: github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags')
96 needs: [dist_check]
97 name: PyPI upload
98 environment: pypi
99 permissions:
100 id-token: write
101 steps:
102 - uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
103 with:
104 name: dist
105 path: dist
106 - name: Publish package to PyPI
107 uses: pypa/gh-action-pypi-publish@release/v1