ci: ensure the registry cache and lockfile are up-to-date

We are caching the CARGO_HOME which includes git repos of
the gtk-rs bindings. Since we don't specify a branch
so it uses the default branch for the ref.

cargo build usually does an update if it has network access,
but its not guaranted or the case for other tools like clippy
which may still point to the stale git snapshot like here:

https://gitlab.freedesktop.org/thaytan/gstreamer-rs/-/jobs/4165449
This commit is contained in:
Jordan Petridis 2020-08-21 05:49:20 +03:00 committed by Sebastian Dröge
parent a4239c3462
commit 8d9bb82492

View file

@ -37,6 +37,10 @@ stages:
- "extras" - "extras"
- "deploy" - "deploy"
.source_env_anchor: &source_env
- source ./ci/env.sh
- mkdir .cargo && echo -e "[net]\ngit-fetch-with-cli = true" > .cargo/config
.debian:10: .debian:10:
variables: variables:
FDO_DISTRIBUTION_VERSION: 10 FDO_DISTRIBUTION_VERSION: 10
@ -45,8 +49,7 @@ stages:
# Override the CARGO_HOME variable to force its location # Override the CARGO_HOME variable to force its location
CARGO_HOME: "${CI_PROJECT_DIR}/.cargo_home" CARGO_HOME: "${CI_PROJECT_DIR}/.cargo_home"
before_script: before_script:
- source ./ci/env.sh - *source_env
- mkdir .cargo && echo -e "[net]\ngit-fetch-with-cli = true" > .cargo/config
.debian:10-base: .debian:10-base:
extends: .debian:10 extends: .debian:10
@ -115,6 +118,11 @@ update-nightly:
.dist-debian-container: .dist-debian-container:
extends: extends:
- .fdo.distribution-image@debian - .fdo.distribution-image@debian
before_script:
- *source_env
# Ensure the cache and the .lockfile are up to date
- cargo generate-lockfile
- cargo update
cache: cache:
key: "gst" key: "gst"
paths: paths:
@ -124,18 +132,18 @@ update-nightly:
.img-stable: .img-stable:
extends: extends:
- .dist-debian-container
- .debian:10-stable - .debian:10-stable
- .dist-debian-container
.img-1-40: .img-1-40:
extends: extends:
- .dist-debian-container
- .debian:10-1-40 - .debian:10-1-40
- .dist-debian-container
.img-nightly: .img-nightly:
extends: extends:
- .dist-debian-container
- .debian:10-nightly - .debian:10-nightly
- .dist-debian-container
# GST_PLUGINS_RS_TOKEN is a variable of type 'Var' defined in gstreamer-rs CI # GST_PLUGINS_RS_TOKEN is a variable of type 'Var' defined in gstreamer-rs CI
# settings and containing a gst-plugins-rs pipeline trigger token # settings and containing a gst-plugins-rs pipeline trigger token
@ -205,10 +213,10 @@ plugins-update-nightly:
FEATURES=v1_18 FEATURES=v1_18
fi fi
cargo build --color=always --manifest-path $crate/Cargo.toml --features=$FEATURES cargo build --locked --color=always --manifest-path $crate/Cargo.toml --features=$FEATURES
G_DEBUG=fatal_warnings cargo test --color=always --manifest-path $crate/Cargo.toml --features=$FEATURES G_DEBUG=fatal_warnings cargo test --color=always --manifest-path $crate/Cargo.toml --features=$FEATURES
else else
cargo build --color=always --manifest-path $crate/Cargo.toml cargo build --locked --color=always --manifest-path $crate/Cargo.toml
G_DEBUG=fatal_warnings cargo test --color=always --manifest-path $crate/Cargo.toml G_DEBUG=fatal_warnings cargo test --color=always --manifest-path $crate/Cargo.toml
fi fi
done done
@ -217,8 +225,8 @@ plugins-update-nightly:
# tutorials/examples with all features # tutorials/examples with all features
- | - |
if [ -n "$ALL_FEATURES" ]; then if [ -n "$ALL_FEATURES" ]; then
cargo build --color=always --manifest-path examples/Cargo.toml --bins --examples --all-features cargo build --locked --color=always --manifest-path examples/Cargo.toml --bins --examples --all-features
cargo build --color=always --manifest-path tutorials/Cargo.toml --bins --examples --all-features cargo build --locked --color=always --manifest-path tutorials/Cargo.toml --bins --examples --all-features
fi fi
test 1.40: test 1.40:
@ -281,12 +289,12 @@ clippy:
FEATURES=v1_18 FEATURES=v1_18
fi fi
cargo clippy --color=always --manifest-path $crate/Cargo.toml --features=$FEATURES --all-targets -- -A clippy::redundant_pattern_matching -A clippy::single_match -A clippy::cast_lossless -A clippy::missing_safety_doc -D warnings cargo clippy --locked --color=always --manifest-path $crate/Cargo.toml --features=$FEATURES --all-targets -- -A clippy::redundant_pattern_matching -A clippy::single_match -A clippy::cast_lossless -A clippy::missing_safety_doc -D warnings
done done
# And also run over all the examples/tutorials # And also run over all the examples/tutorials
- | - |
cargo clippy --color=always --manifest-path examples/Cargo.toml --all-targets --all-features -- -A clippy::redundant_pattern_matching -A clippy::single_match -A clippy::cast_lossless -A clippy::missing_safety_doc -D warnings cargo clippy --locked --color=always --manifest-path examples/Cargo.toml --all-targets --all-features -- -A clippy::redundant_pattern_matching -A clippy::single_match -A clippy::cast_lossless -A clippy::missing_safety_doc -D warnings
cargo clippy --color=always --manifest-path tutorials/Cargo.toml --all-targets --all-features -- -A clippy::redundant_pattern_matching -A clippy::single_match -A clippy::cast_lossless -A clippy::missing_safety_doc -D warnings cargo clippy --locked --color=always --manifest-path tutorials/Cargo.toml --all-targets --all-features -- -A clippy::redundant_pattern_matching -A clippy::single_match -A clippy::cast_lossless -A clippy::missing_safety_doc -D warnings
deny: deny:
extends: .img-stable extends: .img-stable
@ -302,7 +310,7 @@ gir-checks:
script: script:
- git clone --depth 1 https://github.com/gtk-rs/checker - git clone --depth 1 https://github.com/gtk-rs/checker
- cd checker && echo '[workspace]' >> Cargo.toml - cd checker && echo '[workspace]' >> Cargo.toml
- cargo build --release - cargo build --locked --release
- | - |
cargo run --release -- \ cargo run --release -- \
--gir-file ../Gir_GstApp.toml ../gstreamer-app \ --gir-file ../Gir_GstApp.toml ../gstreamer-app \