ci: use fdo template

Build our own images based on the ones used by gstreamer-rs ci.

Fix #109

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/321>
This commit is contained in:
Guillaume Desmottes 2020-04-21 12:19:38 +02:00
parent 957aac94ae
commit 54586c6ecc
2 changed files with 104 additions and 70 deletions

View file

@ -1,67 +1,103 @@
.templates_sha: &templates_sha 8becba49be7e5886311972356345532ed9dd84c1
include:
- project: 'freedesktop/ci-templates'
ref: *templates_sha
file: '/templates/debian.yml'
- remote: "https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/raw/master/ci/images_template.yml"
variables:
FDO_UPSTREAM_REPO: gstreamer/gst-plugins-rs
stages:
- "prep"
- "lint"
- "test"
- "extras"
.tarball_setup:
.debian:10:
variables:
FDO_DISTRIBUTION_VERSION: 10
FDO_DISTRIBUTION_TAG: '$RUST_VERSION-${GST_RS_IMG_TAG}_2020-04-27.0'
# Only stuff inside the repo directory can be cached
# Override the CARGO_HOME variable to force its location
CARGO_HOME: "${CI_PROJECT_DIR}/.cargo_home"
SODIUM_USE_PKG_CONFIG: "true"
DEPENDENCIES: |
clang
curl
file
git
libsodium-dev
libssl-dev
liborc-0.4-dev
libglib2.0-dev
libgdk-pixbuf2.0-dev
libgtk-3-dev
libxml2-dev
libegl1-mesa
libgles2-mesa
libgl1-mesa-dri
libgl1-mesa-glx
libwayland-egl1-mesa
llvm
nasm
libcsound64-dev
python3-pip
python3-setuptools
python3-wheel
xz-utils
FDO_BASE_IMAGE: "registry.freedesktop.org/gstreamer/gstreamer-rs/debian/10:$RUST_VERSION-$GST_RS_IMG_TAG"
before_script:
- apt-get update -yqq
- apt-get install -yqq --no-install-recommends $DEPENDENCIES
- pip3 install --user meson ninja
- export PATH="$PATH:$HOME/.local/bin"
- mkdir -p precompiled-gst && cd precompiled-gst
- curl -L https://people.freedesktop.org/~slomo/gstreamer-1.16.1.tar.xz | tar xJ
- sed -i "s;prefix=/root/gstreamer;prefix=$PWD/gstreamer;g" $PWD/gstreamer/lib/x86_64-linux-gnu/pkgconfig/*.pc
- export PKG_CONFIG_PATH=$PWD/gstreamer/lib/x86_64-linux-gnu/pkgconfig
- export GST_PLUGIN_SYSTEM_PATH=$PWD/gstreamer/lib/x86_64-linux-gnu/gstreamer-1.0
- export GST_PLUGIN_SCANNER=$PWD/gstreamer/libexec/gstreamer-1.0/gst-plugin-scanner
- export PATH=$PATH:$PWD/gstreamer/bin
- export LD_LIBRARY_PATH=$PWD/gstreamer/lib/x86_64-linux-gnu:$LD_LIBRARY_PATH
# The build feature is required for the dav1d plugin for building and
# statically linking the C dav1d library into the dav1d-rs bindings.
# FIXME: The feature name should explicitly mention the dav1d plugin but
# Cargo currently doesn't support passthrough for that scenario.
- export RUSTFLAGS='--cfg feature="build"'
- cd "${CI_PROJECT_DIR}"
- source ./ci/env.sh
- mkdir .cargo && echo -e "[net]\ngit-fetch-with-cli = true" > .cargo/config
.debian:10-stable:
extends: .debian:10
variables:
RUST_VERSION: "stable"
.debian:10-1-40:
extends: .debian:10
variables:
RUST_VERSION: "1.40.0"
.debian:10-nightly:
extends: .debian:10
variables:
RUST_VERSION: "nightly"
.build-debian-container:
extends:
- .fdo.container-build@debian
stage: prep
variables:
FDO_DISTRIBUTION_PACKAGES: "libcsound64-dev llvm clang nasm libsodium-dev"
build-stable:
extends:
- .build-debian-container
- .debian:10-stable
build-1-40:
extends:
- .build-debian-container
- .debian:10-1-40
build-nightly:
extends:
- .build-debian-container
- .debian:10-nightly
.dist-debian-container:
extends:
- .fdo.distribution-image@debian
cache:
key: "gst"
paths:
- "${CARGO_HOME}"
variables:
SODIUM_USE_PKG_CONFIG: "true"
# The build feature is required for the dav1d plugin for building and
# statically linking the C dav1d library into the dav1d-rs bindings.
# FIXME: The feature name should explicitly mention the dav1d plugin but
# Cargo currently doesn't support passthrough for that scenario.
RUSTFLAGS: "--cfg feature=\"build\""
after_script:
- rm -rf target
.img-stable:
extends:
- .dist-debian-container
- .debian:10-stable
.img-1-40:
extends:
- .dist-debian-container
- .debian:10-1-40
.img-nightly:
extends:
- .dist-debian-container
- .debian:10-nightly
.cargo test:
extends: '.tarball_setup'
stage: "test"
script:
- rustc --version
@ -71,57 +107,47 @@ stages:
- G_DEBUG=fatal_warnings cargo test --color=always --all --examples --all-features
test 1.40:
# 1.40 img
# https://hub.docker.com/_/rust/
image: "rust:1.40-slim-buster"
extends: '.cargo test'
extends:
- '.cargo test'
- .img-1-40
test stable:
# Stable img
# https://hub.docker.com/_/rust/
image: "rust:slim-buster"
extends: '.cargo test'
extends:
- '.cargo test'
- .img-stable
test nightly:
# Nightly
# https://hub.docker.com/r/rustlang/rust/
image: "rustlang/rust:nightly-buster-slim"
allow_failure: true
extends: '.cargo test'
extends:
- '.cargo test'
- .img-nightly
rustfmt:
image: "rust:slim-buster"
extends: .img-stable
stage: "lint"
script:
- rustup component add rustfmt
- cargo fmt --version
- cargo fmt -- --color=always --check
clippy:
extends: '.tarball_setup'
image: "rust:slim-buster"
extends: .img-stable
stage: 'extras'
script:
- rustup component add clippy-preview
- cargo clippy --color=always --all --all-features --all-targets -- -A clippy::redundant_pattern_matching -A clippy::single_match -A clippy::cast_lossless -D warnings
audit:
extends: '.tarball_setup'
image: "rust:slim-buster"
extends: .img-stable
stage: 'extras'
only:
- schedules
script:
- cargo install --force cargo-audit
- cargo audit --deny-warnings
outdated:
extends: '.tarball_setup'
image: "rust:slim-buster"
extends: .img-stable
allow_failure: true
stage: 'extras'
only:
- schedules
script:
- cargo install --force --git https://github.com/kbknapp/cargo-outdated
- cargo outdated --root-deps-only --exit-code 1 -v

8
ci/env.sh Normal file
View file

@ -0,0 +1,8 @@
export RUSTUP_HOME='/usr/local/rustup'
export PATH=$PATH:/usr/local/cargo/bin
export PKG_CONFIG_PATH=/usr/local/lib/x86_64-linux-gnu/pkgconfig
export GST_PLUGIN_SYSTEM_PATH=/usr/local/lib/x86_64-linux-gnu/gstreamer-1.0
export GST_PLUGIN_SCANNER=/usr/local/libexec/gstreamer-1.0/gst-plugin-scanner
export PATH=$PATH:/usr/local/bin
export LD_LIBRARY_PATH=/usr/local/lib/x86_64-linux-gnu:$LD_LIBRARY_PATH