-
Notifications
You must be signed in to change notification settings - Fork 0
243 lines (218 loc) · 6.92 KB
/
rust.yml
File metadata and controls
243 lines (218 loc) · 6.92 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
name: Unplug
on:
push:
branches:
- main
paths-ignore:
- '.gitignore'
- '**.md'
- '**.txt'
- 'docs/**'
- '.vscode/**'
pull_request:
branches:
- main
workflow_dispatch:
schedule:
- cron: '0 8 * * *'
env:
CARGO_TERM_COLOR: always
stable_toolchain: 1.74.1
nightly_toolchain: nightly-2024-12-20
branch_name: ${{ github.base_ref || github.ref_name }}
jobs:
build:
name: "Build"
strategy:
fail-fast: false
matrix:
include:
- name: windows-x64
host: windows-latest
target: x86_64-pc-windows-msvc
exe-name: unplug.exe
- name: macos-arm64
host: macos-latest
target: aarch64-apple-darwin
exe-name: unplug
- name: macos-x64
host: macos-latest
target: x86_64-apple-darwin
exe-name: unplug
- name: linux-x64
host: ubuntu-latest
target: x86_64-unknown-linux-gnu
exe-name: unplug
runs-on: ${{ matrix.host }}
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Install Toolchain
uses: ./.github/actions/toolchain
with:
target: ${{ matrix.target }}
stable: ${{ env.stable_toolchain }}
nightly: ${{ env.nightly_toolchain }}
- name: Fetch Crates
run: cargo fetch --target ${{ matrix.target }}
- name: Check MSRV
run: cargo check --workspace --all-targets --target ${{ matrix.target }}
- name: Build CLI
run:
cargo +${{ env.nightly_toolchain }} build
-v -p unplug-cli --target ${{ matrix.target }}
--release --no-default-features --features distribution
-Z build-std=std,panic_abort -Z build-std-features=panic_immediate_abort
env:
RUSTFLAGS: -C strip=symbols
- name: Upload Artifacts
uses: actions/upload-artifact@v4
with:
name: unplug-${{ env.branch_name }}-${{ matrix.name }}
path: target/${{ matrix.target }}/release/${{ matrix.exe-name }}
if-no-files-found: error
universal:
name: "macOS Universal Binary"
needs: build
runs-on: macos-latest
steps:
- name: Download ARM Build
uses: actions/download-artifact@v4
with:
name: unplug-${{ env.branch_name }}-macos-arm64
path: arm64
- name: Download x64 Build
uses: actions/download-artifact@v4
with:
name: unplug-${{ env.branch_name }}-macos-x64
path: x64
- name: Run Lipo
run: lipo arm64/unplug x64/unplug -create -output unplug
- name: Upload Artifacts
uses: actions/upload-artifact@v4
with:
name: unplug-${{ env.branch_name }}-macos-universal
path: unplug
if-no-files-found: error
- name: Delete Intermediate Artifacts
uses: geekyeggo/delete-artifact@v5
with:
name: |
unplug-${{ env.branch_name }}-macos-arm64
unplug-${{ env.branch_name }}-macos-x64
failOnError: false
test:
name: "Test (with ISO)"
if: ${{ github.secret_source == 'Actions' }}
strategy:
fail-fast: false
matrix:
include:
- name: windows-x64
host: windows-latest
target: x86_64-pc-windows-msvc
- name: macos-x64
host: macos-latest
target: x86_64-apple-darwin
- name: linux-x64
host: ubuntu-latest
target: x86_64-unknown-linux-gnu
runs-on: ${{ matrix.host }}
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Install Toolchain
uses: ./.github/actions/toolchain
with:
target: ${{ matrix.target }}
stable: ${{ env.stable_toolchain }}
- name: Install cargo-llvm-cov
uses: taiki-e/install-action@cargo-llvm-cov
- if: ${{ contains(matrix.host, 'windows') }}
name: Download Test Resources (Windows)
run: |
Start-BitsTransfer -Source "$Env:ISO_URL" -Destination chibi.zip 2>$null
Start-BitsTransfer -Source "$Env:BRSAR_URL" -Destination cb_robo.brsar 2>$null
Expand-Archive chibi.zip -DestinationPath .
Remove-Item chibi.zip
env:
ISO_URL: ${{ secrets.iso_url }}
BRSAR_URL: ${{ secrets.brsar_url }}
- if: ${{ !contains(matrix.host, 'windows') }}
name: Download Test Resources (Unix)
run: |
curl -fsS "$ISO_URL" -o chibi.zip
curl -fsS "$BRSAR_URL" -o cb_robo.brsar
unzip chibi.zip
rm chibi.zip
env:
ISO_URL: ${{ secrets.iso_url }}
BRSAR_URL: ${{ secrets.brsar_url }}
- name: Build and Run Tests
run: cargo llvm-cov -vv --workspace --target ${{ matrix.target }} --lcov --output-path lcov.info
env:
CHIBI_ISO: ${{ github.workspace }}/chibi.iso
CHIBI_BRSAR: ${{ github.workspace }}/cb_robo.brsar
- name: Upload Code Coverage
uses: coverallsapp/github-action@master
with:
github-token: ${{ secrets.github_token }}
flag-name: run-${{ matrix.name }}
path-to-lcov: lcov.info
parallel: true
test-lite:
name: "Test (without ISO)"
if: ${{ github.secret_source != 'Actions' }}
strategy:
fail-fast: false
matrix:
include:
- name: windows-x64
host: windows-latest
target: x86_64-pc-windows-msvc
- name: macos-x64
host: macos-latest
target: x86_64-apple-darwin
- name: linux-x64
host: ubuntu-latest
target: x86_64-unknown-linux-gnu
runs-on: ${{ matrix.host }}
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Install Toolchain
uses: ./.github/actions/toolchain
with:
target: ${{ matrix.target }}
stable: ${{ env.stable_toolchain }}
- name: Build and Run Library Tests
run: cargo test -vv --workspace --target ${{ matrix.target }} --lib
test-done:
name: "Finalize Code Coverage"
if: github.event.pusher
needs: test
runs-on: ubuntu-latest
steps:
- name: Finalize Coverage
uses: coverallsapp/github-action@master
with:
github-token: ${{ secrets.github_token }}
parallel-finished: true
vscode-package:
name: "VSCode Package"
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Install vsce
run: npm install --global @vscode/vsce
- name: Create VSIX
run: |
cp ../COPYING LICENSE.txt
vsce package --allow-missing-repository -o ../unplug-vscode.vsix
working-directory: unplug-vscode
- name: Upload
uses: actions/upload-artifact@v4
with:
name: unplug-vscode
path: unplug-vscode.vsix