image: "toru3/rust:latest"
test:
stage: test
script:
- rustup default "$RUST_VERSION"
- if [ "${DISABLE_CACHE:-false}" = "false" ]; then
- export CARGO_HOME="$CI_PROJECT_DIR/cargo"
- mkdir -p $CARGO_HOME target_cache
- ln -s /usr/local/cargo/bin $CARGO_HOME/bin
- ln -s /usr/local/cargo/env $CARGO_HOME/env
- ln -s target_cache target
- fi
- rustup --version && cargo --version
- if [ "${USE_MINIMAL_VERSIONS:-false}" = "false" ]; then
- time cargo +nightly update
- else
- time cargo +nightly update -Z minimal-versions
- fi
- cargo fetch - cargo fmt --all --check --verbose - cargo clippy --workspace --all-targets $FEATURES -- -D warnings
- cargo test --workspace $FEATURES
cache:
- key: "crates.io-${USE_MINIMAL_VERSIONS}"
paths:
- cargo/bin/
- cargo/registry/index/
- cargo/registry/cache/
- cargo/git/db/
- key: "target-${RUST_VERSION}"
paths:
- target_cache/
artifacts:
when: always
paths:
- lib.xml
- doc.xml
reports:
junit:
- lib.xml
- doc.xml
variables:
CARGO_UNSTABLE_SPARSE_REGISTRY: "true"
CARGO_REGISTRIES_CRATES_IO_PROTOCOL: "sparse"
parallel:
matrix:
- RUST_VERSION:
- "stable"
- "beta"
- "1.69.0" USE_MINIMAL_VERSIONS:
- "false"
- "true"
FEATURES:
- "--all-features"