-
Notifications
You must be signed in to change notification settings - Fork 0
271 lines (234 loc) · 8.67 KB
/
Copy pathrelease.yml
File metadata and controls
271 lines (234 loc) · 8.67 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
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
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
name: Release
on:
release:
types: [published]
jobs:
build-rust:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
- name: Package crate
run: cargo package -p quicknode-sdk --allow-dirty
- uses: actions/upload-artifact@v4
with:
name: rust-crate
path: target/package/quicknode-sdk-*.crate
build-python:
strategy:
fail-fast: false
matrix:
python-version: ['3.11', '3.12', '3.13', '3.14']
target:
- x86_64-unknown-linux-gnu
- aarch64-unknown-linux-gnu
- x86_64-unknown-linux-musl
- aarch64-unknown-linux-musl
# Placeholder for future macOS support:
# - aarch64-apple-darwin
include:
# All Linux targets cross-build with zig so wheels link against an older
# glibc (manylinux2014, glibc 2.17) instead of the ubuntu-latest runner's
# glibc 2.39. Without this, the native x64 wheel would only load on
# Ubuntu 24.04+ hosts.
- target: x86_64-unknown-linux-gnu
cross: true
- target: aarch64-unknown-linux-gnu
cross: true
- target: x86_64-unknown-linux-musl
cross: true
- target: aarch64-unknown-linux-musl
cross: true
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
with:
targets: ${{ matrix.target }}
- uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install maturin
run: pip install "maturin>=1.5,<2.0"
- name: Install Zig
if: matrix.cross
uses: goto-bus-stop/setup-zig@v2
- name: Build wheel
run: |
maturin build --release \
--strip \
--target ${{ matrix.target }} \
${{ matrix.cross && '--zig' || '' }} \
-i python${{ matrix.python-version }} \
--out dist/
- name: Build sdist
if: matrix.target == 'x86_64-unknown-linux-gnu' && matrix.python-version == '3.11'
run: maturin sdist --out dist/
- uses: actions/upload-artifact@v4
with:
name: python-${{ matrix.target }}-py${{ matrix.python-version }}
path: dist/*
build-node:
strategy:
fail-fast: false
matrix:
target:
- x86_64-unknown-linux-gnu
- aarch64-unknown-linux-gnu
- x86_64-unknown-linux-musl
- aarch64-unknown-linux-musl
# Placeholder for future macOS support:
# - aarch64-apple-darwin
include:
# gnu targets cross-build via `--use-cross`, which runs the build inside
# rust-cross/cross's Docker image. Cross.toml's [build.zig] makes cross
# use zig cc inside the image and pins glibc to 2.17 (manylinux2014).
# musl targets cross-build via `--cross-compile`, which uses host zig +
# cargo-zigbuild — musl is statically linked so no glibc pin needed.
# Either path keeps us off the ubuntu-latest runner's glibc 2.39.
- target: x86_64-unknown-linux-gnu
cross: true
- target: aarch64-unknown-linux-gnu
cross: true
- target: x86_64-unknown-linux-musl
cross: true
- target: aarch64-unknown-linux-musl
cross: true
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
with:
targets: ${{ matrix.target }}
- uses: actions/setup-node@v4
with:
node-version: '20'
- name: Install Zig
if: matrix.cross && contains(matrix.target, 'musl')
uses: goto-bus-stop/setup-zig@v2
- name: Install cargo-zigbuild
if: matrix.cross && contains(matrix.target, 'musl')
run: cargo install cargo-zigbuild --locked
- name: Install cross
if: matrix.cross && contains(matrix.target, 'gnu')
run: cargo install cross --locked
- name: Install npm dependencies
working-directory: npm
run: npm install
- name: Build native module
working-directory: npm
run: |
npx napi build --release \
--platform \
--target ${{ matrix.target }} \
${{ contains(matrix.target, 'gnu') && '--use-cross' || '--cross-compile' }} \
--manifest-path ../crates/node/Cargo.toml \
--output-dir .
- name: Strip debug symbols
run: |
if [ "${{ matrix.cross }}" = "true" ]; then
sudo apt-get install -y llvm
llvm-strip npm/index.*.node
else
strip npm/index.*.node
fi
- uses: actions/upload-artifact@v4
with:
name: node-${{ matrix.target }}
path: npm/index.*.node
build-ruby:
strategy:
fail-fast: false
matrix:
include:
# x86_64-unknown-linux-gnu uses cargo-zigbuild so the .so links against
# an older glibc (manylinux2014, glibc 2.17) instead of the runner's
# glibc 2.39. Without this, the native gem only loads on Ubuntu 24.04+.
- target: x86_64-unknown-linux-gnu
cross: true
gem_platform: x86_64-linux
- target: aarch64-unknown-linux-gnu
cross: true
gem_platform: aarch64-linux
# musl targets are excluded: Rust cdylib is incompatible with musl (no dynamic linker).
# The pure-Ruby source gem (built below on x86_64-unknown-linux-gnu) ships no native
# extension and exists only so Bundler's resolver has a `ruby`-platform fallback for
# heterogeneous Gemfile.lock PLATFORMS lists. Users on platforms without a precompiled
# platform gem (musl Linux, Windows) get a clear LoadError from lib/quicknode_sdk.rb at
# first require, listing the supported platforms.
# Placeholder for future macOS support:
# - target: aarch64-apple-darwin
# cross: false
# gem_platform: arm64-darwin
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
with:
targets: ${{ matrix.target }}
- uses: ruby/setup-ruby@v1
with:
ruby-version: '3.3'
- name: Install Zig
if: matrix.cross
uses: goto-bus-stop/setup-zig@v2
- name: Install cargo-zigbuild
if: matrix.cross
run: cargo install cargo-zigbuild
- name: Build native extension (cross)
if: matrix.cross
run: |
cargo zigbuild --release -p sdk-ruby --target ${{ matrix.target }}
mkdir -p ruby/lib/quicknode_sdk
cp target/${{ matrix.target }}/release/libquicknode_sdk.so ruby/lib/quicknode_sdk/quicknode_sdk.so
- name: Build native extension (native)
if: '!matrix.cross'
run: |
cargo build --release -p sdk-ruby
mkdir -p ruby/lib/quicknode_sdk
cp target/release/libquicknode_sdk.so ruby/lib/quicknode_sdk/quicknode_sdk.so
- name: Strip debug symbols
run: |
if [ "${{ matrix.cross }}" = "true" ]; then
sudo apt-get install -y llvm
llvm-strip ruby/lib/quicknode_sdk/quicknode_sdk.so
else
strip ruby/lib/quicknode_sdk/quicknode_sdk.so
fi
- name: Build platform gem
working-directory: ruby
run: |
ruby -e "
spec = Gem::Specification.load('quicknode_sdk.gemspec')
spec.platform = Gem::Platform.new('${{ matrix.gem_platform }}')
spec.extensions = []
spec.files += ['lib/quicknode_sdk/quicknode_sdk.so']
File.write('quicknode_sdk_platform.gemspec', spec.to_ruby)
"
gem build quicknode_sdk_platform.gemspec
rm quicknode_sdk_platform.gemspec
- name: Build source gem
if: matrix.target == 'x86_64-unknown-linux-gnu'
working-directory: ruby
run: gem build quicknode_sdk.gemspec
- uses: actions/upload-artifact@v4
with:
name: ruby-${{ matrix.target }}
path: ruby/*.gem
release:
needs: [build-rust, build-python, build-node, build-ruby]
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- uses: actions/checkout@v4
- uses: actions/download-artifact@v4
with:
path: artifacts/
merge-multiple: true
- uses: softprops/action-gh-release@v2
with:
files: artifacts/**/*
tag_name: ${{ github.event.release.tag_name }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}