-
-
Notifications
You must be signed in to change notification settings - Fork 46
Expand file tree
/
Copy path.gitlab-ci.yml
More file actions
100 lines (90 loc) · 1.82 KB
/
.gitlab-ci.yml
File metadata and controls
100 lines (90 loc) · 1.82 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
# GitLab CI/CD Pipeline for wrkflw
# This pipeline will build and test the Rust project
stages:
- build
- test
- deploy
variables:
RUST_VERSION: "1.70.0"
CARGO_TERM_COLOR: always
# Cache settings
cache:
key: "$CI_COMMIT_REF_SLUG"
paths:
- target/
script:
- echo "This is a placeholder - the cache directive doesn't need a script"
# Lint job - runs rustfmt and clippy
lint:
stage: test
image: rust:${RUST_VERSION}
script:
- rustup component add clippy
- cargo clippy -- -D warnings
allow_failure: true
# Build job - builds the application
build:
stage: build
image: rust:${RUST_VERSION}
script:
- cargo build --verbose
artifacts:
paths:
- target/debug
expire_in: 1 week
# Test job - runs unit and integration tests
test:
stage: test
image: rust:${RUST_VERSION}
script:
- cargo test --verbose
dependencies:
- build
# Release job - creates a release build
release:
stage: deploy
image: rust:${RUST_VERSION}
script:
- cargo build --release --verbose
artifacts:
paths:
- target/release/wrkflw
expire_in: 1 month
rules:
- if: $CI_PIPELINE_SOURCE == "web" && $BUILD_RELEASE == "true"
when: always
- if: $CI_COMMIT_TAG
when: always
- when: never
# Custom job for documentation
docs:
stage: deploy
image: rust:${RUST_VERSION}
script:
- cargo doc --no-deps
- mkdir -p public
- cp -r target/doc/* public/
artifacts:
paths:
- public
only:
- main
format:
stage: test
image: rust:${RUST_VERSION}
script:
- rustup component add rustfmt
- cargo fmt --check
allow_failure: true
pages:
stage: deploy
image: rust:${RUST_VERSION}
script:
- cargo doc --no-deps
- mkdir -p public
- cp -r target/doc/* public/
artifacts:
paths:
- public
only:
- main