diff --git a/.github/workflows/ares-shared.yml b/.github/workflows/ares-shared.yml index 244017e..7c033f9 100644 --- a/.github/workflows/ares-shared.yml +++ b/.github/workflows/ares-shared.yml @@ -15,52 +15,32 @@ jobs: steps: - uses: actions/checkout@v3 - # Determine proper nix platform attribute for runner - - name: Determine Nix platform - id: set-nix-platform - working-directory: . - run: - .github/scripts/arch/get-runner-arch ${{ runner.arch }} ${{ runner.os }} > $GITHUB_OUTPUT - - # Install nix, required by nix-shell-action - - uses: cachix/install-nix-action@v23 - name: Install Nix + # Install Rust + - name: Install Rust + uses: actions-rs/toolchain@v1 with: - extra_nix_config: "extra-experimental-features = nix-command flakes" - - - name: Set cache key for dev env - id: set-cache-key - run: | - echo "Determining devshell path for platform ${{ steps.set-nix-platform.outputs.nix-arch }}" - echo "nix-devshell-path=$(nix eval --raw ".#devShells.${{ steps.set-nix-platform.outputs.nix-arch }}.default.outPath")" >> $GITHUB_OUTPUT - - - name: Cache nix build artifacts - id: nix-cache - uses: actions/cache@v3 + profile: minimal + toolchain: stable + override: true + + # Cache Rust build artifacts + - name: Cache Rust build artifacts + uses: actions/cache@v2 with: path: | - nix-devshell.nixstore - key: nix-${{ steps.set-cache-key.outputs.nix-devshell-path }} - - - name: Restore cached nix artifacts - if: steps.nix-cache.outputs.cache-hit == 'true' - working-directory: . - run: | - pwd - ls - nix-store --import < nix-devshell.nixstore - - - name: Cache rust build artifacts - id: cache_rust - uses: Swatinem/rust-cache@v2 - with: - key: rust-${{ steps.set-cache-key.outputs.nix-devshell-path }} - workspaces: "rust/ares -> target" + ~/.cargo/bin/ + ~/.cargo/registry/index/ + ~/.cargo/registry/cache/ + ~/.cargo/git/db/ + target/ + key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} + restore-keys: | + ${{ runner.os }}-cargo- # Check formatting - name: Format run: | - nix develop --command bash -c "cargo fmt --check" + cargo fmt --check # See clippy linter docs: https://github.com/rust-lang/rust-clippy # @@ -70,24 +50,14 @@ jobs: # 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" + 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" + cargo build --release --verbose # Run tests - name: Test run: | - nix develop --command bash -c "cargo test --verbose -- --test-threads=1" - - - name: Build nix cache export - if: steps.nix-cache.outputs.cache-hit != 'true' - run: | - pwd - nix eval --json ".#devShells.${{ steps.set-nix-platform.outputs.nix-arch }}.default.buildInputs" 2>/dev/null - nix eval --json ".#devShells.${{ steps.set-nix-platform.outputs.nix-arch }}.default.buildInputs" 2>/dev/null | jq -r '.[]' | xargs nix-store --query --requisites - nix-store --export $(nix eval --json ".#devShells.${{ steps.set-nix-platform.outputs.nix-arch }}.default.buildInputs" 2>/dev/null | jq -r '.[]' | xargs nix-store --query --requisites) > ../../nix-devshell.nixstore - ls -lh - + cargo test --verbose -- --test-threads=1