on: workflow_call: env: CARGO_TERM_COLOR: always ACTIONS_ALLOW_UNSECURE_COMMANDS: "true" defaults: run: working-directory: rust/ares jobs: build: runs-on: 'ubuntu-latest' steps: - uses: actions/checkout@v3 # Install nix, required by nix-shell-action - uses: cachix/install-nix-action@v23 name: Install Nix with: extra_nix_config: "extra-experimental-features = nix-command flakes" - name: Set cache key for dev env run: export ARES_NIX_DEVSHELL_PATH=$(nix eval --raw ".#devShells.x86_64-linux.default.outPath") - name: Cache rust build artifacts id: cache_rust uses: Swatinem/rust-cache@v2 with: env-vars: "CARGO CC CFLAGX CXX CMAKE RUST ARES" workspaces: "rust/ares -> target" # Check formatting - name: Format run: | nix develop --command bash -c "cargo fmt --check" # See clippy linter docs: https://github.com/rust-lang/rust-clippy # # First linter is set to fail for all warnings, then ignored warnings are # explicitly listed # # XX TODO make a script with all the flags for the linter - name: Lint run: | nix develop --command bash -c "cargo clippy --all-targets --no-deps -- -D warnings -A clippy::missing_safety_doc" # Build Ares - name: Build run: | nix develop --command bash -c "cargo build --release --verbose --features check_all" # Run tests - name: Test run: | nix develop --command bash -c "cargo test --verbose -- --test-threads=1"