diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 1f49cf4..23fdf97 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -16,20 +16,22 @@ default: stages: - lint - cache-cleanup + - build-base - build - version - test -# TEMPLATE -.cargo-build: - stage: build - parallel: - matrix: - - FEATURES: - - xdg-mime-backend - - infer-backend - - multi-threaded xdg-mime-backend - - multi-threaded infer-backend +# TEMPLATES + +.cargo-cleanup: + stage: cache-cleanup + allow_failure: true + script: + - cargo install cargo-sweep + - cargo sweep -i + +.cargo-build-base: + stage: build-base only: refs: @@ -40,14 +42,21 @@ stages: - .gitlab-ci.yml script: - cargo build --no-default-features --locked --features="json $FEATURES" + 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 -.cargo-cleanup: - stage: cache-cleanup - allow_failure: true script: - - cargo install cargo-sweep - - cargo sweep -i + cargo build --no-default-features --locked --features="json $FEATURES" .cargo-test: extends: .cargo-build @@ -86,15 +95,40 @@ cleanup-nightly: - 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 build-stable: extends: .cargo-build - needs: ["cleanup-stable"] + needs: ["build-base-stable"] build-msrv: extends: build-stable - needs: ["cleanup-msrv"] + needs: ["build-base-msrv"] image: "rust:1.43.0" cache: key: msrv @@ -104,7 +138,7 @@ build-msrv: build-nightly: extends: build-stable - needs: ["cleanup-nightly"] + needs: ["build-base-nightly"] image: "rustlang/rust:nightly" cache: key: nightly