gstreamer-rs/.gitlab-ci.yml
Sebastian Dröge 28cc573875 Run clippy on --all-targets
Also ignore clippy::missing_safety_doc for now.
2019-12-23 13:40:58 +02:00

155 lines
4.8 KiB
YAML

stages:
- "lint"
- "test"
- "extras"
.tarball_setup:
variables:
# 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"
DEPENDENCIES: |
curl
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
before_script:
- apt-get update -yqq
- apt-get install -yqq --no-install-recommends $DEPENDENCIES
- 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
- cd "${CI_PROJECT_DIR}"
cache:
key: "gst"
paths:
- "${CARGO_HOME}"
.cargo test:
extends: '.tarball_setup'
stage: "test"
script:
- rustc --version
# First build and test all the crates with their relevant features
# Keep features in sync with below
- |
for crate in gstreamer*; do
if [ -n "$ALL_FEATURES" ]; then
if [ $crate = "gstreamer" ]; then
FEATURES=ser_de,v1_16
elif [ $crate = "gstreamer-gl" ]; then
FEATURES=egl,x11,wayland,v1_16
else
FEATURES=v1_16
fi
cargo build --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
cargo build --color=always --manifest-path $crate/Cargo.toml
G_DEBUG=fatal_warnings cargo test --color=always --manifest-path $crate/Cargo.toml
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 --color=always --manifest-path examples/Cargo.toml --bins --examples --all-features
cargo build --color=always --manifest-path tutorials/Cargo.toml --bins --examples --all-features
fi
test 1.39:
# 1.39 img
# https://hub.docker.com/_/rust/
image: "rust:1.39-slim-buster"
extends: '.cargo test'
test stable:
# Stable img
# https://hub.docker.com/_/rust/
image: "rust:slim-buster"
extends: '.cargo test'
test stable all-features:
# Stable img
# https://hub.docker.com/_/rust/
image: "rust:slim-buster"
variables:
ALL_FEATURES: 'yes'
extends: '.cargo test'
test nightly:
# Nightly
# https://hub.docker.com/r/rustlang/rust/
image: "rustlang/rust:nightly-buster-slim"
allow_failure: true
extends: '.cargo test'
test nightly all-features:
# Nightly
# https://hub.docker.com/r/rustlang/rust/
image: "rustlang/rust:nightly-buster-slim"
allow_failure: true
variables:
ALL_FEATURES: 'yes'
extends: '.cargo test'
rustfmt:
image: "rust:slim-buster"
stage: "lint"
script:
- rustup component add rustfmt
- cargo fmt --version
- cargo fmt -- --color=always --check
clippy:
extends: '.tarball_setup'
image: "rust:slim-buster"
stage: 'extras'
script:
- rustup component add clippy-preview
- cargo clippy --version
# Keep features in sync with above
- |
for crate in gstreamer*; do
if [ $crate = "gstreamer" ]; then
FEATURES=ser_de,v1_16
elif [ $crate = "gstreamer-gl" ]; then
FEATURES=egl,x11,wayland,v1_16
else
FEATURES=v1_16
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
done
# 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
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
audit:
extends: '.tarball_setup'
image: "rust:slim-buster"
stage: 'extras'
only:
- schedules
script:
- cargo install --force cargo-audit
- cargo audit --deny-warnings