2018-10-08 06:46:47 +00:00
stages :
2018-10-08 09:03:42 +00:00
- "lint"
2018-11-04 14:32:17 +00:00
- "test"
2018-11-09 16:44:26 +00:00
- "extras"
2018-10-08 06:46:47 +00:00
2019-05-02 15:51:22 +00:00
.tarball_setup :
2018-10-08 06:46:47 +00:00
variables :
2018-11-09 16:36:36 +00:00
# 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"
2018-10-08 06:46:47 +00:00
DEPENDENCIES : |
curl
2019-04-23 15:47:50 +00:00
liborc-0.4-dev
2018-10-08 06:46:47 +00:00
libglib2.0-dev
libxml2-dev
libgtk-3-dev
libegl1-mesa
libgles2-mesa
libgl1-mesa-dri
libgl1-mesa-glx
libwayland-egl1-mesa
2019-10-04 21:16:47 +00:00
xz-utils
2019-10-08 10:36:30 +00:00
libssl-dev
2018-10-08 06:46:47 +00:00
before_script :
- apt-get update -yqq
- apt-get install -yqq --no-install-recommends $DEPENDENCIES
2018-10-08 08:47:44 +00:00
2018-10-08 06:46:47 +00:00
- mkdir -p precompiled-gst && cd precompiled-gst
2019-10-04 21:16:47 +00:00
- curl -L https://people.freedesktop.org/~slomo/gstreamer-1.16.1.tar.xz | tar xJ
2018-10-08 06:46:47 +00:00
- 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
2018-11-09 16:36:36 +00:00
- cd "${CI_PROJECT_DIR}"
cache :
key : "gst"
paths :
- "${CARGO_HOME}"
2019-05-02 15:51:22 +00:00
.cargo test :
extends : '.tarball_setup'
2018-11-09 16:36:36 +00:00
stage : "test"
2018-10-08 06:46:47 +00:00
script :
- rustc --version
2019-08-13 14:24:19 +00:00
# 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
2019-11-11 10:56:20 +00:00
FEATURES=ser_de,v1_16
2019-08-13 14:24:19 +00:00
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
2019-05-02 15:51:26 +00:00
2019-08-13 14:24:19 +00:00
# If we do a build with all features then also build the
# tutorials/examples with all features
2019-05-02 15:51:26 +00:00
- |
2019-07-04 14:28:15 +00:00
if [ -n "$ALL_FEATURES" ]; then
2019-08-13 14:24:19 +00:00
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
2019-05-02 15:51:26 +00:00
fi
2018-10-08 06:46:47 +00:00
2019-11-11 10:56:20 +00:00
test 1.39 :
# 1.39 img
2018-11-04 16:43:07 +00:00
# https://hub.docker.com/_/rust/
2019-11-11 10:56:20 +00:00
image : "rust:1.39-slim-buster"
2019-05-02 15:51:22 +00:00
extends : '.cargo test'
2018-10-08 06:46:47 +00:00
test stable :
2019-08-13 14:24:19 +00:00
# Stable img
# https://hub.docker.com/_/rust/
2019-10-04 21:16:47 +00:00
image : "rust:slim-buster"
2019-08-13 14:24:19 +00:00
extends : '.cargo test'
test stable all-features :
2018-10-08 06:46:47 +00:00
# Stable img
# https://hub.docker.com/_/rust/
2019-10-04 21:16:47 +00:00
image : "rust:slim-buster"
2019-07-04 14:28:15 +00:00
variables :
ALL_FEATURES : 'yes'
2019-05-02 15:51:22 +00:00
extends : '.cargo test'
2018-10-08 06:46:47 +00:00
test nightly :
2019-08-13 14:24:19 +00:00
# Nightly
# https://hub.docker.com/r/rustlang/rust/
2019-10-04 21:16:47 +00:00
image : "rustlang/rust:nightly-buster-slim"
2019-08-13 14:24:19 +00:00
allow_failure : true
extends : '.cargo test'
test nightly all-features :
2018-10-08 06:46:47 +00:00
# Nightly
# https://hub.docker.com/r/rustlang/rust/
2019-10-04 21:16:47 +00:00
image : "rustlang/rust:nightly-buster-slim"
2018-10-08 06:46:47 +00:00
allow_failure : true
2019-05-02 15:51:26 +00:00
variables :
2019-07-04 14:28:15 +00:00
ALL_FEATURES : 'yes'
2019-05-02 15:51:22 +00:00
extends : '.cargo test'
2018-10-08 09:03:42 +00:00
rustfmt :
2019-10-04 21:16:47 +00:00
image : "rust:slim-buster"
2018-10-08 09:03:42 +00:00
stage : "lint"
script :
2018-12-09 17:33:17 +00:00
- rustup component add rustfmt
2018-10-08 09:03:42 +00:00
- cargo fmt --version
- cargo fmt -- --color=always --check
2018-11-09 16:44:26 +00:00
clippy :
2019-05-02 15:51:22 +00:00
extends : '.tarball_setup'
2019-10-04 21:16:47 +00:00
image : "rust:slim-buster"
2018-11-09 16:44:26 +00:00
stage : 'extras'
script :
- rustup component add clippy-preview
- cargo clippy --version
2019-08-13 14:24:19 +00:00
# Keep features in sync with above
- |
for crate in gstreamer*; do
if [ $crate = "gstreamer" ]; then
2019-11-11 10:56:20 +00:00
FEATURES=ser_de,v1_16
2019-08-13 14:24:19 +00:00
elif [ $crate = "gstreamer-gl" ]; then
FEATURES=egl,x11,wayland,v1_16
else
FEATURES=v1_16
fi
2019-12-22 08:19:47 +00:00
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
2019-08-13 14:24:19 +00:00
done
2019-09-07 10:08:09 +00:00
# And also run over all the examples/tutorials
- |
2019-12-22 08:19:47 +00:00
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
2019-10-08 10:36:30 +00:00
audit :
extends : '.tarball_setup'
image : "rust:slim-buster"
stage : 'extras'
only :
- schedules
script :
2019-10-21 11:18:44 +00:00
- cargo install --force cargo-audit
2019-10-08 10:36:30 +00:00
- cargo audit --deny-warnings
2020-04-10 10:27:38 +00:00
outdated :
extends : '.tarball_setup'
image : "rust:slim-buster"
stage : 'extras'
only :
- schedules
script :
- cargo install --force --git https://github.com/kbknapp/cargo-outdated
- cargo outdated --root-deps-only --exit-code 1 -v