forked from wcampbell0x2a/backhand
-
Notifications
You must be signed in to change notification settings - Fork 0
194 lines (173 loc) · 7.48 KB
/
Copy pathmain.yml
File metadata and controls
194 lines (173 loc) · 7.48 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
on:
push:
branches:
- master
pull_request:
branches:
- master
schedule: [cron: "40 1 * * *"]
name: ci
jobs:
# build on backhand only supported target
cross-build:
runs-on: ${{ matrix.job.os }}
env:
BUILD_CMD: cargo
strategy:
fail-fast: false
matrix:
job:
- { target: x86_64-pc-windows-gnu, os: ubuntu-24.04, use-cross: true }
toolchain:
- stable
# msrv of backhand-cli
- 1.85
features:
- --no-default-features --features xz
- --no-default-features --features gzip
- --no-default-features --features gzip,xz
- --no-default-features --features gzip,xz,parallel
- --no-default-features --features xz-static
- --no-default-features --features lz4
- --no-default-features --features parallel
- --no-default-features --features v3
# LZMA does not build on windows
# - --no-default-features --features v3_lzma
# NO using default features
# -
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- name: Populate cache
uses: ./.github/workflows/cache
- name: Overwrite build command env variable
if: matrix.job.use-cross
shell: bash
run: |
echo "BUILD_CMD=cross" >> $GITHUB_ENV
RUSTFLAGS="-C target-feature=-crt-static" cargo install cross --git https://github.com/cross-rs/cross
- uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ matrix.toolchain }}
# build lib with cross
- run: $BUILD_CMD +${{ matrix.toolchain }} build ${{ matrix.features }} --target ${{ matrix.job.target }} --release --locked --workspace --lib
# build/test all supported targets for library and bins (skipping slow and squashfs-tools tests)
cross-test:
runs-on: ${{ matrix.job.os }}
env:
RUSTFLAGS: "-C target-feature=+crt-static"
BUILD_CMD: cargo
strategy:
fail-fast: false
matrix:
job:
- { target: x86_64-unknown-linux-musl, os: ubuntu-24.04, use-cross: true }
- { target: aarch64-unknown-linux-musl, os: ubuntu-24.04, use-cross: true }
- { target: arm-unknown-linux-musleabi, os: ubuntu-24.04, use-cross: true }
- { target: armv7-unknown-linux-musleabi, os: ubuntu-24.04, use-cross: true }
- { target: aarch64-unknown-linux-musl, os: ubuntu-24.04, use-cross: true }
toolchain:
- stable
# msrv of backhand-cli
- 1.85
features:
# default features
-
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- name: Populate cache
uses: ./.github/workflows/cache
- name: Overwrite build command env variable
if: matrix.job.use-cross
shell: bash
run: |
echo "BUILD_CMD=cross" >> $GITHUB_ENV
RUSTFLAGS="-C target-feature=-crt-static" cargo install cross --git https://github.com/cross-rs/cross
- uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ matrix.toolchain }}
# TODO: really only needed for the matrix variables without use-cross
targets: ${{ matrix.job.target }}
# build lib and bins with cross or cargo
- run: $BUILD_CMD +${{ matrix.toolchain }} build ${{ matrix.features }} --target ${{ matrix.job.target }} --release --locked --workspace --features xz-static
# test with cross, skipping slow test and tests that use more then qemu default memory without use-cross without use-cross
- run: CROSS_CONTAINER_OPTS="--network host" RUST_LOG=info $BUILD_CMD +${{ matrix.toolchain }} test --workspace --release ${{ matrix.features }} --target ${{ matrix.job.target }} --features xz-static --locked -- --skip slow --skip no_qemu
# build/test all supported targets for library and bins (skipping slow and squashfs-tools tests) (no v3_lzma)
cross-test-macos:
runs-on: ${{ matrix.job.os }}
env:
RUSTFLAGS: "-C target-feature=+crt-static"
BUILD_CMD: cargo
strategy:
fail-fast: false
matrix:
job:
- { target: x86_64-apple-darwin, os: macos-14, }
toolchain:
- stable
# msrv of backhand-cli
- 1.85
features:
# default features (no lzma)
- xz,gzip,zstd,lz4,parallel,v3
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- name: Populate cache
uses: ./.github/workflows/cache
- name: Overwrite build command env variable
if: matrix.job.use-cross
shell: bash
run: |
echo "BUILD_CMD=cross" >> $GITHUB_ENV
RUSTFLAGS="-C target-feature=-crt-static" cargo install cross --git https://github.com/cross-rs/cross
- uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ matrix.toolchain }}
# TODO: really only needed for the matrix variables without use-cross
targets: ${{ matrix.job.target }}
# build lib and bins with cross or cargo
- run: $BUILD_CMD +${{ matrix.toolchain }} build --no-default-features --features ${{ matrix.features }} --target ${{ matrix.job.target }} --release --locked --workspace --features xz-static
# test with cross, skipping slow test and tests that use more then qemu default memory without use-cross without use-cross
- run: CROSS_CONTAINER_OPTS="--network host" RUST_LOG=info $BUILD_CMD +${{ matrix.toolchain }} test --workspace --release --no-default-features --features ${{ matrix.features }} --target ${{ matrix.job.target }} --features xz-static --locked -- --skip slow --skip no_qemu
# build/test all supported on native x86_64 arch for library and bins (all tests)
build-test-native:
runs-on: ubuntu-24.04
strategy:
fail-fast: false
matrix:
toolchain:
- stable
# msrv of backhand-cli
- 1.85
features:
- --no-default-features --features xz
- --no-default-features --features gzip
- --no-default-features --features gzip,xz
- --no-default-features --features xz-static
- --no-default-features --features lz4
- --no-default-features --features v3
- --no-default-features --features v3_lzma
# default features
-
steps:
- run: sudo apt-get install -y squashfs-tools
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- uses: dtolnay/rust-toolchain@a54c7afa936fefeb4456b2dd8068152669aa8203 # master
with:
toolchain: ${{ matrix.toolchain }}
# build bins
- run: cargo +${{ matrix.toolchain }} build ${{ matrix.features }} --release --locked --workspace
# run tests with native unsquashfs on x86_64-unknown-linux-musl (using Cross.toml)
- run: RUST_LOG=info cargo +${{ matrix.toolchain }} test --workspace --release ${{ matrix.features }} --locked --features __test_unsquashfs -- --skip slow
# fmt and clippy on stable
fmt-clippy-stable:
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- uses: dtolnay/rust-toolchain@a54c7afa936fefeb4456b2dd8068152669aa8203 # master
with:
toolchain: stable
components: rustfmt, clippy
# fmt
- run: cargo fmt --all -- --check
# clippy
- run: cargo clippy -- -D warnings