Quickly update CI to incorporate postgres DB
This commit is contained in:
parent
679e257f7b
commit
6322ed3f5f
@ -1,23 +1,49 @@
|
|||||||
image: "registry.nickbland.dev/nickbland/rust-docker-ci:latest"
|
|
||||||
|
|
||||||
default:
|
default:
|
||||||
before_script:
|
before_script:
|
||||||
- rustc --version && cargo --version
|
- 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:
|
stages:
|
||||||
|
- format
|
||||||
- test
|
- 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:
|
test-code:
|
||||||
stage: test
|
stage: test
|
||||||
|
needs: ["postgres-service"]
|
||||||
script:
|
script:
|
||||||
- cargo test --verbose
|
- export DATABASE_URL="postgres://postgres:password@postgres:5432/newsletter" cargo test
|
||||||
|
|
||||||
lint-code:
|
lint-code:
|
||||||
stage: test
|
stage: test
|
||||||
|
needs: ["postgres-service"]
|
||||||
script:
|
script:
|
||||||
- cargo clippy -- -D warnings
|
- DATABASE_URL="postgres://postgres:password@postgres:5432/newsletter" cargo clippy -- -D warnings
|
||||||
|
|
||||||
format-code:
|
|
||||||
stage: test
|
|
||||||
script:
|
|
||||||
- cargo fmt -- --check
|
|
Loading…
Reference in New Issue
Block a user