ci: define the dependencies between jobs

This means that jobs can start the moment they are ready, instead
of waiting for the previous stage to finish.

Also define their interruptibility so new pipelines can automatically
cancel the previous ones.

https://docs.gitlab.com/ee/ci/yaml/index.html#needs
This commit is contained in:
Jordan Petridis 2022-05-18 20:03:00 +03:00
parent 7075a4b3ea
commit 9d873d6755

View file

@ -36,6 +36,9 @@ workflow:
- if: $CI_COMMIT_TAG - if: $CI_COMMIT_TAG
- if: $CI_COMMIT_BRANCH - if: $CI_COMMIT_BRANCH
default:
interruptible: true
variables: variables:
FDO_UPSTREAM_REPO: gstreamer/gstreamer-rs FDO_UPSTREAM_REPO: gstreamer/gstreamer-rs
@ -266,11 +269,17 @@ test msrv:
extends: extends:
- '.cargo test' - '.cargo test'
- .img-msrv - .img-msrv
needs:
- job: 'build-msrv'
artifacts: false
test stable: test stable:
extends: extends:
- '.cargo test' - '.cargo test'
- .img-stable - .img-stable
needs:
- job: 'build-stable'
artifacts: false
test stable all-features: test stable all-features:
variables: variables:
@ -279,12 +288,20 @@ test stable all-features:
extends: extends:
- '.cargo test' - '.cargo test'
- .img-stable - .img-stable
needs:
- job: 'build-stable'
artifacts: false
test nightly: test nightly:
allow_failure: true allow_failure: true
extends: extends:
- '.cargo test' - '.cargo test'
- .img-nightly - .img-nightly
needs:
- job: 'build-nightly'
artifacts: false
test nightly all-features: test nightly all-features:
allow_failure: true allow_failure: true
@ -294,6 +311,9 @@ test nightly all-features:
extends: extends:
- '.cargo test' - '.cargo test'
- .img-nightly - .img-nightly
needs:
- job: 'build-nightly'
artifacts: false
.cargo test sys: .cargo test sys:
stage: "test" stage: "test"
@ -342,16 +362,25 @@ test stable sys:
extends: extends:
- '.cargo test sys' - '.cargo test sys'
- .img-stable - .img-stable
needs:
- job: 'build-stable'
artifacts: false
test msrv sys: test msrv sys:
extends: extends:
- '.cargo test sys' - '.cargo test sys'
- .img-msrv - .img-msrv
needs:
- job: 'build-msrv'
artifacts: false
test nightly sys: test nightly sys:
extends: extends:
- '.cargo test sys' - '.cargo test sys'
- .img-nightly - .img-nightly
needs:
- job: 'build-nightly'
artifacts: false
rustfmt: rustfmt:
extends: .img-stable extends: .img-stable
@ -359,18 +388,27 @@ rustfmt:
script: script:
- cargo fmt --version - cargo fmt --version
- cargo fmt -- --color=always --check - cargo fmt -- --color=always --check
needs:
- job: 'build-stable'
artifacts: false
check commits: check commits:
extends: .img-stable extends: .img-stable
stage: "lint" stage: "lint"
script: script:
- ci-fairy check-commits --textwidth 0 --no-signed-off-by - ci-fairy check-commits --textwidth 0 --no-signed-off-by
needs:
- job: 'build-stable'
artifacts: false
clippy: clippy:
extends: .img-stable extends: .img-stable
stage: 'extras' stage: 'extras'
variables: variables:
CLIPPY_LINTS: -D warnings CLIPPY_LINTS: -D warnings
needs:
- job: 'build-stable'
artifacts: false
script: script:
- cargo clippy --version - cargo clippy --version
# Keep features in sync with above # Keep features in sync with above
@ -403,6 +441,9 @@ clippy:
deny: deny:
extends: .img-stable extends: .img-stable
stage: 'extras' stage: 'extras'
needs:
- job: 'build-stable'
artifacts: false
rules: rules:
- if: $CI_PIPELINE_SOURCE == "schedule" - if: $CI_PIPELINE_SOURCE == "schedule"
script: script:
@ -413,12 +454,18 @@ gir-checks:
GIT_SUBMODULE_STRATEGY: recursive GIT_SUBMODULE_STRATEGY: recursive
extends: .img-stable extends: .img-stable
stage: 'extras' stage: 'extras'
needs:
- job: 'build-stable'
artifacts: false
script: script:
- python3 ci/gir-checks.py - python3 ci/gir-checks.py
outdated: outdated:
extends: .img-stable extends: .img-stable
stage: 'extras' stage: 'extras'
needs:
- job: 'build-stable'
artifacts: false
rules: rules:
- if: $CI_PIPELINE_SOURCE == "schedule" - if: $CI_PIPELINE_SOURCE == "schedule"
script: script:
@ -430,6 +477,9 @@ coverage:
- '.cargo test' - '.cargo test'
- .img-stable - .img-stable
stage: 'extras' stage: 'extras'
needs:
- job: 'build-stable'
artifacts: false
variables: variables:
ALL_FEATURES: 'yes' ALL_FEATURES: 'yes'
RUSTFLAGS: "-Cinstrument-coverage" RUSTFLAGS: "-Cinstrument-coverage"
@ -454,6 +504,9 @@ doc-stripping:
GIT_SUBMODULE_STRATEGY: recursive GIT_SUBMODULE_STRATEGY: recursive
extends: .img-nightly extends: .img-nightly
stage: 'extras' stage: 'extras'
needs:
- job: 'build-nightly'
artifacts: false
script: script:
- PATH=~/.cargo/bin/:$PATH ./generator.py --gir-files-directories gir-files gst-gir-files --strip-docs --no-fmt - PATH=~/.cargo/bin/:$PATH ./generator.py --gir-files-directories gir-files gst-gir-files --strip-docs --no-fmt
- git diff --quiet || (echo 'Files changed after running `rustdoc-stripper -s`, make sure all documentation is protected with `// rustdoc-stripper-ignore-next`!'; git diff; false) - git diff --quiet || (echo 'Files changed after running `rustdoc-stripper -s`, make sure all documentation is protected with `// rustdoc-stripper-ignore-next`!'; git diff; false)
@ -463,6 +516,9 @@ docs:
GIT_SUBMODULE_STRATEGY: recursive GIT_SUBMODULE_STRATEGY: recursive
extends: .img-nightly extends: .img-nightly
stage: 'extras' stage: 'extras'
needs:
- job: 'build-nightly'
artifacts: false
script: script:
- curl --proto '=https' --tlsv1.2 -sSf -o gir-rustdoc.py - curl --proto '=https' --tlsv1.2 -sSf -o gir-rustdoc.py
https://gitlab.gnome.org/World/Rust/gir-rustdoc/-/raw/main/gir-rustdoc.py https://gitlab.gnome.org/World/Rust/gir-rustdoc/-/raw/main/gir-rustdoc.py
@ -484,8 +540,8 @@ docs:
pages: pages:
extends: .img-nightly extends: .img-nightly
stage: 'deploy' stage: 'deploy'
dependencies: needs: [ 'docs' ]
- docs interruptible: false
script: script:
- curl --proto '=https' --tlsv1.2 -sSf -o gir-rustdoc.py - curl --proto '=https' --tlsv1.2 -sSf -o gir-rustdoc.py
https://gitlab.gnome.org/World/Rust/gir-rustdoc/-/raw/main/gir-rustdoc.py https://gitlab.gnome.org/World/Rust/gir-rustdoc/-/raw/main/gir-rustdoc.py