-
Notifications
You must be signed in to change notification settings - Fork 43
296 lines (285 loc) · 11.5 KB
/
cli.yml
File metadata and controls
296 lines (285 loc) · 11.5 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
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
name: CLI
on:
workflow_call:
inputs:
bencher-version:
type: string
required: true
mold-version:
type: string
required: true
zig-version:
type: string
required: true
zig-build-version:
type: string
required: true
glibc-version:
type: string
required: true
check-cli:
type: boolean
required: true
is-fork:
type: boolean
required: true
build-cli:
type: boolean
required: true
secrets:
BENCHER_API_TOKEN:
required: true
env:
CARGO_TERM_COLOR: always
CLI_BIN_NAME: bencher
jobs:
action_main:
name: Action `main`
if: github.ref == 'refs/heads/devel' || github.ref == 'refs/heads/cloud'
strategy:
fail-fast: false
matrix:
os: [ubuntu-22.04, macos-14, windows-2022]
runs-on: ${{ matrix.os }}
steps:
- uses: bencherdev/bencher@main
- name: Run Bencher CLI
run: bencher run --project bencher --token ${{ secrets.BENCHER_API_TOKEN }} --dry-run "bencher mock"
action_devel:
name: Action `devel`
if: github.ref == 'refs/heads/devel'
strategy:
fail-fast: false
matrix:
os: [ubuntu-22.04, macos-14, windows-2022]
runs-on: ${{ matrix.os }}
# This is expected to fail when tagging a new release
continue-on-error: ${{ startsWith(github.ref, 'refs/tags/') }}
steps:
- uses: bencherdev/bencher@devel
- name: Run Bencher CLI
run: bencher run --project bencher --token ${{ secrets.BENCHER_API_TOKEN }} --dry-run "bencher mock"
script_cloud:
name: Script Cloud
if: github.ref == 'refs/heads/devel' || github.ref == 'refs/heads/cloud'
strategy:
fail-fast: false
matrix:
os: [ubuntu-22.04, macos-14, windows-2022]
runs-on: ${{ matrix.os }}
steps:
- name: Unix CLI Download Install Script
if: matrix.os != 'windows-2022'
run: curl --proto '=https' --tlsv1.2 -sSfL https://bencher.dev/download/install-cli.sh | sh
- name: Windows CLI Download Install Script
if: matrix.os == 'windows-2022'
run: powershell -c "irm https://bencher.dev/download/install-cli.ps1 | iex"
- name: Run Bencher CLI
run: bencher run --project bencher --token ${{ secrets.BENCHER_API_TOKEN }} --dry-run "bencher mock"
script_gen:
name: Script Gen
if: ${{ inputs.check-cli && !inputs.is-fork }}
# This is expected to fail when tagging a new release
continue-on-error: ${{ startsWith(github.ref, 'refs/tags/') }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-22.04, macos-14, windows-2022]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v6
- name: Unix CLI Install Script
if: matrix.os != 'windows-2022'
run: cat services/cli/templates/output/install-cli.sh | sh
- name: Windows CLI Install Script
if: matrix.os == 'windows-2022'
run: powershell -c "gc -Raw services/cli/templates/output/install-cli.ps1 | iex"
- name: Run Bencher CLI
run: bencher run --project bencher --token ${{ secrets.BENCHER_API_TOKEN }} --dry-run "bencher mock"
script_gen_version:
name: Script Gen Version
if: ${{ inputs.check-cli && !inputs.is-fork }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-22.04, macos-14, windows-2022]
runs-on: ${{ matrix.os }}
# This is expected to fail when tagging a new release
continue-on-error: ${{ startsWith(github.ref, 'refs/tags/') }}
steps:
- uses: actions/checkout@v6
- name: Unix CLI Install Script Version
if: matrix.os != 'windows-2022'
run: export BENCHER_VERSION=${{ inputs.bencher-version }}; cat services/cli/templates/output/install-cli.sh | sh
- name: Windows CLI Install Script Version
if: matrix.os == 'windows-2022'
run: $env:BENCHER_VERSION="${{ inputs.bencher-version }}"; powershell -c "gc -Raw services/cli/templates/output/install-cli.ps1 | iex"
- name: Run Bencher CLI
run: bencher run --project bencher --token ${{ secrets.BENCHER_API_TOKEN }} --dry-run "bencher mock"
cargo_main:
name: Cargo `main`
if: ${{ github.ref == 'refs/heads/main' && inputs.check-cli }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-22.04, macos-14, windows-2022]
runs-on: ${{ matrix.os }}
# This is expected to fail when tagging a new release
continue-on-error: ${{ startsWith(github.ref, 'refs/tags/') }}
steps:
- name: Cargo CLI Install main
run: cargo install --git https://github.com/bencherdev/bencher --branch main --locked bencher_cli
- name: Run Bencher CLI
run: bencher run --project bencher --token ${{ secrets.BENCHER_API_TOKEN }} --dry-run "bencher mock"
cargo_devel:
name: Cargo `devel`
if: ${{ github.ref == 'refs/heads/devel' && inputs.check-cli }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-22.04, macos-14, windows-2022]
runs-on: ${{ matrix.os }}
# This is expected to fail when tagging a new release
continue-on-error: ${{ startsWith(github.ref, 'refs/tags/') }}
steps:
- name: Cargo CLI Install devel
run: cargo install --git https://github.com/bencherdev/bencher --branch devel --locked bencher_cli
- name: Run Bencher CLI
run: bencher run --project bencher --token ${{ secrets.BENCHER_API_TOKEN }} --dry-run "bencher mock"
build_cli:
name: Build CLI
if: ${{ inputs.build-cli }}
strategy:
fail-fast: false
matrix:
include:
- build: linux-x86-64
os: ubuntu-22.04
target: x86_64-unknown-linux-gnu
- build: linux-arm-64
os: ubuntu-22.04
target: aarch64-unknown-linux-gnu
- build: macos-x86-64
os: macos-14
target: x86_64-apple-darwin
- build: macos-arm-64
os: macos-14
target: aarch64-apple-darwin
- build: windows-x86-64
os: windows-2022
target: x86_64-pc-windows-msvc
- build: windows-arm-64
os: windows-2022
target: aarch64-pc-windows-msvc
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v6
- name: Set CLI version
shell: bash
run: |
VERSION="${{ github.head_ref || github.ref_name }}"
echo "CLI_VERSION=${VERSION//\//-}" >> $GITHUB_ENV
- name: Install Rust target
run: rustup target add ${{ matrix.target }}
- uses: mlugg/setup-zig@v2
if: startsWith(matrix.build, 'linux')
with:
version: ${{ inputs.zig-version }}
- name: Install zigbuild
if: startsWith(matrix.build, 'linux')
run: cargo install --version ${{ inputs.zig-build-version }} --locked --force cargo-zigbuild
- name: cargo zigbuild Linux CLI
if: startsWith(matrix.build, 'linux')
working-directory: ./services/cli
run: cargo zigbuild --profile release-small --target ${{ matrix.target }}.${{ inputs.glibc-version }}
- name: cargo build macOS CLI
if: startsWith(matrix.build, 'macos')
working-directory: ./services/cli
run: cargo build --profile release-small --target ${{ matrix.target }}
- name: cargo build Windows CLI
if: startsWith(matrix.build, 'windows')
working-directory: ./services/cli
run: cargo build --profile release-small --target ${{ matrix.target }}
- name: Rename Unix CLI bin
if: (!startsWith(matrix.build, 'windows'))
run: mv ./target/${{ matrix.target }}/release-small/${{ env.CLI_BIN_NAME }} ${{ env.CLI_BIN_NAME }}-${{ env.CLI_VERSION }}-${{ matrix.build }}
- name: Rename Windows CLI bin
if: startsWith(matrix.build, 'windows')
run: mv ./target/${{ matrix.target }}/release-small/${{ env.CLI_BIN_NAME }}.exe ${{ env.CLI_BIN_NAME }}-${{ env.CLI_VERSION }}-${{ matrix.build }}.exe
- name: Generate Unix SHA256 checksum
if: (!startsWith(matrix.build, 'windows'))
run: shasum -a 256 ${{ env.CLI_BIN_NAME }}-${{ env.CLI_VERSION }}-${{ matrix.build }} > ${{ env.CLI_BIN_NAME }}-${{ env.CLI_VERSION }}-${{ matrix.build }}.sha256
- name: Upload Unix CLI Artifact
if: (!startsWith(matrix.build, 'windows'))
uses: actions/upload-artifact@v7
with:
name: ${{ env.CLI_BIN_NAME }}-${{ env.CLI_VERSION }}-${{ matrix.build }}
path: |
${{ env.CLI_BIN_NAME }}-${{ env.CLI_VERSION }}-${{ matrix.build }}
${{ env.CLI_BIN_NAME }}-${{ env.CLI_VERSION }}-${{ matrix.build }}.sha256
if-no-files-found: error
- name: Generate Windows SHA256 checksum
if: startsWith(matrix.build, 'windows')
shell: bash
run: sha256sum ${{ env.CLI_BIN_NAME }}-${{ env.CLI_VERSION }}-${{ matrix.build }}.exe > ${{ env.CLI_BIN_NAME }}-${{ env.CLI_VERSION }}-${{ matrix.build }}.exe.sha256
- name: Upload Windows CLI Artifact
if: startsWith(matrix.build, 'windows')
uses: actions/upload-artifact@v7
with:
name: ${{ env.CLI_BIN_NAME }}-${{ env.CLI_VERSION }}-${{ matrix.build }}.exe
path: |
${{ env.CLI_BIN_NAME }}-${{ env.CLI_VERSION }}-${{ matrix.build }}.exe
${{ env.CLI_BIN_NAME }}-${{ env.CLI_VERSION }}-${{ matrix.build }}.exe.sha256
if-no-files-found: error
package_cli:
name: Package CLI
if: ${{ inputs.build-cli }}
needs: build_cli
strategy:
fail-fast: false
matrix:
include:
- build: linux-x86-64
os: ubuntu-22.04
arch: amd64
- build: linux-arm-64
os: ubuntu-22.04
arch: arm64
runs-on: ${{ matrix.os }}
env:
CLI_DEB_DIR: deb
steps:
- uses: actions/checkout@v6
- name: Set CLI version
shell: bash
run: |
VERSION="${{ github.head_ref || github.ref_name }}"
echo "CLI_VERSION=${VERSION//\//-}" >> $GITHUB_ENV
- name: Download CLI Artifact
uses: actions/download-artifact@v8
with:
name: ${{ env.CLI_BIN_NAME }}-${{ env.CLI_VERSION }}-${{ matrix.build }}
- uses: rui314/setup-mold@v1
with:
mold-version: ${{ inputs.mold-version }}
- name: Build .deb package
run: cargo gen-pkg deb --dir ${{ env.CLI_DEB_DIR }} --arch ${{ matrix.arch }} ${{ env.CLI_BIN_NAME }}-${{ env.CLI_VERSION }}-${{ matrix.build }}
- name: Test install .deb package
if: matrix.build == 'linux-x86-64'
run: sudo dpkg -i ${{ env.CLI_DEB_DIR }}/${{ env.CLI_BIN_NAME }}-${{ env.CLI_VERSION }}-${{ matrix.build }}.deb
- name: Sanity test .deb package installation
if: matrix.build == 'linux-x86-64'
run: |
bencher --version
bencher mock
man bencher
- name: Generate .deb SHA256 checksum
run: shasum -a 256 ${{ env.CLI_DEB_DIR }}/${{ env.CLI_BIN_NAME }}-${{ env.CLI_VERSION }}-${{ matrix.build }}.deb > ${{ env.CLI_DEB_DIR }}/${{ env.CLI_BIN_NAME }}-${{ env.CLI_VERSION }}-${{ matrix.build }}.deb.sha256
- name: Upload .deb Artifact
uses: actions/upload-artifact@v7
with:
name: ${{ env.CLI_BIN_NAME }}-${{ env.CLI_VERSION }}-${{ matrix.build }}.deb
path: |
${{ env.CLI_DEB_DIR }}/${{ env.CLI_BIN_NAME }}-${{ env.CLI_VERSION }}-${{ matrix.build }}.deb
${{ env.CLI_DEB_DIR }}/${{ env.CLI_BIN_NAME }}-${{ env.CLI_VERSION }}-${{ matrix.build }}.deb.sha256
if-no-files-found: error