-
Notifications
You must be signed in to change notification settings - Fork 105
201 lines (192 loc) · 6.23 KB
/
Copy pathci.yml
File metadata and controls
201 lines (192 loc) · 6.23 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
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@v6
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: |
for target in x86_64-unknown-linux-gnu aarch64-unknown-linux-gnu; do
echo "::group::Building ${target}"
cargo zigbuild --release --target "${target}" --features vendored-openssl
echo "::endgroup::"
done
- 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: |
for target in x86_64-apple-darwin aarch64-apple-darwin; do
echo "::group::Building ${target}"
cargo build --release --target "${target}"
echo "::endgroup::"
done
- name: Report sizes
run: |
for target in x86_64-apple-darwin aarch64-apple-darwin; do
echo "${target}:"
ls -lh "target/${target}/release/pup"
done
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