-
Notifications
You must be signed in to change notification settings - Fork 6
113 lines (108 loc) · 4.09 KB
/
rust.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
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
name: Rust
on:
workflow_dispatch:
pull_request:
push:
branches: [main]
env:
CARGO_TERM_COLOR: always
jobs:
build-windows:
name: Windows Build
runs-on: windows-latest
steps:
- name: Cancel Previous Runs
uses: styfle/[email protected]
- uses: actions/checkout@v2
- uses: actions-rs/toolchain@v1
with:
toolchain: 1.82.0
target: x86_64-pc-windows-gnu
override: true
- name: Prepare VM
uses: crazy-max/ghaction-chocolatey@v3
with:
args: install protoc llvm winfsp make
- name: Install FlatBuffers Compiler
run: |
$url = "https://github.com/google/flatbuffers/releases/download/v23.5.26/Windows.flatc.binary.zip"
Invoke-WebRequest $url -OutFile C:\flatc.zip
Expand-Archive C:\flatc.zip -DestinationPath C:\Windows
- name: Install Debug SPFS
run: |
make install-debug-spfs
build-and-test:
name: Linux Build and Test
runs-on: ubuntu-latest
timeout-minutes: 45
container:
image: rust:1.82.0
options: --security-opt seccomp=unconfined --privileged
env:
# Disable cnproc because we're in a container
SPFS_MONITOR_DISABLE_CNPROC: "1"
# Define a local origin repo for tests to use
SPFS_REMOTE_origin_ADDRESS: "file:///tmp/spfs-repos/origin"
SPFS_SUPPRESS_OVERLAYFS_PARAMS_WARNING: "1"
# Enable sccache for rust
SCCACHE_GHA_ENABLED: "true"
RUSTC_WRAPPER: "sccache"
steps:
- name: Cancel Previous Runs
uses: styfle/[email protected]
- uses: actions/checkout@v2
- name: Prepare Container
run: |
apt-get update
apt-get install -y libcap2-bin sudo cmake tcsh rsync protobuf-compiler fuse libfuse-dev
# spfs-fuse requires this option enabled
echo user_allow_other >> /etc/fuse.conf
FB_REL=https://github.com/google/flatbuffers/releases/
curl --proto '=https' --tlsv1.2 -sSfL ${FB_REL}/download/v23.5.26/Linux.flatc.binary.g++-10.zip | funzip > /usr/bin/flatc
chmod +x /usr/bin/flatc
rustup install nightly
rustup component add clippy
rustup component add rustfmt --toolchain nightly
- name: Configure cargo
run: |
mkdir -p .cargo
cat << EOF > .cargo/config.toml
[build]
# Disable incremental compilation to lower disk usage, and sccache
# can't cache incremental compiles.
incremental = false
[profile.dev]
# Disable debug information to lower disk usage.
debug = false
EOF
- name: Run sccache-cache
uses: mozilla-actions/[email protected]
# Use the same FEATURES in these different steps to avoid recompiling
# as much as possible. Consider using a separate workflow with its own
# cache if there is a need to test building with a different set of
# features enabled.
- name: Build
run: make debug FEATURES=server,spfs/server
- name: Install Debug Binaries
run: make install-debug-spfs FEATURES=server,spfs/server
- name: Setup a local origin repo
run: SPFS_REMOTE_origin_ADDRESS="${SPFS_REMOTE_origin_ADDRESS}?create=true" spfs ls-tags -r origin
# Run test before lint, lint takes a while and it is useful to know that
# the tests are failing before knowing if the lints are passing.
- name: Run Unit Tests
run: make test FEATURES=server,spfs/server
- name: Lint
run: make lint FEATURES=server,spfs/server
- name: Lint Package Specs
run: |
export PATH="$PWD/target/debug:$PATH"
make packages.lint
- name: SPFS Integration Tests - Regular User
run: |
# Run tests as a normal user to verify privilege escalation
useradd -m e2e
su e2e -c crates/spfs/tests/integration/run_tests.sh
- name: SPFS Integration Tests - Root User
run: |
# Run tests that need root
crates/spfs/tests/integration/run_privileged_tests.sh