mailApp/.gitlab-ci.yml

50 lines
1.0 KiB
YAML
Raw Normal View History

2023-08-29 18:16:49 +10:00
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"
2023-08-29 18:16:49 +10:00
stages:
- format
2023-08-29 18:16:49 +10:00
- test
format-code:
stage: format
script:
- cargo fmt -- --check
postgres-service:
2023-08-29 18:16:49 +10:00
stage: test
services:
- postgres:15-alpine
variables:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: password
POSTGRES_DB: newsletter
POSTGRES_HOST: postgres
2023-09-04 22:06:28 +10:00
POSTGRES_PORT: 5432
2023-08-29 18:16:49 +10:00
script:
- SKIP_DOCKER=true ./scripts/init_db.sh # Migrate DB
2023-08-29 18:16:49 +10:00
test-code:
2023-08-29 18:16:49 +10:00
stage: test
needs: ["postgres-service"]
2023-08-29 18:16:49 +10:00
script:
- export DATABASE_URL="postgres://postgres:password@postgres:5432/newsletter" cargo test
lint-code:
2023-08-29 18:16:49 +10:00
stage: test
needs: ["postgres-service"]
2023-08-29 18:16:49 +10:00
script:
- DATABASE_URL="postgres://postgres:password@postgres:5432/newsletter" cargo clippy -- -D warnings