# We use https://gitlab.freedesktop.org/freedesktop/ci-templates # to build the images used by the ci. # # Here is how to properly update thoses images: # - new Rust stable version: update GST_RS_IMG_TAG and update Rust version # - add dependencies: update FDO_DISTRIBUTION_PACKAGES and update GST_RS_IMG_TAG # - update GStreamer version: update the tag in ci/install-gst.sh and update GST_RS_IMG_TAG # # GST_RS_IMG_TAG is defined in ci/images_template.yml and should be updated # either by: # - setting it to the current date and the version suffix to 0 # - incrementing the version suffix # # After each update commit your changes and push to your personnal repo. # After review and ci approval merge the branch as usual. # # Updating the nightly image should be done by simply running a scheduled ci # pipeline on the upstream repo with the $UPDATE_NIGHTLY variable defined. .templates_sha: &templates_sha 322bf2b8f29b6491caeb13861201e96969ddc169 include: - project: 'freedesktop/ci-templates' ref: *templates_sha file: '/templates/debian.yml' - local: "ci/images_template.yml" variables: FDO_UPSTREAM_REPO: gstreamer/gstreamer-rs stages: - "container-base" - "container-final" - "lint" - "test" - "extras" - "deploy" .debian:10: variables: FDO_DISTRIBUTION_VERSION: 10 before_script: - source ./ci/env.sh - mkdir .cargo && echo -e "[net]\ngit-fetch-with-cli = true" > .cargo/config # If cargo exists assume we probably will want to update # the lockfile - | if command -v cargo; then cargo generate-lockfile --color=always cargo update --color=always fi .debian:10-base: extends: .debian:10 variables: FDO_DISTRIBUTION_TAG: 'base-$GST_RS_IMG_TAG' .debian:10-stable: extends: .debian:10 variables: RUST_IMAGE_FULL: "1" FDO_DISTRIBUTION_TAG: '$GST_RS_STABLE-$GST_RS_IMG_TAG' FDO_DISTRIBUTION_EXEC: 'bash ci/install-rust.sh $GST_RS_STABLE $RUST_IMAGE_FULL' .debian:10-msrv: extends: .debian:10 variables: FDO_DISTRIBUTION_TAG: '$GST_RS_MSRV-$GST_RS_IMG_TAG' FDO_DISTRIBUTION_EXEC: 'bash ci/install-rust.sh $GST_RS_MSRV $RUST_IMAGE_FULL' .debian:10-nightly: extends: .debian:10 variables: FDO_DISTRIBUTION_TAG: 'nightly-$GST_RS_IMG_TAG' FDO_DISTRIBUTION_EXEC: 'bash ci/install-rust.sh nightly $RUST_IMAGE_FULL' .build-base-image: extends: - .fdo.container-build@debian stage: container-base variables: FDO_DISTRIBUTION_PACKAGES: "build-essential curl python3-setuptools liborc-0.4-dev libglib2.0-dev libxml2-dev libgtk-3-dev libegl1-mesa libgles2-mesa libgl1-mesa-dri libgl1-mesa-glx libwayland-egl1-mesa xz-utils libssl-dev git wget ca-certificates ninja-build python3-pip flex bison libglib2.0-dev" FDO_DISTRIBUTION_EXEC: 'bash ci/install-gst.sh && pip3 install git+http://gitlab.freedesktop.org/freedesktop/ci-templates' .build-final-image: extends: - .fdo.container-build@debian stage: container-final variables: FDO_BASE_IMAGE: '$CI_REGISTRY_IMAGE/debian/10:base-$GST_RS_IMG_TAG' build-base: extends: - .build-base-image - .debian:10-base build-stable: extends: - .build-final-image - .debian:10-stable build-msrv: extends: - .build-final-image - .debian:10-msrv build-nightly: extends: - .build-final-image - .debian:10-nightly update-nightly: extends: build-nightly only: variables: - $UPDATE_NIGHTLY == "1" variables: FDO_FORCE_REBUILD: 1 .dist-debian-container: extends: - .fdo.distribution-image@debian after_script: - rm -rf target .img-stable: extends: - .debian:10-stable - .dist-debian-container .img-msrv: extends: - .debian:10-msrv - .dist-debian-container .img-nightly: extends: - .debian:10-nightly - .dist-debian-container # 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 .plugins-update: stage: deploy script: - | # FDO_DISTRIBUTION_IMAGE still has indirections - echo $FDO_DISTRIBUTION_IMAGE - DISTRO_IMAGE=$(eval echo ${FDO_DISTRIBUTION_IMAGE}) - echo $DISTRO_IMAGE # retrieve the infos from the registry - JSON_IMAGE=$(skopeo inspect docker://$DISTRO_IMAGE) - IMAGE_PIPELINE_ID=$(echo $JSON_IMAGE | jq -r '.Labels["fdo.pipeline_id"]') - echo $IMAGE_PIPELINE_ID - echo $CI_PIPELINE_ID - | if [[ x"$IMAGE_PIPELINE_ID" == x"$CI_PIPELINE_ID" ]]; then echo "Image has been updated, notify gst-plugins-rs" curl -X POST -F "token=$GST_PLUGINS_RS_TOKEN" -F "ref=master" -F "variables[UPDATE_IMG]=$UPDATE_IMG" https://gitlab.freedesktop.org/api/v4/projects/1400/trigger/pipeline else echo "Image has not been updated, ignore" fi rules: - if: '$CI_COMMIT_REF_NAME == "master" && $CI_PROJECT_PATH == "gstreamer/gstreamer-rs"' # Those jobs need to use another image as ours doesn't have 'skopeo' # and it's not easily installable in Debian stable for now. plugins-update-stable: extends: - .plugins-update - .img-stable image: registry.freedesktop.org/freedesktop/ci-templates/buildah:2020-03-04 variables: UPDATE_IMG: "stable" plugins-update-msrv: extends: - .plugins-update - .img-msrv image: registry.freedesktop.org/freedesktop/ci-templates/buildah:2020-03-04 variables: UPDATE_IMG: "msrv" plugins-update-nightly: extends: - .plugins-update - .img-nightly image: registry.freedesktop.org/freedesktop/ci-templates/buildah:2020-03-04 variables: UPDATE_IMG: "nightly" .cargo test: stage: "test" script: - rustc --version # First build and test all the crates with their relevant features # Keep features in sync with below - | get_features() { crate=$1 if [ "$crate" = "gstreamer" ]; then echo "--features=ser_de,v1_18" else echo "--features=v1_18" fi } for crate in gstreamer* gstreamer-gl/{egl,wayland,x11}; do if [ -e $crate/Cargo.toml ]; then if [ -n "$ALL_FEATURES" ]; then FEATURES="$(get_features $crate)" else FEATURES="" fi echo "Building and testing $crate with $FEATURES" cargo build --locked --color=always --manifest-path $crate/Cargo.toml $FEATURES G_DEBUG=fatal_warnings cargo test --color=always --manifest-path $crate/Cargo.toml $FEATURES fi done # If we do a build with all features then also build the # tutorials/examples with all features - | if [ -n "$ALL_FEATURES" ]; then cargo build --locked --color=always --manifest-path examples/Cargo.toml --bins --examples --all-features cargo build --locked --color=always --manifest-path tutorials/Cargo.toml --bins --examples --all-features fi test msrv: extends: - '.cargo test' - .img-msrv test stable: extends: - '.cargo test' - .img-stable test stable all-features: variables: ALL_FEATURES: 'yes' extends: - '.cargo test' - .img-stable test nightly: allow_failure: true extends: - '.cargo test' - .img-nightly test nightly all-features: allow_failure: true variables: ALL_FEATURES: 'yes' extends: - '.cargo test' - .img-nightly .cargo test sys: stage: "test" script: - rustc --version - | get_features() { module=${1%%/sys} echo "--features=v1_18" } # First build and test all the crates with their relevant features # Keep features in sync with below for crate in gstreamer*/sys gstreamer-gl/*/sys; do if [ -e $crate/Cargo.toml ]; then echo "Building $crate with $(get_features $crate)" cargo build --locked --color=always --manifest-path $crate/Cargo.toml $(get_features $crate) fi done # Run tests for crates we can currently run. # Other tests are broken currently. for crate in gstreamer/sys \ gstreamer-app/sys \ gstreamer-audio/sys \ gstreamer-base/sys \ gstreamer-check/sys \ gstreamer-controller/sys \ gstreamer-gl/sys \ gstreamer-gl/egl/sys \ gstreamer-gl/wayland/sys \ gstreamer-gl/x11/sys \ gstreamer-mpegts/sys \ gstreamer-net/sys \ gstreamer-pbutils/sys \ gstreamer-player/sys \ gstreamer-rtsp-server/sys \ gstreamer-rtsp/sys \ gstreamer-sdp/sys \ gstreamer-tag/sys \ gstreamer-video/sys \ gstreamer-webrtc/sys; do echo "Testing $crate with $(get_features $crate)" cargo test --locked --color=always --manifest-path $crate/Cargo.toml $(get_features $crate) done test stable sys: extends: - '.cargo test sys' - .img-stable test msrv sys: extends: - '.cargo test sys' - .img-msrv test nightly sys: extends: - '.cargo test sys' - .img-nightly rustfmt: extends: .img-stable stage: "lint" script: - cargo fmt --version - cargo fmt -- --color=always --check check commits: extends: .img-stable stage: "lint" script: - ci-fairy check-commits --textwidth 0 --no-signed-off-by clippy: extends: .img-stable stage: 'extras' script: - cargo clippy --version # Keep features in sync with above - | get_features() { crate=$1 if [ "$crate" = "gstreamer" ]; then echo "--features=ser_de,v1_18" else echo "--features=v1_18" fi } for crate in gstreamer* gstreamer-gl/{egl,wayland,x11}; do if [ -e $crate/Cargo.toml ]; then FEATURES=$(get_features $crate) echo "Running clippy on $crate with $FEATURES" cargo clippy --locked --color=always --manifest-path $crate/Cargo.toml $FEATURES --all-targets -- -A clippy::redundant_pattern_matching -A clippy::single_match -A clippy::cast_lossless -A clippy::missing_safety_doc -A clippy::manual_range_contains -A clippy::field_reassign_with_default -D warnings fi done # And also run over all the examples/tutorials - | 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 -A clippy::manual_range_contains -A clippy::field_reassign_with_default -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 -A clippy::manual_range_contains -A clippy::field_reassign_with_default -D warnings deny: extends: .img-stable stage: 'extras' only: - schedules script: - cargo deny --color=always check gir-checks: extends: .img-stable stage: 'extras' script: - git clone --depth 1 https://github.com/gtk-rs/checker - cd checker && echo '[workspace]' >> Cargo.toml - cargo build --locked --color=always --release - | cargo run --color=always --release -- \ ../gstreamer/ \ ../gstreamer-app \ ../gstreamer-audio/ \ ../gstreamer-base \ ../gstreamer-check/ \ ../gstreamer-controller/ \ ../gstreamer-editing-services/ \ ../gstreamer-gl/ \ ../gstreamer-gl/egl \ ../gstreamer-gl/wayland \ ../gstreamer-gl/x11 \ ../gstreamer-net/ \ ../gstreamer-pbutils/ \ ../gstreamer-player/ \ ../gstreamer-rtp/ \ ../gstreamer-rtsp-server/ \ ../gstreamer-rtsp/ \ ../gstreamer-sdp/ \ ../gstreamer-video/ \ ../gstreamer-webrtc/ - cd .. - | for crate in gstreamer* gstreamer-gl/{egl,wayland,x11}; do echo '-->' $crate ./checker/check_init_asserts $crate done outdated: extends: .img-stable allow_failure: true stage: 'extras' only: - schedules script: - cargo outdated --color=always --root-deps-only --exit-code 1 -v pages: extends: .img-stable stage: 'deploy' script: - | for crate in gstreamer* gstreamer-gl/{egl,wayland,x11}; do cd $crate cargo +nightly doc --color=always --features=dox,embed-lgpl-docs cd .. done - mv target/doc public/ when: 'manual' artifacts: paths: - 'public'