-
Notifications
You must be signed in to change notification settings - Fork 89
183 lines (152 loc) · 4.55 KB
/
deploy-cpp.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
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
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
name: Deploy C++
on:
workflow_dispatch:
inputs:
publish-pypi:
type: boolean
description: Publish to PyPI
jobs:
determine-source-date-epoch:
name: "Determine SOURCE_DATE_EPOCH"
runs-on: ubuntu-latest
outputs:
source-date-epoch: ${{ steps.log.outputs.source-date-epoch }}
steps:
- uses: actions/checkout@v4
with:
submodules: true
fetch-depth: 0
- id: log
name: Compute SOURCE_DATE_EPOCH
run: |
# Find latest unix timestamp in awkward-cpp, and the kernel generation files
epoch=$( git log -1 --format=%at -- awkward-cpp kernel-specification.yml kernel-test-data.json )
echo "source-date-epoch=$epoch" >> $GITHUB_OUTPUT
make_sdist:
name: Make SDist
runs-on: ubuntu-latest
needs: [determine-source-date-epoch]
env:
SOURCE_DATE_EPOCH: ${{ needs.determine-source-date-epoch.outputs.source-date-epoch }}
steps:
- uses: actions/checkout@v4
with:
submodules: true
- name: Prepare build files
run: pipx run nox -s prepare
- name: Build awkward-cpp sdist
run: pipx run build --sdist awkward-cpp
- name: Check metadata
run: pipx run twine check awkward-cpp/dist/*
- uses: actions/upload-artifact@v4
with:
name: awkward-sdist
path: awkward-cpp/dist/*.tar.gz
build_wheels:
needs: [determine-source-date-epoch]
name: "Wheel: ${{ matrix.type }} ${{ matrix.arch }} on ${{ matrix.os }} with ${{ matrix.build }}"
runs-on: ${{ matrix.os }}
env:
SOURCE_DATE_EPOCH: ${{ needs.determine-source-date-epoch.outputs.source-date-epoch }}
strategy:
matrix:
os: [ubuntu-latest, macos-latest]
arch: [auto64]
build: ["cp*", "pp*"]
include:
- os: macos-latest
type: "Universal"
arch: universal2
build: "cp*"
- os: windows-latest
arch: auto64
build: "cp*"
- os: windows-latest
arch: auto32
build: "cp{38,39}-*"
steps:
- uses: actions/checkout@v4
with:
submodules: true
- name: Python 3.11
uses: actions/setup-python@v5
with:
python-version: '3.11'
- name: Prepare build files
run: pipx run nox -s prepare
- uses: pypa/[email protected]
env:
CIBW_BUILD: ${{ matrix.build }}
CIBW_ARCHS: ${{ matrix.arch }}
with:
config-file: cibuildwheel.toml
package-dir: awkward-cpp
- name: Check metadata
shell: python
run: |
import subprocess, glob
subprocess.run(
["pipx", "run", "twine", "check", *glob.glob("wheelhouse/*.whl")],
check=True
)
- name: Upload wheels
uses: actions/upload-artifact@v4
with:
name: awkward-wheels-${{ matrix.os }}-${{ matrix.arch }}-${{ matrix.build }}
path: wheelhouse/*.whl
build_alt_wheels:
needs: [determine-source-date-epoch]
name: "Wheel: ${{ matrix.python }} on ${{ matrix.arch }}"
runs-on: ubuntu-latest
env:
SOURCE_DATE_EPOCH: ${{ needs.determine-source-date-epoch.outputs.source-date-epoch }}
strategy:
matrix:
python: [38, 39, 310, 311, 312]
arch: [aarch64]
steps:
- uses: actions/checkout@v4
with:
submodules: true
- name: Python 3.10
uses: actions/setup-python@v5
with:
python-version: '3.10'
- name: Prepare build files
run: pipx run nox -s prepare
- uses: docker/[email protected]
- uses: pypa/[email protected]
env:
CIBW_BUILD: cp${{ matrix.python }}-*
CIBW_ARCHS: ${{ matrix.arch }}
with:
config-file: cibuildwheel.toml
package-dir: awkward-cpp
- name: Check metadata
shell: python
run: |
import subprocess, glob
subprocess.run(
["pipx", "run", "twine", "check", *glob.glob("wheelhouse/*.whl")],
check=True
)
- name: Upload wheels
uses: actions/upload-artifact@v4
with:
name: awkward-wheels-${{ matrix.arch }}-py${{ matrix.python }}
path: wheelhouse/*.whl
upload_all:
needs: [build_wheels, build_alt_wheels, make_sdist]
runs-on: ubuntu-latest
if: inputs.publish-pypi
permissions:
id-token: write
environment:
name: "pypi"
url: "https://pypi.org/project/awkward-cpp/"
steps:
- uses: actions/download-artifact@v4
with:
pattern: "awkward*"
path: dist
- uses: pypa/[email protected]