-
Notifications
You must be signed in to change notification settings - Fork 3
148 lines (126 loc) · 4.58 KB
/
Copy pathpython-publish.yaml
File metadata and controls
148 lines (126 loc) · 4.58 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
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
name: Upload Python Package
on:
release:
types: [published]
permissions:
contents: read
jobs:
build_wheels:
name: Build wheels on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-22.04, ubuntu-22.04-arm, macos-14]
steps:
- uses: actions/checkout@v6
with:
fetch-depth: 0
- name: Select newer Xcode (macOS)
if: runner.os == 'macOS'
uses: maxim-lobanov/setup-xcode@v1
with:
xcode-version: "16.2"
- name: Prepare ccache dir
run: mkdir -p "${{ github.workspace }}/.ccache"
- name: Restore ccache
uses: actions/cache/restore@v5
with:
path: .ccache
key: ccache-wheel-v2-${{ matrix.os }}-${{ github.run_id }}
restore-keys: |
ccache-wheel-v2-${{ matrix.os }}-
- name: Cache CPM dependency sources
uses: actions/cache@v5
with:
path: .cpmsource
key: cpmsource-full-v1-${{ hashFiles('cmake/modules/Dependencies.cmake') }}
restore-keys: |
cpmsource-full-v1-
# Build the web UI on the host (needs Node) so cibuildwheel's CMake embed
# step bakes the real page into dftracer_server instead of a placeholder.
- uses: actions/setup-node@v4
with:
node-version: "20"
cache: npm
cache-dependency-path: web/package-lock.json
- name: Build web UI
working-directory: web
run: |
npm ci
npm run build
- name: Build wheels
uses: pypa/cibuildwheel@v3.3.0
env:
CIBW_BUILD: cp38-* cp39-* cp310-* cp311-* cp312-* cp313-* cp314-*
CIBW_SKIP: "*-win32 *-manylinux_i686 *-musllinux_* *-manylinux_ppc64le *-manylinux_s390x"
CIBW_CONFIG_SETTINGS: "cmake.define.DFTRACER_UTILS_LOCAL_PACKAGES=OFF"
CIBW_BEFORE_ALL_LINUX: "yum install -y epel-release ccache || dnf install -y epel-release ccache || true"
CIBW_BEFORE_ALL_MACOS: "brew install ccache || true"
CIBW_CONTAINER_ENGINE: "docker; create_args: --volume=${{ github.workspace }}/.ccache:/ccache"
CIBW_ENVIRONMENT_LINUX: >-
CCACHE_DIR=/ccache CCACHE_BASEDIR=/project
CCACHE_COMPILERCHECK=content CCACHE_NOHASHDIR=true CCACHE_MAXSIZE=900M
CCACHE_SLOPPINESS=time_macros,include_file_mtime,include_file_ctime,pch_defines,system_headers,locale
CIBW_ENVIRONMENT_MACOS: >-
CCACHE_DIR=$GITHUB_WORKSPACE/.ccache CCACHE_BASEDIR=$GITHUB_WORKSPACE
CCACHE_COMPILERCHECK=content CCACHE_NOHASHDIR=true CCACHE_MAXSIZE=900M
CCACHE_SLOPPINESS=time_macros,include_file_mtime,include_file_ctime,pch_defines,system_headers,locale
- name: Check wheel payload
run: |
python3 -m venv /tmp/wheelcheck
/tmp/wheelcheck/bin/pip install --quiet pytest
/tmp/wheelcheck/bin/pytest tests/python/test_wheel_contents.py -q
- uses: actions/upload-artifact@v6.0.0
with:
name: cibw-wheels-${{ matrix.os }}-${{ strategy.job-index }}
path: ./wheelhouse/*.whl
build_sdist:
name: Build source distribution
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
with:
fetch-depth: 0
- name: Set up Python
uses: actions/setup-python@v6.1.0
with:
python-version: "3.12"
# Ship the built UI in the sdist too, so source installs embed the real
# page (sdist.include forces web/dist/index.html in).
- uses: actions/setup-node@v4
with:
node-version: "20"
cache: npm
cache-dependency-path: web/package-lock.json
- name: Build web UI
working-directory: web
run: |
npm ci
npm run build
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install build
- name: Build sdist
run: python -m build --sdist
- uses: actions/upload-artifact@v6.0.0
with:
name: cibw-sdist
path: dist/*.tar.gz
deploy:
name: Publish to PyPI
needs: [build_wheels, build_sdist]
runs-on: ubuntu-latest
if: github.event_name == 'release' && github.event.action == 'published'
steps:
- uses: actions/download-artifact@v8
with:
pattern: cibw-*
path: dist
merge-multiple: true
- name: Publish package
uses: pypa/gh-action-pypi-publish@release/v1
with:
user: __token__
password: ${{ secrets.PYPI_TOKEN }}