-
Notifications
You must be signed in to change notification settings - Fork 509
111 lines (101 loc) · 3.8 KB
/
build_python_3.yml
File metadata and controls
111 lines (101 loc) · 3.8 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
name: Build Python 3
on:
workflow_call:
inputs:
cibw_build:
required: true
type: string
cibw_skip:
required: false
type: string
cibw_prerelease_pythons:
required: false
type: string
jobs:
build-wheels-matrix:
runs-on: ubuntu-latest
outputs:
include: ${{steps.set-matrix.outputs.include}}
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
persist-credentials: false
ref: ${{ github.event.pull_request.head.sha || github.sha }}
- uses: ./.github/actions/setup-ci-deps
with:
python-version: "3.13"
- id: set-matrix
env:
CIBW_BUILD: ${{ inputs.cibw_build }}
CIBW_SKIP: ${{ inputs.cibw_skip }}
run: |
MATRIX_INCLUDE=$(
cibuildwheel --print-build-identifiers --platform windows --archs ARM64 | jq -cR '{only: ., os: "windows-11-arm"}' \
| jq -sc
)
echo $MATRIX_INCLUDE
echo "include=${MATRIX_INCLUDE}" >> $GITHUB_OUTPUT
build:
needs: ["build-wheels-matrix" ]
runs-on: ${{ matrix.os }}
name: Build ${{ matrix.only }}
strategy:
fail-fast: false
matrix:
include: ${{ fromJson(needs.build-wheels-matrix.outputs.include) }}
env:
CIBW_SKIP: ${{ inputs.cibw_skip }}
CIBW_PRERELEASE_PYTHONS: ${{ inputs.cibw_prerelease_pythons }}
CIBW_BEFORE_ALL_WINDOWS: "rustup target add aarch64-pc-windows-msvc"
# cibuildwheel repair will copy anything's under /output directory from the
# build container to the host machine. This is a bit hacky way, but seems
# to be the only way getting debug symbols out from the container while
# we don't mess up with RECORD file.
CIBW_REPAIR_WHEEL_COMMAND_WINDOWS: python scripts/zip_filter.py "{wheel}" "*.c" "*.cpp" "*.cc" "*.h" "*.hpp" "*.pyx" "*.md" && mv "{wheel}" "{dest_dir}"
CIBW_TEST_COMMAND: "python {project}/tests/smoke_test.py"
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
persist-credentials: false
fetch-depth: 0
ref: ${{ github.event.pull_request.head.sha || github.sha }}
- uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0
name: Install Python
with:
python-version: "3.13"
- name: Set up QEMU
if: runner.os == 'Linux' && matrix.os != 'ubuntu-24.04-arm'
uses: docker/setup-qemu-action@ce360397dd3f832beb865e1373c09c0e9f86d70a # v4.0.0
with:
platforms: all
- name: Build wheels
uses: pypa/cibuildwheel@ee02a1537ce3071a004a6b08c41e72f0fdc42d9a # v3.4.0
with:
only: ${{ matrix.only }}
- name: Validate wheel RECORD files
shell: bash
run: |
for wheel in ./wheelhouse/*.whl; do
if [ -f "$wheel" ]; then
echo "Validating $(basename $wheel)..."
python scripts/validate_wheel.py "$wheel"
fi
done
- if: runner.os != 'Windows'
run: |
echo "ARTIFACT_NAME=${{ matrix.only }}" >> $GITHUB_ENV
- if: runner.os == 'Windows'
run: |
chcp 65001 #set code page to utf-8
echo "ARTIFACT_NAME=${{ matrix.only }}" >> $env:GITHUB_ENV
- uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # v7.0.0
with:
name: wheels-${{ env.ARTIFACT_NAME }}
path: ./wheelhouse/*.whl
- uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # v7.0.0
if: runner.os != 'Windows'
with:
name: debug-symbols-${{ env.ARTIFACT_NAME }}
path: |
./debugwheelhouse/*.zip
./wheelhouse/debugwheelhouse/*.zip