Skip to content

Commit b72862d

Browse files
authored
chore(build): simplify build python 3 jobs (#14278)
## Checklist - [x] PR author has checked that all the criteria below are met - The PR description includes an overview of the change - The PR description articulates the motivation for the change - The change includes tests OR the PR description describes a testing strategy - The PR description notes risks associated with the change, if any - Newly-added code is easy to change - The change follows the [library release note guidelines](https://ddtrace.readthedocs.io/en/stable/releasenotes.html) - The change includes or references documentation updates if necessary - Backport labels are set (if [applicable](https://ddtrace.readthedocs.io/en/latest/contributing.html#backporting)) ## Reviewer Checklist - [x] Reviewer has checked that all the criteria below are met - Title is accurate - All changes are related to the pull request's stated goal - Avoids breaking [API](https://ddtrace.readthedocs.io/en/stable/versioning.html#interfaces) changes - Testing strategy adequately addresses listed risks - Newly-added code is easy to change - Release note makes sense to a user of the library - If necessary, author has acknowledged and discussed the performance implications of this PR as reported in the benchmarks PR comment - Backport labels are set in a manner that is consistent with the [release branch maintenance policy](https://ddtrace.readthedocs.io/en/latest/contributing.html#backporting)
1 parent 70df147 commit b72862d

File tree

1 file changed

+37
-77
lines changed

1 file changed

+37
-77
lines changed

.github/workflows/build_python_3.yml

Lines changed: 37 additions & 77 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,8 @@ jobs:
2424
persist-credentials: false
2525
- uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5.6.0
2626
with:
27-
python-version: '3.8'
28-
- run: pip install cibuildwheel==2.22.0
27+
python-version: "3.13"
28+
- run: pip install cibuildwheel==2.23.3
2929
- id: set-matrix
3030
env:
3131
CIBW_BUILD: ${{ inputs.cibw_build }}
@@ -50,102 +50,62 @@ jobs:
5050
fail-fast: false
5151
matrix:
5252
include: ${{ fromJson(needs.build-wheels-matrix.outputs.include) }}
53+
env:
54+
CIBW_SKIP: ${{ inputs.cibw_skip }}
55+
CIBW_PRERELEASE_PYTHONS: ${{ inputs.cibw_prerelease_pythons }}
56+
CIBW_MUSLLINUX_I686_IMAGE: ghcr.io/datadog/dd-trace-py/pypa_musllinux_1_2_i686:latest
57+
CIBW_BEFORE_ALL_WINDOWS: rustup target add i686-pc-windows-msvc
58+
CIBW_BEFORE_ALL_MACOS: rustup target add aarch64-apple-darwin
59+
CIBW_BEFORE_ALL_LINUX: |
60+
if [[ "$(uname -m)-$(uname -i)-$(uname -o | tr '[:upper:]' '[:lower:]')-$(ldd --version 2>&1 | head -n 1 | awk '{print $1}')" != "i686-unknown-linux-musl" ]]; then
61+
if command -v yum &> /dev/null; then
62+
yum install -y libatomic.i686
63+
fi
64+
curl -sSf https://sh.rustup.rs | sh -s -- -y;
65+
fi
66+
CIBW_ENVIRONMENT_LINUX: PATH=$HOME/.cargo/bin:$PATH CMAKE_BUILD_PARALLEL_LEVEL=24 CMAKE_ARGS="-DNATIVE_TESTING=OFF"
67+
# SYSTEM_VERSION_COMPAT is a workaround for versioning issue, a.k.a.
68+
# `platform.mac_ver()` reports incorrect MacOS version at 11.0
69+
# See: https://stackoverflow.com/a/65402241
70+
CIBW_ENVIRONMENT_MACOS: CMAKE_BUILD_PARALLEL_LEVEL=24 SYSTEM_VERSION_COMPAT=0 CMAKE_ARGS="-DNATIVE_TESTING=OFF"
71+
CIBW_REPAIR_WHEEL_COMMAND_LINUX: |
72+
mkdir ./tempwheelhouse &&
73+
unzip -l {wheel} | grep '\.so' &&
74+
auditwheel repair -w ./tempwheelhouse {wheel} &&
75+
for w in ./tempwheelhouse/*.whl; do
76+
python scripts/zip_filter.py $w \*.c \*.cpp \*.cc \*.h \*.hpp \*.pyx \*.md
77+
mv $w {dest_dir}
78+
done &&
79+
rm -rf ./tempwheelhouse
80+
CIBW_REPAIR_WHEEL_COMMAND_MACOS: |
81+
zip -d {wheel} \*.c \*.cpp \*.cc \*.h \*.hpp \*.pyx \*.md &&
82+
MACOSX_DEPLOYMENT_TARGET=12.7 delocate-wheel --require-archs {delocate_archs} -w {dest_dir} -v {wheel}
83+
CIBW_REPAIR_WHEEL_COMMAND_WINDOWS: choco install -y 7zip &&
84+
7z d -r "{wheel}" *.c *.cpp *.cc *.h *.hpp *.pyx *.md &&
85+
move "{wheel}" "{dest_dir}"
86+
CIBW_TEST_COMMAND: "python {project}/tests/smoke_test.py"
5387

5488
steps:
5589
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
56-
# Include all history and tags
5790
with:
5891
persist-credentials: false
5992
fetch-depth: 0
6093

6194
- uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5.6.0
62-
if: matrix.os != 'ubuntu-24.04-arm'
6395
name: Install Python
6496
with:
65-
python-version: '3.8'
97+
python-version: "3.13"
6698

6799
- name: Set up QEMU
68100
if: runner.os == 'Linux' && matrix.os != 'ubuntu-24.04-arm'
69101
uses: docker/setup-qemu-action@29109295f81e9208d7d86ff1c6c12d2833863392 # v3.6.0
70102
with:
71103
platforms: all
72104

73-
- name: Build wheels arm64
74-
if: always() && matrix.os == 'ubuntu-24.04-arm'
75-
run: pipx run cibuildwheel==2.22.0 --only ${{ matrix.only }}
76-
env:
77-
CIBW_SKIP: ${{ inputs.cibw_skip }}
78-
CIBW_PRERELEASE_PYTHONS: ${{ inputs.cibw_prerelease_pythons }}
79-
CIBW_MUSLLINUX_I686_IMAGE: ghcr.io/datadog/dd-trace-py/pypa_musllinux_1_2_i686:latest
80-
CIBW_BEFORE_ALL: >
81-
if [[ "$(uname -m)-$(uname -i)-$(uname -o | tr '[:upper:]' '[:lower:]')-$(ldd --version 2>&1 | head -n 1 | awk '{print $1}')" != "i686-unknown-linux-musl" ]];
82-
then
83-
curl -sSf https://sh.rustup.rs | sh -s -- -y;
84-
fi
85-
CIBW_BEFORE_ALL_WINDOWS: rustup target add i686-pc-windows-msvc
86-
CIBW_BEFORE_ALL_MACOS: rustup target add aarch64-apple-darwin
87-
CIBW_ENVIRONMENT_LINUX: PATH=$HOME/.cargo/bin:$PATH CMAKE_BUILD_PARALLEL_LEVEL=24 CMAKE_ARGS="-DNATIVE_TESTING=OFF"
88-
CIBW_REPAIR_WHEEL_COMMAND_LINUX: |
89-
mkdir ./tempwheelhouse &&
90-
unzip -l {wheel} | grep '\.so' &&
91-
auditwheel repair -w ./tempwheelhouse {wheel} &&
92-
for w in ./tempwheelhouse/*.whl; do
93-
python scripts/zip_filter.py $w \*.c \*.cpp \*.cc \*.h \*.hpp \*.pyx \*.md
94-
mv $w {dest_dir}
95-
done &&
96-
rm -rf ./tempwheelhouse
97-
CIBW_REPAIR_WHEEL_COMMAND_MACOS: |
98-
zip -d {wheel} \*.c \*.cpp \*.cc \*.h \*.hpp \*.pyx \*.md &&
99-
MACOSX_DEPLOYMENT_TARGET=12.7 delocate-wheel --require-archs {delocate_archs} -w {dest_dir} -v {wheel}
100-
CIBW_REPAIR_WHEEL_COMMAND_WINDOWS:
101-
choco install -y 7zip &&
102-
7z d -r "{wheel}" *.c *.cpp *.cc *.h *.hpp *.pyx *.md &&
103-
move "{wheel}" "{dest_dir}"
104-
CIBW_TEST_COMMAND: "python {project}/tests/smoke_test.py"
105-
# DEV: Uncomment to debug MacOS
106-
# CIBW_BUILD_VERBOSITY_MACOS: 3
107-
108105
- name: Build wheels
109-
if: always() && matrix.os != 'ubuntu-24.04-arm'
110106
uses: pypa/cibuildwheel@faf86a6ed7efa889faf6996aa23820831055001a # v2.23.3
111107
with:
112108
only: ${{ matrix.only }}
113-
env:
114-
CIBW_SKIP: ${{ inputs.cibw_skip }}
115-
CIBW_PRERELEASE_PYTHONS: ${{ inputs.cibw_prerelease_pythons }}
116-
CIBW_MUSLLINUX_I686_IMAGE: ghcr.io/datadog/dd-trace-py/pypa_musllinux_1_2_i686:latest
117-
CIBW_BEFORE_ALL: >
118-
if [[ "$(uname -m)-$(uname -i)-$(uname -o | tr '[:upper:]' '[:lower:]')-$(ldd --version 2>&1 | head -n 1 | awk '{print $1}')" != "i686-unknown-linux-musl" ]];
119-
then
120-
yum install -y libatomic.i686
121-
curl -sSf https://sh.rustup.rs | sh -s -- -y;
122-
fi
123-
CIBW_BEFORE_ALL_WINDOWS: rustup target add i686-pc-windows-msvc
124-
CIBW_BEFORE_ALL_MACOS: rustup target add aarch64-apple-darwin
125-
CIBW_ENVIRONMENT_LINUX: PATH=$HOME/.cargo/bin:$PATH CMAKE_BUILD_PARALLEL_LEVEL=24 CMAKE_ARGS="-DNATIVE_TESTING=OFF"
126-
# SYSTEM_VERSION_COMPAT is a workaround for versioning issue, a.k.a.
127-
# `platform.mac_ver()` reports incorrect MacOS version at 11.0
128-
# See: https://stackoverflow.com/a/65402241
129-
CIBW_ENVIRONMENT_MACOS: CMAKE_BUILD_PARALLEL_LEVEL=24 SYSTEM_VERSION_COMPAT=0 CMAKE_ARGS="-DNATIVE_TESTING=OFF"
130-
CIBW_REPAIR_WHEEL_COMMAND_LINUX: |
131-
mkdir ./tempwheelhouse &&
132-
unzip -l {wheel} | grep '\.so' &&
133-
auditwheel repair -w ./tempwheelhouse {wheel} &&
134-
for w in ./tempwheelhouse/*.whl; do
135-
python scripts/zip_filter.py $w \*.c \*.cpp \*.cc \*.h \*.hpp \*.pyx \*.md
136-
mv $w {dest_dir}
137-
done &&
138-
rm -rf ./tempwheelhouse
139-
CIBW_REPAIR_WHEEL_COMMAND_MACOS: |
140-
zip -d {wheel} \*.c \*.cpp \*.cc \*.h \*.hpp \*.pyx \*.md &&
141-
MACOSX_DEPLOYMENT_TARGET=12.7 delocate-wheel --require-archs {delocate_archs} -w {dest_dir} -v {wheel}
142-
CIBW_REPAIR_WHEEL_COMMAND_WINDOWS:
143-
choco install -y 7zip &&
144-
7z d -r "{wheel}" *.c *.cpp *.cc *.h *.hpp *.pyx *.md &&
145-
move "{wheel}" "{dest_dir}"
146-
CIBW_TEST_COMMAND: "python {project}/tests/smoke_test.py"
147-
# DEV: Uncomment to debug MacOS
148-
# CIBW_BUILD_VERBOSITY_MACOS: 3
149109

150110
- if: runner.os != 'Windows'
151111
run: |

0 commit comments

Comments
 (0)