Skip to content

Commit 4411849

Browse files
brettlangdonnizoxmergify[bot]
authored
ci: test library installation (#2736) (#2757)
* Test library install Install and load the library on every supported platform during the build process. * Skip universal2 test on arm * Test on Alpine Linux * Fix YAML quirk * Install Alpine build dependencies * Use a dedicated step for smoke testing * Check source package with twine Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com> Co-authored-by: Nicolas Vivet <[email protected]> Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
1 parent d2a0852 commit 4411849

File tree

4 files changed

+54
-58
lines changed

4 files changed

+54
-58
lines changed

.circleci/config.yml

Lines changed: 0 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ version: 2.1
22

33
default_resource_class: &default_resource_class medium
44
cimg_base_image: &cimg_base_image cimg/base:stable
5-
python39-alpine_image: &python39-alpine_image python:3.9-alpine
65
python39_image: &python39_image cimg/python:3.9
76
ddtrace_dev_image: &ddtrace_dev_image datadog/dd-trace-py:buster
87
datadog_agent_image: &datadog_agent_image datadog/agent:latest
@@ -218,14 +217,6 @@ commands:
218217
- store_artifacts:
219218
path: test-results
220219

221-
test_build:
222-
description: "Build the package extensions and wheel to validate builds work"
223-
steps:
224-
- checkout
225-
- run:
226-
name: Run test build
227-
command: .circleci/scripts/test_build.sh
228-
229220
build_docs:
230221
steps:
231222
- setup_riot
@@ -239,10 +230,6 @@ executors:
239230
docker:
240231
- image: *cimg_base_image
241232
resource_class: small
242-
python39-alpine:
243-
docker:
244-
- image: *python39-alpine_image
245-
resource_class: small
246233
python39:
247234
docker:
248235
- image: *python39_image
@@ -368,15 +355,6 @@ jobs:
368355
paths:
369356
- "."
370357

371-
372-
# alpine is the only environment not built/tested by cibuildwheel
373-
test_build_alpine:
374-
executor: python39-alpine
375-
steps:
376-
# Rust + Cargo are needed for Cryptography
377-
- run: apk add git gcc musl-dev libffi-dev openssl-dev bash rust cargo
378-
- test_build
379-
380358
tracer:
381359
<<: *contrib_job
382360
steps:
@@ -998,9 +976,6 @@ workflows:
998976
# Build necessary base venvs for integration tests
999977
- build_base_venvs: *requires_pre_check
1000978

1001-
# Test building the package
1002-
- test_build_alpine: *requires_pre_check
1003-
1004979
# Integration test suites
1005980
- aiobotocore: *requires_base_venvs
1006981
- aiohttp: *requires_base_venvs

.circleci/scripts/test_build.sh

Lines changed: 0 additions & 28 deletions
This file was deleted.

.github/workflows/build_deploy.yml

Lines changed: 47 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,19 @@ on:
1616

1717
jobs:
1818
build_wheels:
19-
name: Build wheels on ${{ matrix.os }}
19+
name: Build and test wheels on ${{ matrix.os }} (${{ matrix.archs }})
2020
runs-on: ${{ matrix.os }}
2121
strategy:
2222
matrix:
23-
os: [ubuntu-18.04, windows-latest, macos-latest]
23+
include:
24+
- os: ubuntu-18.04
25+
archs: x86_64 i686
26+
- os: ubuntu-18.04
27+
archs: aarch64
28+
- os: windows-latest
29+
archs: AMD64 x86
30+
- os: macos-latest
31+
archs: x86_64 universal2
2432
steps:
2533
- uses: actions/checkout@v2
2634
# Include all history and tags
@@ -43,11 +51,14 @@ jobs:
4351
env:
4452
# configure cibuildwheel to build native archs ('auto'), and some
4553
# emulated ones
46-
CIBW_ARCHS_LINUX: auto aarch64
47-
CIBW_ARCHS_MACOS: x86_64 universal2
54+
CIBW_ARCHS: ${{ matrix.archs }}
4855
# PyPY is not supported
4956
# Windows 2.7 wheels no longer can be built https://github.com/DataDog/dd-trace-py/pull/2344
5057
CIBW_SKIP: pp* cp27-win*
58+
# Run a smoke test on every supported platform
59+
CIBW_TEST_COMMAND: python {project}/tests/smoke_test.py
60+
# Testing arm on MacOS is currently not supported by Github
61+
CIBW_TEST_SKIP: "*-macosx_universal2:arm64"
5162

5263
- uses: actions/upload-artifact@v2
5364
with:
@@ -76,8 +87,39 @@ jobs:
7687
with:
7788
path: dist/*.tar.gz
7889

90+
test_alpine_sdist:
91+
# alpine is the only environment not built/tested by cibuildwheel
92+
name: Test source distribution on Alpine Linux
93+
needs: [build_sdist]
94+
runs-on: ubuntu-latest
95+
container:
96+
image: python:3.9-alpine
97+
steps:
98+
- uses: actions/checkout@v2
99+
- uses: actions/download-artifact@v2
100+
with:
101+
name: artifact
102+
path: dist
103+
104+
- name: Install build dependencies
105+
# Rust + Cargo are needed for Cryptography
106+
run: apk add git gcc musl-dev libffi-dev openssl-dev bash rust cargo
107+
108+
- name: Check source package
109+
run: |
110+
pip install twine readme_renderer[md]
111+
twine check dist/*.tar.gz
112+
113+
- name: Install source package
114+
run: pip install dist/*.tar.gz
115+
116+
- name: Test the source package
117+
run: python $GITHUB_WORKSPACE/tests/smoke_test.py
118+
# Move out of the workspace to avoid importing ddtrace from the source
119+
working-directory: /
120+
79121
upload_pypi:
80-
needs: [build_wheels, build_sdist]
122+
needs: [build_wheels, test_alpine_sdist]
81123
runs-on: ubuntu-latest
82124
if: (github.event_name == 'release' && github.event.action == 'published') || (github.event.action == 'workflow_dispatch')
83125
steps:

tests/smoke_test.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
import sys
2+
3+
import ddtrace.bootstrap.sitecustomize as module
4+
5+
6+
if __name__ == "__main__":
7+
sys.exit(0 if module.loaded else 1)

0 commit comments

Comments
 (0)