Merge pull request #1150 from spkenv/dependabot/cargo/h2-0.3.26 #3027
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |