Debian Codegraph @

.github/workflows/build_dist.yml

raw symbols SCIP
1 name: Build
2
3 # on: [push, pull_request, release]
4
5 on:
6 push:
7 branches:
8 release:
9 types: [created]
10 pull_request:
11
12 concurrency:
13 group: ${{ github.workflow }}-${{ github.ref }}
14 cancel-in-progress: true
15
16 jobs:
17 sdist:
18 name: Build source distribution
19 runs-on: ubuntu-latest
20 steps:
21 - name: Check out repository
22 uses: actions/checkout@v5
23 with:
24 fetch-depth: 0 # To ensure tags are retrieved to enable setuptools_scm to work
25 - name: Install Python 3.x
26 uses: actions/setup-python@v6
27 with:
28 python-version: 3.x
29 - name: Build sdist
30 run: pipx run build --sdist
31 - name: Save sdist
32 uses: actions/upload-artifact@v4
33 with:
34 name: cibw-sdist.tar.gz
35 path: dist/*.tar.gz
36
37 wheels:
38 name: Build wheels on ${{ matrix.os }} CIBW_BUILD=${{ matrix.cibw_build }}
39 runs-on: ${{ matrix.os }}
40 strategy:
41 # since multiple builds run at the same time, cancelling them all when one
42 # fails is wasteful and forces handling build problems one by one instead
43 # of showing a "full picture"
44 fail-fast: false
45 matrix:
46 os:
47 - ubuntu-latest
48 - macos-15-intel # x86
49 - macos-latest # arm
50 - windows-latest
51 cibw_build: [cp39-*, cp310-*, cp311-*, cp312-*, cp313-*, cp313t-*, cp314-*]
52 steps:
53 - name: Check out repository
54 uses: actions/checkout@v5
55 with:
56 fetch-depth: 0 # To ensure tags are retrieved to enable setuptools_scm to work
57 - name: Install Python 3.x
58 uses: actions/setup-python@v6
59 with:
60 python-version: 3.x
61 - name: Set up QEMU # Needed to build aarch64 wheels
62 if: runner.os == 'Linux'
63 uses: docker/setup-qemu-action@v3
64 with:
65 platforms: all
66
67 - name: Setup free-threading variables
68 if: ${{ endsWith(matrix.cibw_build, 't-*') }}
69 shell: bash -l {0}
70 run: |
71 echo "CIBW_BEFORE_TEST=pip install pytest pytest-run-parallel" >> "$GITHUB_ENV"
72 echo "CIBW_ENVIRONMENT=PYLZ4_USE_SYSTEM_LZ4=False PYTEST_ADDOPTS=--parallel-threads=4" >> "$GITHUB_ENV"
73 echo "CIBW_TEST_COMMAND=tox -x testenv.deps+=pytest-run-parallel -x testenv.pass_env+=PYTEST_ADDOPTS -c {project}" >> "$GITHUB_ENV"
74 - name: Setup environment
75 if: ${{ !endsWith(matrix.cibw_build, 't-*') }}
76 shell: bash -l {0}
77 run: |
78 echo "CIBW_ENVIRONMENT=PYLZ4_USE_SYSTEM_LZ4=False" >> "$GITHUB_ENV"
79 echo "CIBW_TEST_COMMAND=tox -c {project}" >> "$GITHUB_ENV"
80 - name: Build wheels
81 uses: pypa/[email protected]
82 env:
83 # CIBW_ARCHS_LINUX: "x86_64 i686 aarch64"
84 CIBW_ARCHS_LINUX: "x86_64 i686"
85 CIBW_ARCHS_MACOS: "auto64" # since we have both runner arches
86 CIBW_ARCHS_WINDOWS: "AMD64 x86 ARM64"
87 CIBW_ENABLE: cpython-freethreading
88 CIBW_BUILD: ${{ matrix.cibw_build }}
89 CIBW_SKIP: "cp*-musllinux*"
90 CIBW_TEST_SKIP: "*-macosx_arm64 *-macosx_universal2:arm64 *-*linux_{ppc64le,s390x} *-win_arm64"
91 CIBW_BEFORE_BUILD: "python -m pip install -U pip && python -m pip install tox"
92 - name: Save wheels
93 uses: actions/upload-artifact@v4
94 with:
95 name: cibw-wheels-${{ matrix.os }}-${{ strategy.job-index }}
96 path: ./wheelhouse/*.whl
97
98 wheels_linux_arm:
99 name: Build wheels on ${{ matrix.os }} CIBW_BUILD=${{ matrix.cibw_build }}
100 runs-on: ${{ matrix.os }}
101 strategy:
102 # since multiple builds run at the same time, cancelling them all when one
103 # fails is wasteful and forces handling build problems one by one instead
104 # of showing a "full picture"
105 fail-fast: false
106 matrix:
107 os:
108 - ubuntu-24.04-arm
109 cibw_build: [cp39-*, cp310-*, cp311-*, cp312-*, cp313-*, cp313t-*, cp314-*]
110 steps:
111 - name: Check out repository
112 uses: actions/checkout@v5
113 with:
114 fetch-depth: 0 # To ensure tags are retrieved to enable setuptools_scm to work
115 - name: Install Python 3.x
116 uses: actions/setup-python@v6
117 with:
118 python-version: 3.x
119 - name: Setup free-threading variables
120 if: ${{ endsWith(matrix.cibw_build, 't-*') }}
121 shell: bash -l {0}
122 run: |
123 # Variables are set in order to be passed down to both cibuildwheel and the
124 # Docker image spawned by that action
125 echo "CIBW_BEFORE_TEST=pip install pytest pytest-run-parallel" >> "$GITHUB_ENV"
126 echo "CIBW_ENVIRONMENT=PYLZ4_USE_SYSTEM_LZ4=False PYTEST_ADDOPTS=--parallel-threads=1" >> "$GITHUB_ENV"
127 echo "CIBW_TEST_COMMAND=tox -x testenv.deps+=pytest-run-parallel -x testenv.pass_env+=PYTEST_ADDOPTS -c {project}" >> "$GITHUB_ENV"
128 - name: Setup environment
129 if: ${{ !endsWith(matrix.cibw_build, 't-*') }}
130 shell: bash -l {0}
131 run: |
132 echo "CIBW_ENVIRONMENT=PYLZ4_USE_SYSTEM_LZ4=False" >> "$GITHUB_ENV"
133 echo "CIBW_TEST_COMMAND=tox -c {project}" >> "$GITHUB_ENV"
134 - name: Build wheels
135 uses: pypa/[email protected]
136 env:
137 CIBW_ARCHS_LINUX: "aarch64"
138 CIBW_BUILD: ${{ matrix.cibw_build }}
139 CIBW_SKIP: "cp*-musllinux*"
140 CIBW_ENABLE: cpython-freethreading
141 CIBW_BEFORE_BUILD: "python -m pip install -U pip && python -m pip install tox"
142 - name: Save wheels
143 uses: actions/upload-artifact@v4
144 with:
145 name: cibw-wheels-${{ matrix.os }}-${{ strategy.job-index }}
146 path: ./wheelhouse/*.whl
147
148 upload_pypi:
149 name: Upload to PyPI
150 needs: [sdist, wheels, wheels_linux_arm]
151 runs-on: ubuntu-latest
152 if: startsWith(github.ref, 'refs/tags/')
153 steps:
154 - uses: actions/download-artifact@v5
155 with:
156 pattern: cibw-*
157 path: dist
158 merge-multiple: true
159 - uses: pypa/gh-action-pypi-publish@release/v1
160 with:
161 password: ${{ secrets.PYPI_API_TOKEN }}
162 skip-existing: true