-
Notifications
You must be signed in to change notification settings - Fork 413
101 lines (92 loc) · 2.93 KB
/
build_deploy.yml
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
name: Build
on:
push:
branches:
- main
- '[0-9].[0-9]*'
- '[0-9].x'
# special branches used to test this workflow
# before merging/releasing
- build_deploy*
- 'upgrade-latest-*'
pull_request:
release:
types:
- published
workflow_dispatch:
# Allow manually triggering, but do NOT upload the result
schedule:
# Nightly builds after weekdays
- cron: 0 2 * * 2-6
jobs:
build_wheels:
uses: ./.github/workflows/build_python_3.yml
with:
cibw_build: 'cp37* cp38* cp39* cp310* cp311* cp312*'
build_sdist:
name: Build source distribution
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
# Include all history and tags
with:
fetch-depth: 0
- uses: actions-rust-lang/setup-rust-toolchain@v1
- uses: actions/setup-python@v5
name: Install Python
with:
python-version: '3.7'
- name: Build sdist
run: |
pip install "setuptools_scm[toml]>=4" "cython" "cmake>=3.24.2,<3.28" "setuptools-rust"
python setup.py sdist
- uses: actions/upload-artifact@v4
with:
name: source-dist
path: dist/*.tar.gz
test_alpine_sdist:
# alpine is the only environment not built/tested by cibuildwheel
name: Test source distribution on Alpine Linux
needs: [build_sdist]
runs-on: ubuntu-latest
container:
image: python:3.9-alpine
steps:
- uses: actions/checkout@v4
- uses: actions/download-artifact@v4
with:
name: source-dist
path: dist
- name: Install build dependencies
# Rust + Cargo are needed for Cryptography
run: apk add git gcc g++ musl-dev libffi-dev openssl-dev bash rust cargo make cmake
- name: Check source package
run: |
pip install twine readme_renderer[md]
twine check dist/*.tar.gz
- name: Install source package
run: pip install dist/*.tar.gz
- name: Test the source package
run: python $GITHUB_WORKSPACE/tests/smoke_test.py
# Move out of the workspace to avoid importing ddtrace from the source
working-directory: /
upload_pypi:
needs:
- build_wheels
- test_alpine_sdist
runs-on: ubuntu-latest
if: (github.event_name == 'release' && github.event.action == 'published')
steps:
- uses: actions/download-artifact@v4
with:
path: dist
merge-multiple: true
- uses: pypa/gh-action-pypi-publish@release/v1
with:
user: __token__
password: ${{ secrets.PYPI_TOKEN }}
# To test: repository_url: https://test.pypi.org/legacy/
# Setting skip_existing will prevent the deploy from erring out early
# due to a duplicate wheel being present which will ensure that the rest
# of the wheels will be uploaded if some are uploaded manually.
skip_existing: true