default: before_script: - rustc --version && cargo --version image: "registry.nickbland.dev/nickbland/rust-docker-ci:latest" cache: key: files: - Cargo.lock paths: - .cargo/ - target/ policy: pull-push variables: FF_USE_FASTZIP: "true" CACHE_COMPRESSION_LEVEL: "fastest" stages: - format - test format-code: stage: format script: - cargo fmt -- --check postgres-service: stage: test services: - postgres:15-alpine variables: POSTGRES_USER: postgres POSTGRES_PASSWORD: password POSTGRES_DB: newsletter POSTGRES_HOST: postgres script: - SKIP_DOCKER=true ./scripts/init_db.sh # Migrate DB test-code: stage: test needs: ["postgres-service"] script: - export DATABASE_URL="postgres://postgres:password@postgres:5432/newsletter" cargo test lint-code: stage: test needs: ["postgres-service"] script: - DATABASE_URL="postgres://postgres:password@postgres:5432/newsletter" cargo clippy -- -D warnings