-
Notifications
You must be signed in to change notification settings - Fork 0
/
.gitlab-ci.yml
73 lines (63 loc) · 3.07 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
# nightly image suggested at https://doc.rust-lang.org/cargo/guide/continuous-integration.html#gitlab-ci
image: "rustlang/rust:nightly"
variables:
CARGO_HOME: $CI_PROJECT_DIR/cargo
# Deny warns here as a catch-all and because some commands (e.g. cargo build) don't accept `--deny warnings`
# but also deny them on all individual cargo invocations where applicable because:
# 1) Some commands might not support rustflags (e.g. clippy didn't at first, cargo doc uses a different var, ...)
# 2) People (or me) might copy paste the commands into CI where this flag is missing without noticing.
RUSTFLAGS: --deny warnings
before_script:
# cmake is needed for cargo audit
- apt-get update && apt-get -y install cmake graphviz
tests:
#cache:
# paths:
# - cargo/
# - target/
script:
- rustc --version && cargo --version
# normal
- cargo build --verbose
- cargo build --verbose --release
- cargo test --all --verbose
- cargo test --all --verbose --release
- cargo bench --verbose --no-run # make sure benches compile
# with graph
- cargo build --features graph --verbose
- cargo build --features graph --verbose --release
- cargo run --features graph -- levels/custom/04-two-boxes-no-packing.txt
- test -f state-space.dot.png # -f == regular file exists (yes, i actively (if that's even possible) refuse to remember this)
rustfmt:
script:
- rustup component add rustfmt
- cargo fmt -- --check # formats all features
allow_failure: true
clippy:
script:
- rustup component add clippy
# Use --all-targets to also check tests.
# Note that --all-features doesn't check all code when something is *disabled* by a feature.
- cargo clippy --all-targets --all-features -- --deny warnings
# No fixmes allowed - they're to be fixed before committing
# or at least before merging to master so they can be used
# during development for things that must not be forgotten
# and grep's output is not littered with other people's fixmes.
#
# Grep returns success when found and failure when not found, `!` inverts success/failure.
# The `[F]` is the usual trick to avoid matching this line itself
# without excluding this whole file so it's still checked.
#
# Gitlab CI uses `./cargo`, ignore it.
- "! ( grep --recursive --exclude-dir=cargo --exclude-dir=target [F]IXME . && echo 'The lines above this message must be fixed (or marked as todo/later in uppercase, not fixme)' )"
allow_failure: true
audit:
script:
# --debug is faster
# Need --force when using cache because there's no --update (https://github.com/rust-lang/cargo/issues/6797)
- cargo install --debug cargo-audit #--force
# Yanking only gives a warn and most crates probably don't bother reporting vulns properly.
# RUSTSEC-2021-0127: serde_cbor is unmaintained - https://github.com/bheisler/criterion.rs/issues/534
# RUSTSEC-2021-0145: atty - Potential unaligned read - waiting on criterion to update
- cargo audit --deny warnings --ignore RUSTSEC-2021-0127 --ignore RUSTSEC-2021-0145
allow_failure: true