@@ -23,24 +23,44 @@ permissions:
2323 contents : read
2424
2525jobs :
26- build-linux-py3 :
27- runs-on : ubuntu-24.04
26+ build-wheels :
2827 strategy :
2928 fail-fast : false
3029 matrix :
31- wheel :
32- - cp38-manylinux
33- - cp38-musllinux
34- - cp39-manylinux
35- - cp39-musllinux
36- - cp310-manylinux
37- - cp310-musllinux
38- - cp311-manylinux
39- - cp311-musllinux
40- - cp312-manylinux
41- - cp312-musllinux
42- - cp313-manylinux
43- - cp313-musllinux
30+ include :
31+ # Linux glibc
32+ - wheel : cp38-manylinux
33+ os : ubuntu-24.04
34+ - wheel : cp39-manylinux
35+ os : ubuntu-24.04
36+ - wheel : cp310-manylinux
37+ os : ubuntu-24.04
38+ - wheel : cp311-manylinux
39+ os : ubuntu-24.04
40+ - wheel : cp312-manylinux
41+ os : ubuntu-24.04
42+ - wheel : cp313-manylinux
43+ os : ubuntu-24.04
44+ # Linux musllibc
45+ - wheel : cp38-musllinux
46+ os : ubuntu-24.04
47+ - wheel : cp39-musllinux
48+ os : ubuntu-24.04
49+ - wheel : cp310-musllinux
50+ os : ubuntu-24.04
51+ - wheel : cp311-musllinux
52+ os : ubuntu-24.04
53+ - wheel : cp312-musllinux
54+ os : ubuntu-24.04
55+ - wheel : cp313-musllinux
56+ os : ubuntu-24.04
57+ # Windows
58+ # Windows wheels won't but published until the full release announcement.
59+ # - wheel: cp313-win
60+ # os: windows-2025
61+
62+ name : Build wheels for ${{ matrix.wheel }}
63+ runs-on : ${{ matrix.os }}
4464
4565 steps :
4666 - uses : actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # 5.0.0
@@ -49,17 +69,26 @@ jobs:
4969 fetch-depth : 0
5070
5171 - name : Setup QEMU
72+ if : runner.os == 'Linux'
5273 uses : docker/setup-qemu-action@29109295f81e9208d7d86ff1c6c12d2833863392 # 3.6.0
74+ with :
75+ platforms : arm64
5376
5477 - name : Build Wheels
5578 uses : pypa/cibuildwheel@faf86a6ed7efa889faf6996aa23820831055001a # 2.23.3
5679 env :
57- CIBW_PLATFORM : linux
80+ CIBW_PLATFORM : auto
5881 CIBW_BUILD : " ${{ matrix.wheel }}*"
5982 CIBW_ARCHS_LINUX : x86_64 aarch64
60- CIBW_ENVIRONMENT : " LD_LIBRARY_PATH=/opt/rh/devtoolset-8/root/usr/lib64:/opt/rh/devtoolset-8/root/usr/lib:/opt/rh/devtoolset-8/root/usr/lib64/dyninst:/opt/rh/devtoolset-8/root/usr/lib/dyninst:/usr/local/lib64:/usr/local/lib"
83+ CIBW_ARCHS_MACOS : native
84+ CIBW_ARCHS_WINDOWS : AMD64 ARM64
85+ CIBW_ENVIRONMENT_LINUX : " LD_LIBRARY_PATH=/opt/rh/devtoolset-8/root/usr/lib64:/opt/rh/devtoolset-8/root/usr/lib:/opt/rh/devtoolset-8/root/usr/lib64/dyninst:/opt/rh/devtoolset-8/root/usr/lib/dyninst:/usr/local/lib64:/usr/local/lib"
6186 CIBW_TEST_REQUIRES : pytest
62- CIBW_TEST_COMMAND : " PYTHONPATH={project}/tests pytest {project}/tests/agent_unittests -vx"
87+ CIBW_TEST_COMMAND_LINUX : " export PYTHONPATH={project}/tests; pytest {project}/tests/agent_unittests -vx"
88+ CIBW_TEST_COMMAND_MACOS : " export PYTHONPATH={project}/tests; pytest {project}/tests/agent_unittests -vx"
89+ CIBW_TEST_COMMAND_WINDOWS : " set PYTHONPATH={project}/tests; pytest {project}/tests/agent_unittests -vx"
90+ # Windows ARM64 tests won't run when using cross compilation. Skip unless we can move to a native windows-arm runner.
91+ CIBW_TEST_SKIP : " *-win_arm64"
6392
6493 - name : Upload Artifacts
6594 uses : actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # 4.6.2
7099 retention-days : 1
71100
72101 build-sdist :
102+ name : Build sdist
73103 runs-on : ubuntu-24.04
104+
74105 steps :
75106 - uses : actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # 5.0.0
76107 with :
79110
80111 - uses : actions/setup-python@e797f83bcb11b83ae66e0230d6156d7c80228e7c # 6.0.0
81112 with :
82- python-version : " 3.12 "
113+ python-version : " 3.13 "
83114
84115 - name : Install Dependencies
85116 run : |
@@ -107,24 +138,35 @@ jobs:
107138 retention-days : 1
108139
109140 publish :
141+ name : Publish
110142 runs-on : ubuntu-24.04
111- environment : pypi
112143 permissions :
113144 contents : read
114145 id-token : write # IMPORTANT: this permission is mandatory for trusted publishing
115146 attestations : write
116-
117147 needs :
118- - build-linux-py3
148+ - build-wheels
119149 - build-sdist
120150
151+ strategy :
152+ matrix :
153+ pypi-instance :
154+ - pypi
155+ # Valid values for deployment are:
156+ # - "pypi" for production
157+ # - "testpypi" for testing
158+ # - "build-only" to skip publishing and only test builds.
159+
160+ environment : ${{ matrix.pypi-instance }}
161+
121162 steps :
122163 - uses : actions/download-artifact@634f93cb2916e3fdff6788551b99b062d0335ce0 # 5.0.0
123164 with :
124165 path : ./dist/
125166 merge-multiple : true
126167
127168 - name : Upload Package to S3
169+ if : matrix.pypi-instance == 'pypi'
128170 run : |
129171 tarball="$(basename ./dist/*.tar.gz)"
130172 md5_file="${tarball}.md5"
@@ -137,9 +179,16 @@ jobs:
137179 AWS_SECRET_ACCESS_KEY : ${{ secrets.AWS_SECRET_ACCESS_KEY }}
138180 AWS_DEFAULT_REGION : us-west-2
139181
140- - name : Upload Package
182+ - name : Upload Package to PyPI
183+ if : matrix.pypi-instance == 'pypi'
141184 uses : pypa/gh-action-pypi-publish@ed0c53931b1dc9bd32cbe73a98c7f6766f8a527e # 1.13.0
142185
186+ - name : Upload Package to TestPyPI
187+ if : matrix.pypi-instance == 'testpypi'
188+ uses : pypa/gh-action-pypi-publish@ed0c53931b1dc9bd32cbe73a98c7f6766f8a527e # 1.13.0
189+ with :
190+ repository-url : https://test.pypi.org/legacy/
191+
143192 - name : Attest
144193 uses : actions/attest-build-provenance@977bb373ede98d70efdf65b84cb5f73e068dcc2a # 3.0.0
145194 id : attest
@@ -149,11 +198,13 @@ jobs:
149198 ./dist/*.tar.gz
150199
151200 - name : Wait for release to be available
201+ if : matrix.pypi-instance == 'pypi'
152202 id : wait
153203 run : |
154204 sleep 60
155205
156206 - name : Create release tags for Lambda and K8s Init Containers
207+ if : matrix.pypi-instance == 'pypi'
157208 run : |
158209 RELEASE_TITLE="New Relic Python Agent ${GITHUB_REF_NAME}.0"
159210 RELEASE_TAG="${GITHUB_REF_NAME}.0_python"
0 commit comments