WIP: ci: add basic tests on macOS arm64

This commit is contained in:
François Laignel 2024-04-18 20:36:17 +02:00
parent 66030f36ad
commit 01711b0064

View file

@ -40,387 +40,79 @@ default:
interruptible: true
stages:
- "trigger"
- "lint"
- "test"
- "extras"
- "integration"
# This is an empty job that is used to trigger the pipeline.
trigger:
image: alpine:latest
stage: 'trigger'
variables:
GIT_STRATEGY: none
tags: [ 'placeholder-job' ]
script:
- echo "Trigger job done, now running the pipeline."
rules:
- if: $CI_PIPELINE_SOURCE == "schedule"
# If the MR is assigned to the Merge bot, trigger the pipeline automatically
- if: '$CI_MERGE_REQUEST_ASSIGNEES == "gstreamer-merge-bot"'
# Require explicit action to trigger tests post merge
- if: '$CI_PROJECT_NAMESPACE == "gstreamer" && $CI_COMMIT_BRANCH == "main"'
when: 'manual'
# When the assignee isn't the merge bot, require an explicit action to trigger the pipeline
# to avoid wasting CI resources
- if: '$CI_MERGE_REQUEST_ASSIGNEES != "gstreamer-merge-bot"'
when: 'manual'
allow_failure: false
.macos:arm64:
image: "registry.freedesktop.org/gstreamer/cerbero/macos-arm64/14-sonoma:2023-10-25.2"
tags:
- 'gst-mac-arm'
.debian:12:
variables:
SODIUM_USE_PKG_CONFIG: "true"
.macos:arm64-stable:
extends: .macos:arm64
after_script:
- rm -rf target
before_script:
- source ./ci/env.sh
- mkdir .cargo && echo -e "[net]\ngit-fetch-with-cli = true" > .cargo/config
- CI=1 /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
- (echo; echo 'eval "$(/opt/homebrew/bin/brew shellenv)"') >> $HOME/.zprofile
- eval "$(/opt/homebrew/bin/brew shellenv)"
.debian:12-stable:
extends: .debian:12
image: "registry.freedesktop.org/gstreamer/gstreamer-rs/debian/bookworm-slim:$GST_RS_STABLE-$GST_RS_IMG_TAG"
- CI=1 brew install pkg-config
.debian:12-msrv:
extends: .debian:12
image: "registry.freedesktop.org/gstreamer/gstreamer-rs/debian/bookworm-slim:$GST_RS_MSRV-$GST_RS_IMG_TAG"
- export GST_VERSION=1.24.2
- curl --proto '=https' --tlsv1.2 -o gstreamer-1.0-${GST_VERSION}-universal.pkg -sSf https://gstreamer.freedesktop.org/data/pkg/osx/${GST_VERSION}/gstreamer-1.0-${GST_VERSION}-universal.pkg
- curl --proto '=https' --tlsv1.2 -o gstreamer-1.0-devel-${GST_VERSION}-universal.pkg -sSf https://gstreamer.freedesktop.org/data/pkg/osx/${GST_VERSION}/gstreamer-1.0-devel-${GST_VERSION}-universal.pkg
- sudo installer -pkg gstreamer-1.0-${GST_VERSION}-universal.pkg -target /
- sudo installer -pkg gstreamer-1.0-devel-${GST_VERSION}-universal.pkg -target /
- export PKG_CONFIG_PATH=/Library/Frameworks/GStreamer.framework/Versions/1.0/lib/pkgconfig:$PKG_CONFIG_PATH
- export DYLD_FALLBACK_LIBRARY_PATH=/Library/Frameworks/GStreamer.framework/Versions/1.0/lib:$DYLD_FALLBACK_LIBRARY_PATH
- curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
- echo -e "[net]\ngit-fetch-with-cli = true" > $HOME/.cargo/config
- source "$HOME/.cargo/env"
.debian:12-nightly:
extends: .debian:12
image: "registry.freedesktop.org/gstreamer/gstreamer-rs/debian/bookworm-slim:nightly-$GST_RS_IMG_TAG"
.cargo test:
stage: "test"
variables:
# csound-sys only looks at /usr/lib and /usr/local top levels
CSOUND_LIB_DIR: '/usr/lib/x86_64-linux-gnu/'
RUST_BACKTRACE: 'full'
test macos-arm64 stable:
extends: '.macos:arm64-stable'
stage: 'test'
#needs:
# - 'trigger'
script:
- rustc --version
- cargo build --locked --color=always --workspace --all-targets
- G_DEBUG=fatal_warnings cargo test --locked --color=always --workspace --all-targets
- cargo build --locked --color=always --workspace --all-targets --all-features --exclude gst-plugin-gtk4
- G_DEBUG=fatal_warnings cargo test --locked --color=always --workspace --all-targets --all-features --exclude gst-plugin-gtk4
- cargo build --locked --color=always --workspace --all-targets --no-default-features
- G_DEBUG=fatal_warnings cargo test --locked --color=always --workspace --all-targets --no-default-features
# Package exclusion list:
# * csound: macOS support was added after latest csound-sys release.
# see https://github.com/neithanmo/csound-rs/commit/797fc49d6ddf5e78f8f2d609baab5d46e5f2ca5f
# * dav1d: gstreamer-1.0-devel-1.24.2-universal.pkg comes with version
# 1.1.0 (via gstreamer-1.0-codecs). dav1d-rs requires >= 1.3.0.
# brew provides a suitable version but it would conflict with gstreamer's.
# * gtk4: gstreamer-1.0-devel-1.24.2-universal.pkg comes with glib-2.0 in
# version 2.74.4 but gtk4-rs requires >= 2.76.0.
# brew provides a suitable version but it would conflict with gstreamer's.
# Also exclude examples which use gst-plugin-gtk4:
# * gtk-livesync from gst-plugin-livesync
# * gtk-recording from gst-plugin-togglerecord
# * gtk-fallbackswitch from gst-plugin-fallbackswitch
# Note for later: gst-plugin-gtk4 can't be compiled with
# --all-feautes because brew doesn't provide X11 nor Wayland versions.
- export EXCLUSION_LIST=(gst-plugin-csound gst-plugin-dav1d gst-plugin-gtk4 gst-plugin-livesync gst-plugin-togglerecord gst-plugin-fallbackswitch)
# Packages for which we can't check --examples nor --all-features
- export NO_EXAMPLES_LIST=(gst-plugin-livesync gst-plugin-togglerecord gst-plugin-fallbackswitch)
test msrv:
extends:
- '.cargo test'
- '.debian:12-msrv'
needs: [ "trigger" ]
- export EXCLUDE_ARGS=(`for p in ${EXCLUSION_LIST[@]}; do printf " --exclude %s" $p; done`)
- export NO_EXAMPLES_P_ARGS=(`for p in ${NO_EXAMPLES_LIST[@]}; do printf " -p %s" $p; done`)
test stable:
extends:
- '.cargo test'
- '.debian:12-stable'
needs: [ "trigger" ]
- cargo build --locked --workspace ${EXCLUDE_ARGS[@]} --all-targets --color=always
- G_DEBUG=fatal_warnings cargo test --locked --workspace ${EXCLUDE_ARGS[@]} --all-targets --color=always
- cargo build --locked ${NO_EXAMPLES_P_ARGS[@]} --lib --bins --tests --benches --color=always
- G_DEBUG=fatal_warnings cargo test --locked ${NO_EXAMPLES_P_ARGS[@]} --lib --bins --tests --benches --color=always
test nightly:
allow_failure: true
extends:
- '.cargo test'
- '.debian:12-nightly'
needs: [ "trigger" ]
.meson:
extends: .debian:12-stable
variables:
# csound-sys only looks at /usr/lib and /usr/local top levels
CSOUND_LIB_DIR: '/usr/lib/x86_64-linux-gnu/'
meson shared:
extends: .meson
needs: [ "trigger" ]
variables:
CI_ARTIFACTS_URL: "${CI_PROJECT_URL}/-/jobs/${CI_JOB_ID}/artifacts/raw/"
script:
- meson build --default-library=shared --prefix=$(pwd)/install --fatal-meson-warnings
- ninja -C build install
- ./ci/check-installed.py install
- ninja -C build docs/gst_plugins_cache.json
- ci/check-documentation-diff.py
artifacts:
when: always
expire_in: "7 days"
paths:
- plugins-cache-diffs/
- 'build/meson-logs/'
meson static:
extends: .meson
needs: [ "trigger" ]
script:
- meson build --default-library=static --prefix=$(pwd)/install -Dsodium-source=built-in
- ninja -C build install
- ./ci/generate-static-test.py test-static-link-all
- cd test-static-link-all
- PKG_CONFIG_PATH=$PKG_CONFIG_PATH:$(pwd)/../install/lib/x86_64-linux-gnu/pkgconfig meson build
- ninja -C build
- ./build/test-gst-static
artifacts:
when: always
expire_in: "7 days"
paths:
- 'build/meson-logs/'
# Check that the gstreamer documentation keeps working
documentation:
image: $GSTREAMER_DOC_IMAGE
stage: 'integration'
variables:
MESON_ARGS: >
-Ddoc=enabled
-Dpython=disabled
-Dlibav=disabled
-Dlibnice=disabled
-Ddevtools=disabled
-Dges=disabled
-Dsharp=disabled
-Dgst-examples=disabled
-Drs=enabled
-Dgst-plugins-rs:sodium-source=system
-Dgst-docs:fatal_warnings=true
-Dorc=disabled
script:
- export PATH=/usr/local/cargo/bin/:/usr/local/bin/:$PATH
- export RUSTUP_HOME='/usr/local/rustup'
- P=$(pwd)
- cd ..
- rm -rf gstreamer
- git clone --depth 1 https://gitlab.freedesktop.org/gstreamer/gstreamer.git --branch main
- cd gstreamer
- ln -s $P subprojects/gst-plugins-rs
- meson build $MESON_ARGS
- ./gst-env.py ninja -C build subprojects/gst-docs/GStreamer-doc
- mv build/subprojects/gst-docs/GStreamer-doc/html $P/documentation/
artifacts:
expire_in: '7 days'
when: always
paths:
- documentation/
needs: []
rules:
# Run job if the MR is assigned to the Merge bot or it a post-merge pipeline on main branch
- if: '$CI_MERGE_REQUEST_ASSIGNEES == "gstreamer-merge-bot"'
when: 'always'
- if: '$CI_PROJECT_NAMESPACE == "gstreamer" && $CI_COMMIT_BRANCH == "main"'
when: 'always'
# Require explicit action to trigger otherwise
- if: '$CI_PROJECT_NAMESPACE != "gstreamer" || $CI_COMMIT_BRANCH != "main"'
when: 'manual'
# build gst-plugins-rs as a gst-build subproject
# Disabled because of https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/issues/262
#gst-build:
# extends: .meson
# rules:
# - if: '$CI_PIPELINE_SOURCE == "schedule"'
# - if: $CI_PIPELINE_SOURCE == "merge_request_event"
# when: 'manual'
# allow_failure: true
# variables:
# MESON_ARGS: >
# -Domx=disabled
# -Dpython=disabled
# -Dlibav=disabled
# -Dlibnice=disabled
# -Dugly=disabled
# -Dbad=disabled
# -Ddevtools=disabled
# -Dges=disabled
# -Drtsp_server=disabled
# -Dvaapi=disabled
# -Dsharp=disabled
# -Dgst-examples=disabled
# -Drs=enabled
# -Dgst-plugins-rs:sodium-source=system
# script:
# - P=$(pwd)
# - cd ..
# - rm -rf gstreamer
# - git clone --depth 1 https://gitlab.freedesktop.org/gstreamer/gstreamer.git --branch main
# - cd gstreamer
# - ln -s $P subprojects/gst-plugins-rs
# - meson build $MESON_ARGS
# - ninja -C build
# # Check static Rust plugins can be linked into gst-full
# - meson build-gst-full --default-library=static $MESON_ARGS
# - ninja -C build-gst-full
# - meson devenv -C build-gst-full ./gst-inspect-1.0 rsaudiofx
# artifacts:
# expire_in: '7 days'
# when: always
# paths:
# - 'build/meson-logs/'
# - 'build-gst-full/meson-logs/'
.msvc2019 build:
stage: 'test'
needs:
- 'trigger'
tags:
- 'docker'
- 'windows'
- '2022'
script:
# Set the code page to UTF-8
- chcp 65001
# We need to build each crate separately to choose that can build on windows
- cmd.exe /C "C:\BuildTools\Common7\Tools\VsDevCmd.bat -host_arch=amd64 -arch=amd64 &&
powershell ./ci/run_windows_tests.ps1"
- |
if (!$?) {
Write-Host "Tests Failed!"
Exit 1
}
test windows msrv:
extends: '.msvc2019 build'
image: $WINDOWS_RUST_MINIMUM_IMAGE
when: 'manual'
test windows stable:
extends: '.msvc2019 build'
image: "$WINDOWS_RUST_STABLE_IMAGE"
rustfmt:
extends: '.debian:12-stable'
stage: "lint"
tags: [ 'placeholder-job' ]
needs: []
script:
- cargo fmt --version
- cargo fmt -- --color=always --check
typos:
extends: '.debian:12-stable'
stage: "lint"
tags: [ 'placeholder-job' ]
needs: []
script:
- typos
gstwebrtc-api lint:
image: node:lts
stage: "lint"
tags: [ 'placeholder-job' ]
needs: []
script:
- cd net/webrtc/gstwebrtc-api
- npm install
- npm run check
check commits:
extends: '.debian:12-stable'
stage: "lint"
tags: [ 'placeholder-job' ]
needs: []
script:
- ci-fairy check-commits --textwidth 0 --no-signed-off-by
- ci/check-for-symlinks.sh
- ci/check-meson-version.sh
clippy:
extends: '.debian:12-stable'
needs:
- "trigger"
- "test stable"
stage: 'extras'
variables:
# csound-sys only looks at /usr/lib and /usr/local top levels
CSOUND_LIB_DIR: '/usr/lib/x86_64-linux-gnu/'
script:
- cargo clippy --locked --color=always --all --all-targets -- -D warnings -A unknown-lints
- cargo clippy --locked --color=always --all --all-features --all-targets --exclude gst-plugin-gtk4 -- -D warnings -A unknown-lints
- cargo clippy --locked --color=always --all --all-targets --no-default-features -- -D warnings -A unknown-lints
deny:
extends: .debian:12-stable
stage: 'extras'
needs:
- "trigger"
- "test stable"
rules:
- if: '$CI_PIPELINE_SOURCE == "schedule"'
script:
- cargo update --color=always
- cargo deny --color=always --workspace --all-features check all
outdated:
extends: '.debian:12-stable'
allow_failure: true
needs:
- "trigger"
- "test stable"
stage: 'extras'
rules:
- if: '$CI_PIPELINE_SOURCE == "schedule"'
script:
- cargo update --color=always
# env_logger is ignored because it requires Rust >= 1.71
- cargo outdated --color=always --root-deps-only --ignore env_logger --exit-code 1 -v
coverage:
allow_failure: true
extends:
- '.debian:12-stable'
needs:
- "trigger"
- "test stable"
stage: 'extras'
variables:
RUSTFLAGS: "-Cinstrument-coverage"
LLVM_PROFILE_FILE: "gst-plugins-rs-%p-%m.profraw"
# csound-sys only looks at /usr/lib and /usr/local top levels
CSOUND_LIB_DIR: '/usr/lib/x86_64-linux-gnu/'
script:
- cargo test --locked --color=always --all --all-features --exclude gst-plugin-gtk4
# generate html report
- grcov . --binary-path ./target/debug/ -s . -t html --branch --ignore-not-existing --ignore "*target*" --ignore "*/build.rs" -o ./coverage/
# generate cobertura report for gitlab integration
- grcov . --binary-path ./target/debug/ -s . -t cobertura --branch --ignore-not-existing --ignore "*target*" --ignore "*/build.rs" -o coverage.xml
# output coverage summary for gitlab parsing.
# TODO: use grcov once https://github.com/mozilla/grcov/issues/556 is fixed
- grep "%" coverage/index.html | head -1 || true
artifacts:
paths:
- 'coverage'
reports:
coverage_report:
coverage_format: cobertura
path: coverage.xml
cerbero trigger:
image: $CERBERO_TRIGGER_IMAGE
needs: [ "trigger" ]
variables:
# We will build this cerbero branch in the cerbero trigger CI
CERBERO_UPSTREAM_BRANCH: 'main'
script:
- ci/cerbero/trigger_cerbero_pipeline.py
rules:
# Never run post merge
- if: '$CI_PROJECT_NAMESPACE == "gstreamer"'
when: never
# Don't run if the only changes are files that cargo-c does not read
- if:
changes:
- "CHANGELOG.md"
- "README.md"
- "deny.toml"
- "rustfmt.toml"
- "typos.toml"
- "*.py"
- "*.sh"
- "Makefile"
- "meson.build"
- "meson_options.txt"
- "**/meson.build"
- "ci/*.sh"
- "ci/*.py"
when: never
- when: always
# --all-features
- cargo build --locked --workspace ${EXCLUDE_ARGS[@]} --all-targets --all-features --color=always
- G_DEBUG=fatal_warnings cargo test --locked --workspace ${EXCLUDE_ARGS[@]} --all-targets --all-features --color=always
# --no-default-features
- cargo build --keep-going --locked --workspace ${EXCLUDE_ARGS[@]} --all-targets --no-default-features --color=always
- G_DEBUG=fatal_warnings cargo test --locked --workspace ${EXCLUDE_ARGS[@]} --all-targets --no-default-features --color=always
- cargo build --locked ${NO_EXAMPLES_P_ARGS[@]} --lib --bins --tests --benches --no-default-features --color=always
- G_DEBUG=fatal_warnings cargo test --locked ${NO_EXAMPLES_P_ARGS[@]} --lib --bins --tests --benches --no-default-features --color=always