-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path.gitlab-ci.yml
More file actions
89 lines (77 loc) · 2.07 KB
/
.gitlab-ci.yml
File metadata and controls
89 lines (77 loc) · 2.07 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
image: rust:latest
variables:
DATABASE_URL: "sqlite://discord_bot.db"
CARGO_HOME: "./cargo_home"
workflow:
rules:
- if: '$CI_PIPELINE_SOURCE == "merge_request_event" && $CI_MERGE_REQUEST_TITLE =~ /^(\[Draft\]|\(Draft\)|Draft:)/'
when: never
default:
cache:
- key: $CI_COMMIT_REF_SLUG
paths:
- target
# https://doc.rust-lang.org/cargo/guide/cargo-home.html#caching-the-cargo-home-in-ci
- cargo_home/.crates.toml
- cargo_home/.crates2.json
- cargo_home/bin/
- cargo_home/registry/index/
- cargo_home/registry/cache/
- cargo_home/git/db/
stages:
- check
#- build
#- deploy
before_script:
- apt update -qy
#- apt install cmake sqlite3 aria2 -qy
- apt install cmake aria2 -qy
- aria2c -d binstall "https://github.com/cargo-bins/cargo-binstall/releases/latest/download//cargo-binstall-x86_64-unknown-linux-gnu.full.tgz"
- tar -xf binstall/cargo-binstall-x86_64-unknown-linux-gnu.full.tgz -C binstall
#- ./binstall/cargo-binstall -y sqlx-cli
# binstall varsion fails to create database
- cargo install sqlx-cli --no-default-features --features "sqlite"
- ./cargo_home/bin/sqlx database setup
clean_target:
stage: .pre
rules:
- changes:
- Cargo.toml
- Cargo.lock
script:
- cargo clean
format:
stage: check
rules:
- if: $CI_PIPELINE_SOURCE == 'merge_request_event'
#- if: $CI_COMMIT_TAG
variables:
RUSTFLAGS: "-Dwarnings"
script:
- cargo fmt --check
clippy:
stage: check
rules:
- if: $CI_PIPELINE_SOURCE == 'merge_request_event'
#- if: $CI_COMMIT_TAG
variables:
RUSTFLAGS: "-Dwarnings"
script:
- rustup component add clippy
- cargo clippy --all-targets --all-features
features:
stage: check
rules:
- if: $CI_PIPELINE_SOURCE == 'merge_request_event'
#- if: $CI_COMMIT_TAG
variables:
RUSTFLAGS: "-Dwarnings"
script:
- ./binstall/cargo-binstall -y cargo-all-features
- cargo check-all-features
#build:
# stage: build
# rules:
# - if: $CI_COMMIT_TAG
# scripts:
# - cargo build --release