-
Notifications
You must be signed in to change notification settings - Fork 0
145 lines (123 loc) · 4.46 KB
/
ci.yml
File metadata and controls
145 lines (123 loc) · 4.46 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
name: CI
on:
push:
branches: [master]
pull_request:
env:
CARGO_TERM_COLOR: always
RUSTFLAGS: "-D warnings"
jobs:
# Linux runs the full battery: fmt, clippy, build, test, doc. The
# external cross-validation tests (e2fsck, mke2fs, sgdisk, qemu-img,
# …) only fire here because they need apt-supplied tools.
test-linux:
name: test (ubuntu)
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- name: Install system tools
run: |
sudo apt-get update
sudo apt-get install -y \
gdisk \
fdisk \
e2fsprogs \
genext2fs \
dosfstools \
mtools \
qemu-utils \
exfatprogs \
xfsprogs \
hfsprogs \
ntfs-3g \
f2fs-tools \
squashfs-tools \
libfuse3-dev \
pkg-config
# Sanity-check that everything we cross-validate against is on PATH.
which sgdisk
which fdisk
which e2fsck
which debugfs
which mke2fs
which genext2fs
which fsck.vfat
which mdir
which mtype
which qemu-img
# Newer FS validators — best-effort: log the binary name(s) we
# find, but don't fail the job if a package is missing on the
# runner. The per-FS tests skip when their tool is absent.
for tool in fsck.exfat mkfs.exfat xfs_repair xfs_db mkfs.xfs \
fsck.hfsplus newfs_hfsplus ntfsfix ntfsls ntfscat \
mkntfs fsck.f2fs mkfs.f2fs dump.f2fs \
unsquashfs mksquashfs; do
if command -v "$tool" >/dev/null 2>&1; then
echo "found: $tool ($(command -v "$tool"))"
else
echo "missing: $tool (test will skip)"
fi
done
- uses: dtolnay/rust-toolchain@stable
with:
components: rustfmt, clippy
- uses: Swatinem/rust-cache@v2
- name: cargo fmt --check
run: cargo fmt --all -- --check
- name: cargo clippy
run: cargo clippy --all-targets --all-features -- -D warnings
- name: cargo build
run: cargo build --all-targets --verbose
- name: cargo test
run: cargo test --all-targets --verbose
- name: cargo doc
run: cargo doc --no-deps --all-features
env:
RUSTDOCFLAGS: "-D warnings"
# macOS proves the lib + CLI compile and unit-test cleanly on a
# non-Linux Unix. `qemu-img` is available via Homebrew so the qcow2
# round-trip suite runs here too; sgdisk / e2fsck / mke2fs / mtools
# aren't packaged in stock Homebrew, so those tests skip themselves.
test-macos:
name: test (macos)
runs-on: macos-latest
steps:
- uses: actions/checkout@v6
- name: Install validators (qemu + squashfs-tools)
run: |
# ntfs-3g was removed from homebrew-core (deprecated upstream
# since 2022). Skip it on macOS; ntfs writer tests fall back
# to the skip path. APFS validation uses Apple's `hdiutil` +
# `fsck_apfs` which ship built-in; same for `fsck_hfs` /
# `newfs_hfs`. No exfat / xfs / f2fs Linux validators on
# macOS; those tests skip themselves.
brew install qemu squashfs
for tool in hdiutil fsck_apfs fsck_hfs newfs_hfs \
unsquashfs mksquashfs qemu-img; do
if command -v "$tool" >/dev/null 2>&1; then
echo "found: $tool ($(command -v "$tool"))"
else
echo "missing: $tool (test will skip)"
fi
done
- uses: dtolnay/rust-toolchain@stable
- uses: Swatinem/rust-cache@v2
- name: cargo build
run: cargo build --all-targets --verbose
- name: cargo test
run: cargo test --all-targets --verbose
# Windows proves the Unix-only paths in populate_from_host_dir /
# build_plan / file.rs are properly cfg-gated. Almost all external
# cross-validation tests skip here (their tools aren't on the runner),
# which is the contract: the in-process tests must still pass.
test-windows:
name: test (windows)
runs-on: windows-latest
steps:
- uses: actions/checkout@v6
- uses: dtolnay/rust-toolchain@stable
- uses: Swatinem/rust-cache@v2
- name: cargo build
run: cargo build --all-targets --verbose
- name: cargo test
run: cargo test --all-targets --verbose