-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path.gitlab-ci.yml
More file actions
175 lines (154 loc) · 2.84 KB
/
.gitlab-ci.yml
File metadata and controls
175 lines (154 loc) · 2.84 KB
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
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
# SPDX-License-Identifier: PMPL-1.0-or-later
# Primary CI/CD - GitLab is the source of truth
stages:
- security
- lint
- test
- build
variables:
CARGO_HOME: ${CI_PROJECT_DIR}/.cargo
cache:
key: ${CI_COMMIT_REF_SLUG}
paths:
- .cargo/
- target/
# ==================
# Security Scanning
# ==================
trivy:
stage: security
image: aquasec/trivy:latest
script:
- trivy fs --exit-code 0 --severity HIGH,CRITICAL --format table .
- trivy fs --exit-code 1 --severity CRITICAL .
allow_failure: false
gitleaks:
stage: security
image: zricethezav/gitleaks:latest
script:
- gitleaks detect --source . --verbose --redact
allow_failure: false
semgrep:
stage: security
image: returntocorp/semgrep
script:
- semgrep --config auto --error .
allow_failure: true
cargo-audit:
stage: security
image: rust:latest
script:
- cargo install cargo-audit
- cargo audit
rules:
- exists:
- Cargo.toml
cargo-deny:
stage: security
image: rust:latest
script:
- cargo install cargo-deny
- cargo deny check
rules:
- exists:
- Cargo.toml
allow_failure: true
mix-audit:
stage: security
image: elixir:latest
script:
- mix local.hex --force
- mix archive.install hex mix_audit --force
- mix deps.get
- mix deps.audit
rules:
- exists:
- mix.exs
allow_failure: true
# ==================
# Linting
# ==================
rustfmt:
stage: lint
image: rust:latest
script:
- rustup component add rustfmt
- cargo fmt -- --check
rules:
- exists:
- Cargo.toml
clippy:
stage: lint
image: rust:latest
script:
- rustup component add clippy
- cargo clippy -- -D warnings
rules:
- exists:
- Cargo.toml
allow_failure: true
mix-format:
stage: lint
image: elixir:latest
script:
- mix format --check-formatted
rules:
- exists:
- mix.exs
credo:
stage: lint
image: elixir:latest
script:
- mix local.hex --force
- mix deps.get
- mix credo --strict
rules:
- exists:
- mix.exs
allow_failure: true
# ==================
# Testing
# ==================
cargo-test:
stage: test
image: rust:latest
script:
- cargo test --all-features
rules:
- exists:
- Cargo.toml
mix-test:
stage: test
image: elixir:latest
script:
- mix local.hex --force
- mix deps.get
- mix test
rules:
- exists:
- mix.exs
# ==================
# Build
# ==================
cargo-build:
stage: build
image: rust:latest
script:
- cargo build --release
artifacts:
paths:
- target/release/
expire_in: 1 week
rules:
- exists:
- Cargo.toml
mix-build:
stage: build
image: elixir:latest
script:
- mix local.hex --force
- mix deps.get
- MIX_ENV=prod mix compile
rules:
- exists:
- mix.exs