ci: remove nix

This commit is contained in:
Matthew LeVan 2024-02-07 11:04:08 -05:00
parent e6890a3c74
commit ff0c1d05b0

View File

@ -15,52 +15,32 @@ jobs:
steps: steps:
- uses: actions/checkout@v3 - uses: actions/checkout@v3
# Determine proper nix platform attribute for runner # Install Rust
- name: Determine Nix platform - name: Install Rust
id: set-nix-platform uses: actions-rs/toolchain@v1
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
with: with:
extra_nix_config: "extra-experimental-features = nix-command flakes" profile: minimal
toolchain: stable
- name: Set cache key for dev env override: true
id: set-cache-key
run: | # Cache Rust build artifacts
echo "Determining devshell path for platform ${{ steps.set-nix-platform.outputs.nix-arch }}" - name: Cache Rust build artifacts
echo "nix-devshell-path=$(nix eval --raw ".#devShells.${{ steps.set-nix-platform.outputs.nix-arch }}.default.outPath")" >> $GITHUB_OUTPUT uses: actions/cache@v2
- name: Cache nix build artifacts
id: nix-cache
uses: actions/cache@v3
with: with:
path: | path: |
nix-devshell.nixstore ~/.cargo/bin/
key: nix-${{ steps.set-cache-key.outputs.nix-devshell-path }} ~/.cargo/registry/index/
~/.cargo/registry/cache/
- name: Restore cached nix artifacts ~/.cargo/git/db/
if: steps.nix-cache.outputs.cache-hit == 'true' target/
working-directory: . key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
run: | restore-keys: |
pwd ${{ runner.os }}-cargo-
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"
# Check formatting # Check formatting
- name: Format - name: Format
run: | run: |
nix develop --command bash -c "cargo fmt --check" cargo fmt --check
# See clippy linter docs: https://github.com/rust-lang/rust-clippy # 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 # XX TODO make a script with all the flags for the linter
- name: Lint - name: Lint
run: | 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 # Build Ares
- name: Build - name: Build
run: | run: |
nix develop --command bash -c "cargo build --release --verbose" cargo build --release --verbose
# Run tests # Run tests
- name: Test - name: Test
run: | run: |
nix develop --command bash -c "cargo test --verbose -- --test-threads=1" 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