-
Notifications
You must be signed in to change notification settings - Fork 103
253 lines (243 loc) · 7.66 KB
/
Copy pathci.yml
File metadata and controls
253 lines (243 loc) · 7.66 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
name: CI
on:
push:
branches: [main]
pull_request:
concurrency:
group: ci-${{ github.ref }}
cancel-in-progress: true
env:
CARGO_TERM_COLOR: always
jobs:
check:
name: Check & Lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- uses: actions/cache@v5
with:
path: |
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
key: cargo-check-${{ hashFiles('**/Cargo.lock') }}
restore-keys: cargo-check-
- name: Install Rust
run: |
rustup toolchain install stable --profile minimal --component clippy,rustfmt
rustup default stable
- name: Format check
run: cargo fmt --check
- name: Clippy
run: cargo clippy -- -D warnings
- name: Build
run: cargo build --release
- name: Report binary size
run: |
ls -lh target/release/pup
strip target/release/pup
echo "Stripped:"
ls -lh target/release/pup
test:
name: Test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- uses: actions/cache@v5
with:
path: |
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
key: cargo-test-${{ hashFiles('**/Cargo.lock') }}
restore-keys: cargo-test-
- name: Install Rust
run: |
rustup toolchain install stable --profile minimal
rustup default stable
- name: Run tests
run: cargo test --verbose -- --test-threads=1
coverage:
name: Code Coverage
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- uses: actions/cache@v5
with:
path: |
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
key: cargo-cov-${{ hashFiles('**/Cargo.lock') }}
restore-keys: cargo-cov-
- name: Install Rust
run: |
rustup toolchain install stable --profile minimal --component llvm-tools-preview
rustup default stable
- name: Install cargo-llvm-cov
run: cargo install cargo-llvm-cov
- name: Generate coverage
run: cargo llvm-cov --lcov --output-path lcov.info --ignore-filename-regex 'main\.rs|auth/' -- --test-threads=1
- name: Coverage summary
run: cargo llvm-cov report --ignore-filename-regex 'main\.rs|auth/'
- name: Upload coverage artifact
uses: actions/upload-artifact@v7
with:
name: coverage-report
path: lcov.info
cross-compile-linux:
name: Cross Compile (Linux)
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- uses: actions/cache@v5
with:
path: |
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
key: cargo-cross-linux-${{ hashFiles('**/Cargo.lock') }}
restore-keys: cargo-cross-linux-
- name: Install Rust
run: |
rustup toolchain install stable --profile minimal
rustup default stable
rustup target add aarch64-unknown-linux-gnu
- name: Install Zig
run: |
ZIG_VERSION="0.13.0"
curl -sL "https://ziglang.org/download/${ZIG_VERSION}/zig-linux-x86_64-${ZIG_VERSION}.tar.xz" | tar xJ
echo "$PWD/zig-linux-x86_64-${ZIG_VERSION}" >> "$GITHUB_PATH"
- name: Install cargo-zigbuild
run: cargo install --locked cargo-zigbuild
- name: Build all targets
run: |
PIDS=()
for target in x86_64-unknown-linux-gnu aarch64-unknown-linux-gnu; do
(set -o pipefail
echo "==> Starting ${target}"
cargo zigbuild --release --target "${target}" --features vendored-openssl 2>&1 \
| tee "/tmp/${target}.log"
) &
PIDS+=($!)
done
status=0
for pid in "${PIDS[@]}"; do
wait "$pid" || status=1
done
exit $status
- name: Report sizes
run: |
for target in x86_64-unknown-linux-gnu aarch64-unknown-linux-gnu; do
echo "${target}:"
ls -lh "target/${target}/release/pup"
done
cross-compile-macos:
name: Cross Compile (macOS)
runs-on: macos-latest
steps:
- uses: actions/checkout@v6
- uses: actions/cache@v5
with:
path: |
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
key: cargo-cross-macos-${{ hashFiles('**/Cargo.lock') }}
restore-keys: cargo-cross-macos-
- name: Install Rust
run: |
rustup toolchain install stable --profile minimal
rustup default stable
rustup target add x86_64-apple-darwin aarch64-apple-darwin
- name: Build all targets
run: |
PIDS=()
for target in x86_64-apple-darwin aarch64-apple-darwin; do
(set -o pipefail
echo "==> Starting ${target}"
cargo build --release --target "${target}" 2>&1 \
| tee "/tmp/${target}.log"
) &
PIDS+=($!)
done
status=0
for pid in "${PIDS[@]}"; do
wait "$pid" || status=1
done
exit $status
- name: Report sizes
run: |
for target in x86_64-apple-darwin aarch64-apple-darwin; do
echo "${target}:"
ls -lh "target/${target}/release/pup"
done
windows:
name: Windows Build & Test
runs-on: windows-latest
defaults:
run:
shell: bash
steps:
- uses: actions/checkout@v6
- uses: actions/cache@v5
with:
path: |
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
key: cargo-windows-${{ hashFiles('**/Cargo.lock') }}
restore-keys: cargo-windows-
- name: Enable long paths
run: git config --global core.longpaths true
- name: Install NASM
run: |
choco install nasm -y
echo "C:\Program Files\NASM" >> "$GITHUB_PATH"
- name: Install Rust
run: |
rustup toolchain install stable --profile minimal
rustup default stable
- name: Build
run: cargo build --release
- name: Run tests
run: cargo test --verbose -- --test-threads=1
- name: Report binary size
run: ls -lh target/release/pup.exe
wasm:
name: WASM (WASI + Browser)
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- uses: actions/cache@v5
with:
path: |
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
key: cargo-wasm-${{ hashFiles('**/Cargo.lock') }}
restore-keys: cargo-wasm-
- name: Install Rust
run: |
rustup toolchain install stable --profile minimal
rustup default stable
rustup target add wasm32-wasip2 wasm32-unknown-unknown
- name: Build WASI
run: cargo build --target wasm32-wasip2 --no-default-features --features wasi --release
- name: Install wasm-pack
run: cargo install wasm-pack
- name: Build browser WASM
run: wasm-pack build --target web --no-default-features --features browser
- name: Report sizes
run: |
echo "WASI:"
ls -lh target/wasm32-wasip2/release/pup.wasm
echo "Browser WASM:"
ls -lh pkg/pup_wasm_bg.wasm