fif/.gitlab-ci.yml

195 lines
3 KiB
YAML
Raw Normal View History

2021-04-21 07:06:56 +00:00
image: "rust:latest"
variables:
CARGO_HOME: $CI_PROJECT_DIR/.cargo
cache:
paths:
- target
- .cargo
2021-04-21 07:06:56 +00:00
default:
before_script:
- rustc --version
- cargo version
2021-04-21 07:06:56 +00:00
2021-04-21 06:57:57 +00:00
stages:
- lint
- cache-cleanup
- build-base
2021-04-21 06:57:57 +00:00
- build
- version
- test
2021-04-21 06:57:57 +00:00
# TEMPLATES
.cargo-cleanup:
stage: cache-cleanup
allow_failure: true
2021-05-07 16:50:23 +00:00
only:
refs:
- branches
- tags
changes:
- "/src/**/*"
- .gitlab-ci.yml
script:
- cargo install cargo-sweep
- cargo sweep -i
.cargo-build-base:
stage: build-base
2021-04-28 13:52:42 +00:00
only:
refs:
- branches
- tags
changes:
- "/src/**/*"
- .gitlab-ci.yml
script:
cargo build --locked
.cargo-build:
extends: .cargo-build-base
stage: build
parallel:
matrix:
- FEATURES:
- xdg-mime-backend
- infer-backend
- multi-threaded xdg-mime-backend
- multi-threaded infer-backend
script:
cargo build --no-default-features --locked --features="json $FEATURES"
.cargo-test:
2021-04-28 13:52:42 +00:00
extends: .cargo-build
stage: test
script:
2021-05-05 22:57:42 +00:00
cargo test --no-default-features --locked --verbose --features="json $FEATURES"
# LINT
clippy:
stage: lint
2021-05-07 16:50:23 +00:00
only:
refs:
- branches
- tags
changes:
- "/src/**/*"
- .gitlab-ci.yml
script:
- rustup component add clippy
- cargo clippy --version
- ./clippy.sh ci
# CACHE CLEANUP
cleanup-stable:
extends: .cargo-cleanup
cleanup-msrv:
extends: cleanup-stable
image: "rust:1.43.0"
cache:
key: msrv
paths:
- target
- .cargo
cleanup-nightly:
extends: cleanup-stable
image: "rustlang/rust:nightly"
cache:
key: nightly
paths:
- target
- .cargo
# BUILD BASE
build-base-stable:
extends: .cargo-build-base
needs: ["cleanup-stable"]
build-base-msrv:
extends: build-base-stable
needs: ["cleanup-msrv"]
image: "rust:1.43.0"
cache:
key: msrv
paths:
- target
- .cargo
build-base-nightly:
extends: build-base-stable
needs: ["cleanup-nightly"]
image: "rustlang/rust:nightly"
cache:
key: nightly
paths:
- target
- .cargo
# BUILD
2021-04-21 07:06:56 +00:00
build-stable:
extends: .cargo-build
needs: ["build-base-stable"]
build-msrv:
extends: build-stable
needs: ["build-base-msrv"]
image: "rust:1.43.0"
cache:
key: msrv
paths:
- target
- .cargo
2021-04-21 07:06:56 +00:00
build-nightly:
extends: build-stable
needs: ["build-base-nightly"]
image: "rustlang/rust:nightly"
cache:
key: nightly
paths:
- target
- .cargo
# VERSION
fif-version:
stage: version
needs: ["build-stable"]
script:
cargo run -- -V
# TEST
test-stable:
extends: .cargo-test
needs: ["build-stable"]
test-msrv:
extends: test-stable
image: "rust:1.43.0"
needs: ["build-msrv"]
cache:
key: msrv
paths:
- target
- .cargo
test-nightly:
extends: test-stable
image: "rustlang/rust:nightly"
needs: ["build-nightly"]
cache:
key: nightly
paths:
- target
- .cargo