Debian Codegraph @

.github/workflows/release-python.yml

raw
1 ---
2 name: Python Release
3
4 on:
5 release:
6 types: [created]
7
8 jobs:
9 build_sdist:
10 name: Build source packages
11 runs-on: ubuntu-latest
12 container: fedora:latest
13 steps:
14 - uses: actions/checkout@v4
15
16 - name: Install dependencies
17 run: |
18 sudo dnf -y install dnf-plugins-core
19 sudo dnf -y builddep createrepo_c.spec
20 sudo dnf -y install twine pytest
21 pip install --upgrade pip
22 pip install scikit-build
23
24 - name: Build Python sdist
25 run: python3 setup.py sdist
26
27 - name: Install and Test Python source package
28 run: |
29 pip install dist/*.tar.gz
30 pytest --verbose --color=yes tests/python/tests/
31
32 - uses: actions/upload-artifact@v4
33 with:
34 path: dist/*.tar.gz
35
36 build_bdist:
37 name: Build binary wheels
38 runs-on: ubuntu-latest
39 strategy:
40 matrix:
41 include:
42 - arch: auto64 # native 64-bit
43 - arch: aarch64
44 # TODO: when github actions gets native aarch64 runners, ditch qemu, it will be much faster
45
46 steps:
47 - uses: actions/checkout@v4
48
49 # setup Python for cibuildwheel
50 - name: Set up Python
51 uses: actions/setup-python@v4
52 with:
53 python-version: '3.x'
54
55 - name: Set up QEMU
56 if: runner.os == 'Linux' && ${{ matrix.arch }} == "aarch64"
57 uses: docker/setup-qemu-action@v3
58 with:
59 platforms: arm64
60
61 - name: Build wheels for CPython
62 uses: pypa/[email protected]
63 env:
64 CIBW_ARCHS: ${{ matrix.arch }}
65 CIBW_SKIP: "pp* *-musllinux_* cp36* cp37* cp38*" # no PyPy or musl builds, no older Python versions
66 CIBW_MANYLINUX_X86_64_IMAGE: manylinux_2_28 # alma 8
67 CIBW_MANYLINUX_AARCH64_IMAGE: manylinux_2_28
68 CIBW_BEFORE_ALL_LINUX: dnf -y install epel-release && yes | dnf -y builddep createrepo_c.spec
69 CIBW_BEFORE_BUILD: python -m pip install scikit-build
70 CIBW_TEST_REQUIRES: pytest
71 CIBW_TEST_COMMAND: |
72 pytest --verbose --color=yes {project}/tests/python/tests/
73
74 - uses: actions/upload-artifact@v4
75 with:
76 path: ./wheelhouse/*.whl
77
78
79 upload_pypi:
80 name: Publish packages to PyPI
81 # only publish packages once everything is successful
82 needs: [build_bdist, build_sdist]
83 runs-on: ubuntu-latest
84 steps:
85 - uses: actions/download-artifact@v4
86 with:
87 name: artifact
88 path: dist
89
90 - uses: pypa/[email protected]
91 with:
92 user: __token__
93 password: ${{secrets.PYPI_API_TOKEN}}
94 # To test: repository_url: https://test.pypi.org/legacy/