when:
- event: ["push", "pull_request"]
branch: master
paths:
- knotmirror/crates/**
- knot2/crates/**
- bobbin/crates/knot-proxy/**
- bobbin/crates/runtime/**
- crates/**
- lexicons/**
- Cargo.toml
- Cargo.lock
- rust-toolchain.toml
- .tangled/workflows/rust-test-knotmirror.yml
engine: microvm
image: nixos-large
dependencies:
- gcc
- gnumake
- cmake
- perl
- git
- "github:nix-community/fenix/f6670530f53e69cc284f7aef818eb0f08fe81905#stable.minimalToolchain"
services:
postgresql:
enable: true
ensureDatabases: ["spindle-workflow"]
ensureUsers:
- name: spindle-workflow
ensureDBOwnership: true
# each test makes its own database
ensureClauses:
createdb: true
environment:
CARGO_HOME: /workspace/repo/.cache/cargo
CARGO_INCREMENTAL: "0"
# cargo's built-in git client takes 10 minutes to clone jacquard here
CARGO_NET_GIT_FETCH_WITH_CLI: "true"
CARGO_PROFILE_DEV_DEBUG: "0"
CARGO_PROFILE_TEST_DEBUG: "0"
RUST_BACKTRACE: "1"
KNOTMIRROR_TEST_DATABASE_URL: "postgres://spindle-workflow@localhost/spindle-workflow?host=/run/postgresql"
cache:
- key: cargo-knotmirror
hash:
- Cargo.lock
fallback: true
when: always
paths:
- .cache/cargo/registry/index
- .cache/cargo/registry/cache
- target
steps:
- name: knotmirror tests
command: |
cargo test --locked -p 'knotmirror*'
- name: drop test executables before caching
command: |
find target/debug/deps -maxdepth 1 -type f -perm -u+x ! -name '*.so' -delete