-
Notifications
You must be signed in to change notification settings - Fork 19
85 lines (72 loc) · 2.39 KB
/
build.yml
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
name: Build
on: [push, pull_request]
env:
CARGO_TERM_COLOR: always
jobs:
build:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-22.04, windows-2022, macos-13, macos-14]
steps:
- uses: actions/checkout@v4
- name: Build
run: cargo build --verbose --all-targets
- name: Run tests
run: cargo test --verbose
if: runner.os != 'macOS'
- name: Run tests (macos)
run: sudo "PATH=$PATH" cargo test --verbose
if: runner.os == 'macOS'
build-freebsd:
name: build (FreeBSD)
runs-on: ubuntu-22.04
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Install Rust
uses: dtolnay/rust-toolchain@984d158d699777abbaa79de23de3134e60c187fa # stable branch
- name: Cross-compile crate
run: |
wget -q -O cross https://github.com/acj/freebsd-firecracker/releases/download/v0.0.10/cross
chmod +x cross
mv cross /usr/local/bin/cross
cross build --release --target x86_64-unknown-freebsd
cross test --release --no-run --target x86_64-unknown-freebsd
- name: Launch Firecracker VM
uses: acj/[email protected]
with:
verbose: false
pre-run: |
rm -rf .cargo
ln -s $HOME/.cargo .cargo
include_path="$(mktemp)"
cat <<EOF > $include_path
target
target/x86_64-unknown-freebsd
target/x86_64-unknown-freebsd/release
target/x86_64-unknown-freebsd/release/deps
target/x86_64-unknown-freebsd/release/deps/read_process_memory-*
target/x86_64-unknown-freebsd/release/test
EOF
rsync -r -e "ssh" \
--relative \
--copy-links \
--include-from "$include_path" \
--exclude "*" \
. firecracker:
rm -f "$exclude_path"
run-in-vm: |
mkdir -p /home/runner
ln -s $(pwd)/.cargo /home/runner/.cargo
failed=0
for testbin in $(find target/x86_64-unknown-freebsd/release/deps -type f -perm -u+x ! -name "*.d" -print); do
if ! $testbin; then
failed=1
fi
done
if [ $failed -ne 0 ]; then
exit 1
fi
post-run: ""