ci: move tests scripts to individual files

Instead of inling bash scripts in yaml

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1176>
This commit is contained in:
Jordan Petridis 2022-12-23 21:11:37 +02:00 committed by Sebastian Dröge
parent 58ea85c52c
commit 01ab46a483
4 changed files with 136 additions and 115 deletions

View file

@ -251,44 +251,7 @@ plugins-update-nightly:
UPDATE_IMG: "nightly"
.cargo_test_var: &cargo_test
- rustc --version
# First build and test all the crates with their relevant features
# Keep features in sync with below
- |
get_features() {
crate=$1
case "$crate" in
gstreamer-audio|gstreamer-editing-services|gstreamer-gl|gstreamer-pbutils|gstreamer-rtp|gstreamer-rtsp|gstreamer-video|gstreamer)
echo "--features=serde,v1_22"
;;
gstreamer-validate)
echo ""
;;
*)
echo "--features=v1_22"
;;
esac
}
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 [ -n "$EXAMPLES_TUTORIALS" ]; 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
- ./ci/run-cargo-test.sh
.cargo test:
stage: "test"
@ -358,53 +321,7 @@ test nightly all-features:
.cargo test sys:
stage: "test"
script:
- rustc --version
- |
get_features() {
module=${1%%/sys}
case "$module" in
gstreamer-validate)
echo ""
;;
*)
echo "--features=v1_22"
;;
esac
}
# 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
- ./ci/run-sys-cargo-test.sh
test stable sys:
extends:
@ -466,36 +383,7 @@ clippy:
- job: 'build-stable'
artifacts: false
script:
- cargo clippy --version
# Keep features in sync with above
- |
get_features() {
crate=$1
case "$crate" in
gstreamer-audio|gstreamer-editing-services|gstreamer-gl|gstreamer-pbutils|gstreamer-rtp|gstreamer-rtsp|gstreamer-video|gstreamer)
echo "--features=serde,v1_22"
;;
gstreamer-validate)
echo ""
;;
*)
echo "--features=v1_22"
;;
esac
}
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 -- $CLIPPY_LINTS
fi
done
# And also run over all the examples/tutorials
- |
cargo clippy --locked --color=always --manifest-path examples/Cargo.toml --all-targets --all-features -- $CLIPPY_LINTS
cargo clippy --locked --color=always --manifest-path tutorials/Cargo.toml --all-targets --all-features -- $CLIPPY_LINTS
- ./ci/run-clippy.sh
deny:
extends: .img-stable

43
ci/run-cargo-test.sh Executable file
View file

@ -0,0 +1,43 @@
#! /bin/bash
set -ex
rustc --version
cargo --version
# First build and test all the crates with their relevant features
# Keep features in sync with the list below below
get_features() {
crate=$1
case "$crate" in
gstreamer-audio|gstreamer-editing-services|gstreamer-gl|gstreamer-pbutils|gstreamer-rtp|gstreamer-rtsp|gstreamer-video|gstreamer)
echo "--features=serde,v1_22"
;;
gstreamer-validate)
echo ""
;;
*)
echo "--features=v1_22"
;;
esac
}
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 [ -n "$EXAMPLES_TUTORIALS" ]; 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

37
ci/run-clippy.sh Executable file
View file

@ -0,0 +1,37 @@
#! /bin/bash
set -ex
rustc --version
cargo --version
cargo clippy --version
# Keep features in sync with run-cargo-test.sh
get_features() {
crate=$1
case "$crate" in
gstreamer-audio|gstreamer-editing-services|gstreamer-gl|gstreamer-pbutils|gstreamer-rtp|gstreamer-rtsp|gstreamer-video|gstreamer)
echo "--features=serde,v1_22"
;;
gstreamer-validate)
echo ""
;;
*)
echo "--features=v1_22"
;;
esac
}
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 -- $CLIPPY_LINTS
fi
done
# And also run over all the examples/tutorials
cargo clippy --locked --color=always --manifest-path examples/Cargo.toml --all-targets --all-features -- $CLIPPY_LINTS
cargo clippy --locked --color=always --manifest-path tutorials/Cargo.toml --all-targets --all-features -- $CLIPPY_LINTS

53
ci/run-sys-cargo-test.sh Executable file
View file

@ -0,0 +1,53 @@
#! /bin/bash
set -ex
rustc --version
cargo --version
get_features() {
module=${1%%/sys}
case "$module" in
gstreamer-validate)
echo ""
;;
*)
echo "--features=v1_22"
;;
esac
}
# 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