-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy path.gitlab-ci.yml
68 lines (59 loc) · 1.22 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
.test_cache: &test_cache
cache:
- key: "$CI_COMMIT_REF_SLUG"
paths:
- target/debug
.rust_build: &rust_build
image: "ars9/rust:postgres"
before_script:
- rustc --version
- cargo --version
services:
- postgres:15-alpine
variables:
POSTGRES_HOST: postgres
POSTGRES_DB: indexer
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
POSTGRES_HOST_AUTH_METHOD: trust
DATABASE_URL: postgres://${POSTGRES_USER}:${POSTGRES_PASSWORD}@${POSTGRES_HOST}:5432/${POSTGRES_DB}
CARGO_HOME: "/cache/cargo/"
stages:
- test
- build
- deploy
test-code:
<<: *rust_build
<<: *test_cache
stage: test
before_script:
- "sed -i 's/host: \"localhost\"/host: \"postgres\"/' configuration.yaml"
script:
- cargo test
- cargo tarpaulin --ignore-tests
lint-code:
<<: *rust_build
<<: *test_cache
stage: test
script:
- cargo clippy -- -D warnings
format-code:
<<: *rust_build
<<: *test_cache
stage: test
script:
- cargo fmt -- --check
## Temporarily disabled due to ansi_term vulnerability
# audit-code:
# <<: *rust_build
# <<: *test_cache
# stage: test
# script:
# - cargo audit
publish:
<<: *rust_build
stage: build
script:
- cargo publish
only:
- tags