-
Notifications
You must be signed in to change notification settings - Fork 0
/
.gitlab-ci.yml
90 lines (80 loc) · 1.67 KB
/
.gitlab-ci.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
image: "rust:latest"
variables:
CARGO_HOME: $CI_PROJECT_DIR/.cargo
CARGO_INSTALL_ROOT: $CI_PROJECT_DIR/.cargo
POSTGRES_HOST_AUTH_METHOD: trust
cache: &global_cache
key: $CI_COMMIT_REF_SLUG
paths:
- .cargo
- target
stages:
- build
- test
- release
build:
stage: build
cache:
<<: *global_cache
script:
- cargo build --workspace
- cargo build --tests
sqlx-schema:
stage: test
cache:
<<: *global_cache
services:
- name: timescale/timescaledb-ha:pg16
alias: postgres
variables:
DATABASE_URL: postgres://postgres@postgres:5432/nginx_logs
script:
- cargo install sqlx-cli
- ./scripts/init_db
- cargo sqlx prepare --check -- --lib
cargo-test:
stage: test
cache:
<<: *global_cache
services:
- name: timescale/timescaledb-ha:pg16
alias: postgres
variables:
DATABASE_URL: postgres://postgres@postgres:5432/nginx_logs
script:
- ./scripts/init_db
- cargo test --workspace
cargo-clippy:
stage: test
cache:
<<: *global_cache
script:
- rustup component add clippy
- cargo clippy -- -D warnings
cargo-fmt:
stage: test
cache:
<<: *global_cache
script:
- rustup component add rustfmt
- cargo fmt -- --check
docker-image:
only:
- main
stage: release
image: docker:latest
services:
- docker:dind
script:
- docker login -u "$CI_REGISTRY_USER" -p "$CI_REGISTRY_PASSWORD" $CI_REGISTRY
- docker build --pull -t "$CI_REGISTRY_IMAGE" .
- docker push "$CI_REGISTRY_IMAGE"
cargo-release:
only:
- main
stage: release
script:
- cargo build --workspace --release
artifacts:
paths:
- target/release/nginx-syslog-postgres-bridge