-
Notifications
You must be signed in to change notification settings - Fork 211
240 lines (233 loc) · 8.63 KB
/
columnq_cli_release.yml
File metadata and controls
240 lines (233 loc) · 8.63 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
name: columnq-cli release
on:
push:
paths:
- '.github/workflows/columnq_cli_release.yml'
- 'columnq/**'
- 'columnq-cli/**'
- 'Cargo.lock'
branches: [ main ]
tags: [ 'columnq-cli-v*' ]
env:
# NOTE: the version is also defined in build.yml and Dockerfile
RUST_TC_VER: "1.94.0"
jobs:
# skip tag version validation on non-release branch run
validate-release-tag:
name: Validate git tag
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
if: "startsWith(github.ref, 'refs/tags/')"
- name: compare git tag with cargo metadata
if: "startsWith(github.ref, 'refs/tags/')"
run: |
PUSHED_TAG=${GITHUB_REF##*/}
CURR_VER=$( grep version columnq-cli/Cargo.toml | head -n 1 | awk '{print $3}' | tr -d '"' )
if [[ "${PUSHED_TAG}" != "columnq-cli-v${CURR_VER}" ]]; then
echo "Cargo metadata has version set to ${CURR_VER}, but got pushed tag ${PUSHED_TAG}."
exit 1
fi
macos:
needs: validate-release-tag
runs-on: macos-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "3.10"
- name: Install Rust toolchain
uses: actions-rust-lang/setup-rust-toolchain@v1
with:
toolchain: ${{ env.RUST_TC_VER }}
target: aarch64-apple-darwin,x86_64-apple-darwin
- name: Install maturin
run: pip3 install 'maturin<2'
- name: Build wheels - x86_64
run: |
maturin build -m columnq-cli/Cargo.toml -b bin --target x86_64-apple-darwin --release --out dist --features=database-sqlite
- name: Build wheels - universal2
env:
DEVELOPER_DIR: /Applications/Xcode.app/Contents/Developer
MACOSX_DEPLOYMENT_TARGET: '10.12'
run: |
# set SDKROOT for C dependencies
export SDKROOT=$(xcrun --sdk macosx --show-sdk-path)
maturin build -m columnq-cli/Cargo.toml -b bin --release --target universal2-apple-darwin --out dist --features=database-sqlite
pip install columnq-cli --no-index --find-links dist --force-reinstall
columnq --help
- name: Upload wheels
uses: actions/upload-artifact@v4
with:
name: wheels-macos
path: dist
- name: Archive binary
if: "startsWith(github.ref, 'refs/tags/')"
run: tar czvf target/release/columnq-cli.tar.gz -C target/release columnq
- name: Upload binary to GitHub Release
uses: svenstaro/upload-release-action@v2
if: "startsWith(github.ref, 'refs/tags/')"
with:
overwrite: true
repo_token: ${{ secrets.GITHUB_TOKEN }}
asset_name: columnq-cli-apple-darwin.tar.gz
file: target/release/columnq-cli.tar.gz
tag: ${{ github.ref }}
windows:
needs: validate-release-tag
runs-on: windows-latest
strategy:
matrix:
platform:
- python-architecture: "x64"
target: "x86_64-pc-windows-msvc"
features: "database-sqlite"
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "3.10"
architecture: ${{ matrix.platform.python-architecture }}
- name: Install Rust toolchain
uses: actions-rust-lang/setup-rust-toolchain@v1
with:
toolchain: ${{ env.RUST_TC_VER }}
target: ${{ matrix.platform.target }}
- name: Install maturin
run: pip3 install 'maturin<2'
- name: Build wheels
run: |
maturin build -m columnq-cli/Cargo.toml -b bin --release --out dist --target ${{ matrix.platform.target }} --features=${{ matrix.platform.features }}
pip install columnq-cli --no-index --find-links dist --force-reinstall
columnq --help
- name: Upload wheels
uses: actions/upload-artifact@v4
with:
name: wheels-windows
path: dist
- name: Archive binary
if: "startsWith(github.ref, 'refs/tags/')"
run: tar czvf target/release/columnq-cli.tar.gz -C target/${{ matrix.platform.target }}/release columnq.exe
- name: Upload binary to GitHub Release
uses: svenstaro/upload-release-action@v2
if: "startsWith(github.ref, 'refs/tags/')"
with:
overwrite: true
repo_token: ${{ secrets.GITHUB_TOKEN }}
asset_name: columnq-cli-windows.tar.gz
file: target/release/columnq-cli.tar.gz
tag: ${{ github.ref }}
linux:
needs: validate-release-tag
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
platform:
- manylinux: "2010"
target: "x86_64-unknown-linux-musl"
image_tag: "x86_64-musl"
features: "rustls,database-sqlite"
name_suffix: ""
upload: "true"
# - manylinux: "2010"
# target: "x86_64-unknown-linux-musl"
# image_tag: "x86_64-musl"
# features: "native-tls,database-sqlite"
# name_suffix: "-openssl"
# upload: "false"
- manylinux: '2014'
target: "aarch64-unknown-linux-musl"
image_tag: "aarch64-musl"
features: "rustls,database-sqlite"
name_suffix: ""
upload: "true"
# - manylinux: '2014'
# target: "aarch64-unknown-linux-musl"
# image_tag: "aarch64-musl"
# features: "native-tls,database-sqlite"
# name_suffix: "-openssl"
# upload: "false"
# - manylinux: '2014'
# target: "armv7-unknown-linux-musleabihf"
# image_tag: "armv7-musleabihf"
# features: "rustls,database-sqlite"
# name_suffix: ""
# upload: "true"
# - manylinux: '2014'
# target: "armv7-unknown-linux-musleabihf"
# image_tag: "armv7-musleabihf"
# features: "native-tls,database-sqlite"
# name_suffix: "-openssl"
# upload: "false"
container:
image: docker://messense/rust-musl-cross:${{ matrix.platform.image_tag }}
env:
RUSTUP_HOME: /root/.rustup
CARGO_HOME: /root/.cargo
steps:
- uses: actions/checkout@v4
- name: Install Rust toolchain
run: |
rustup update ${{ env.RUST_TC_VER }}
rustup target add \
--toolchain ${{ env.RUST_TC_VER }} \
${{ matrix.platform.target }}
rustup default ${{ env.RUST_TC_VER }}
- name: Install build deps
if: "contains(matrix.platform.name_suffix, 'openssl')"
run: |
apt-get update
apt-get install -y libssl-dev
- name: Build Wheels
run: |
sudo python3 -m pip install 'maturin<2'
maturin build -m columnq-cli/Cargo.toml -b bin --release -o dist \
--target ${{ matrix.platform.target }} --manylinux ${{ matrix.platform.manylinux }} \
--no-default-features --features=${{ matrix.platform.features }}
- name: Upload wheels
uses: actions/upload-artifact@v4
if: "matrix.platform.upload == 'true'"
with:
name: wheels-linux-${{ matrix.platform.manylinux }}
path: dist
- name: Archive binary
if: "startsWith(github.ref, 'refs/tags/')"
run: tar czvf target/release/columnq-cli.tar.gz -C target/${{ matrix.platform.target }}/release columnq
- name: Upload binary to GitHub Release
if: "startsWith(github.ref, 'refs/tags/')"
uses: svenstaro/upload-release-action@v2
with:
overwrite: true
repo_token: ${{ secrets.GITHUB_TOKEN }}
asset_name: columnq-cli-${{ matrix.platform.target }}${{ matrix.platform.name_suffix }}.tar.gz
file: target/release/columnq-cli.tar.gz
tag: ${{ github.ref }}
pypi_release:
needs: [ validate-release-tag, linux, macos, windows ]
name: PyPI Release
runs-on: ubuntu-latest
if: "startsWith(github.ref, 'refs/tags/')"
steps:
- uses: actions/download-artifact@v4
with:
name: wheels-linux-2010
- uses: actions/download-artifact@v4
with:
name: wheels-linux-2014
- uses: actions/download-artifact@v4
with:
name: wheels-macos
- uses: actions/download-artifact@v4
with:
name: wheels-windows
- uses: actions/setup-python@v5
with:
python-version: "3.10"
- name: Publish to PyPi
env:
TWINE_USERNAME: __token__
TWINE_PASSWORD: ${{ secrets.COLUMNQ_CLI_PYPI_TOKEN }}
run: |
pip install --upgrade twine
twine upload --skip-existing *