gst-play: fix command line option string formatting
[platform/upstream/gstreamer.git] / .gitlab-ci.yml
index 8e7a44d..638f73f 100644 (file)
@@ -1,51 +1,39 @@
 include:
-  - remote: "https://gitlab.freedesktop.org/freedesktop/ci-templates/-/raw/7ea696055e322cc7aa4bcbe5422b56a198c4bdff/templates/ci-fairy.yml"
+  - project: 'freedesktop/ci-templates'
+    ref: 14731f78c23c7b523a85a26a068ade9ac1ecd2f3
+    file: '/templates/fedora.yml'
+  - project: 'freedesktop/ci-templates'
+    ref: 14731f78c23c7b523a85a26a068ade9ac1ecd2f3
+    file: '/templates/debian.yml'
+  ###
+  # IMPORTANT
+  # These are the version tags for the docker images the CI runs against.
+  # If you are hacking on them or need a them to rebuild, you need to change
+  # the appropriate version string in this file which will cause a rebuild.
+  ###
+  - local: '.gitlab-image-tags.yml'
 
 stages:
-  - 'build docker'
   - 'preparation'
-  - 'pre-build'
   - 'build'
   - 'test'
   # Use the resulting binaries
   - 'integrate'
 
 variables:
-  # Branch to track for modules that have no ref specified in the manifest
-  GST_UPSTREAM_BRANCH: 'master'
-  ORC_UPSTREAM_BRANCH: 'master'
+  GIT_DEPTH: 1
 
-  ###
-  # IMPORTANT
-  # These are the version tags for the docker images the CI runs against.
-  # If you are hacking on them or need a them to rebuild, its enough
-  # to change any part of the string of the image you want.
-  ###
-  FEDORA_TAG:  '2021-06-30.0'
-  INDENT_TAG: '2020-10-22.0'
-  WINDOWS_TAG: "2021-10-01.0"
+  # Branch to track for modules that have no ref specified in the manifest
+  GST_UPSTREAM_BRANCH: 'main'
 
-  GST_UPSTREAM_REPO: 'gstreamer/gst-ci'
+  FDO_UPSTREAM_REPO: 'gstreamer/gstreamer'
 
-  FEDORA_AMD64_SUFFIX:  'amd64/fedora'
+  FEDORA_AMD64_SUFFIX: 'amd64/fedora'
   INDENT_AMD64_SUFFIX: 'amd64/gst-indent'
   WINDOWS_AMD64_SUFFIX: 'amd64/windows'
-  WINDOWS_RUST_AMD64_SUFFIX: 'amd64/windows-rust'
 
-  FEDORA_IMAGE:   "$CI_REGISTRY_IMAGE/$FEDORA_AMD64_SUFFIX:$FEDORA_TAG-$GST_UPSTREAM_BRANCH"
-  FEDORA_DOCS_IMAGE: "registry.freedesktop.org/gstreamer/gst-ci/amd64/fedora:2020-07-03.0-master"
-  INDENT_IMAGE:   "$CI_REGISTRY_IMAGE/$INDENT_AMD64_SUFFIX:$INDENT_TAG-$GST_UPSTREAM_BRANCH"
   WINDOWS_IMAGE: "$CI_REGISTRY_IMAGE/$WINDOWS_AMD64_SUFFIX:$WINDOWS_TAG-$GST_UPSTREAM_BRANCH"
-  WINDOWS_UPSTREAM_IMAGE: "$CI_REGISTRY/$GST_UPSTREAM_REPO/$WINDOWS_AMD64_SUFFIX:$WINDOWS_TAG-$GST_UPSTREAM_BRANCH"
-
-  RUST_MINIMUM_VERSION: '1.54.0'
-  RUST_LATEST_VERSION: '1.55.0'
-
-  WINDOWS_RUST_MINIMUM_IMAGE: "$CI_REGISTRY_IMAGE/$WINDOWS_RUST_AMD64_SUFFIX:$WINDOWS_TAG-$GST_UPSTREAM_BRANCH-rust-$RUST_MINIMUM_VERSION"
-  WINDOWS_RUST_MINIMUM_UPSTREAM_IMAGE: "$CI_REGISTRY/$GST_UPSTREAM_REPO/$WINDOWS_RUST_AMD64_SUFFIX:$WINDOWS_TAG-$GST_UPSTREAM_BRANCH-rust-$RUST_MINIMUM_VERSION"
-
-  WINDOWS_RUST_LATEST_IMAGE: "$CI_REGISTRY_IMAGE/$WINDOWS_RUST_AMD64_SUFFIX:$WINDOWS_TAG-$GST_UPSTREAM_BRANCH-rust-$RUST_LATEST_VERSION"
-  WINDOWS_RUST_LATEST_UPSTREAM_IMAGE: "$CI_REGISTRY/$GST_UPSTREAM_REPO/$WINDOWS_RUST_AMD64_SUFFIX:$WINDOWS_TAG-$GST_UPSTREAM_BRANCH-rust-$RUST_LATEST_VERSION"
+  WINDOWS_UPSTREAM_IMAGE: "$CI_REGISTRY/$FDO_UPSTREAM_REPO/$WINDOWS_AMD64_SUFFIX:$WINDOWS_TAG-$GST_UPSTREAM_BRANCH"
 
   MESON_BUILDTYPE_ARGS: --default-library=both
   DEFAULT_MESON_ARGS: >
@@ -62,6 +50,7 @@ variables:
     -Drtsp_server=enabled
     -Dvaapi=enabled
     -Dsharp=disabled
+    -Dgpl=enabled
 
   MESON_GST_WERROR: >
     -Dgstreamer:werror=true
@@ -84,9 +73,14 @@ workflow:
   # https://docs.gitlab.com/ee/ci/yaml/index.html#switch-between-branch-pipelines-and-merge-request-pipelines
   rules:
     - if: '$CI_PIPELINE_SOURCE == "merge_request_event"'
+      variables:
+        GIT_FETCH_EXTRA_FLAGS: '--no-tags'
     - if: $CI_COMMIT_BRANCH && $CI_OPEN_MERGE_REQUESTS && $CI_PIPELINE_SOURCE == "push"
       when: never
+    - if: '$CI_COMMIT_TAG'
     - if: '$CI_COMMIT_BRANCH'
+      variables:
+        GIT_FETCH_EXTRA_FLAGS: '--no-tags'
 
 #
 # Global CI policy
@@ -103,181 +97,64 @@ default:
       - 'api_failure'
   interruptible: true
 
-
-# Script to check if a docker image exists in the upstream registry
-# and if so copy it to the forked registry so we can use it
-#
-# This is copied/adapted from citemplates/templates/fedora.yml
-# https://gitlab.freedesktop.org/freedesktop/ci-templates/-/blob/96b621fe9f57ec2464f8d1a0940446afbf6c8f59/templates/fedora.yml
-.check_image: &check_image_exists |
-  # if-not-exists steps
-  set -x
-
-  if [[ -z "$GST_FORCE_REBUILD" ]]
-  then
-    # disable exit on failure
-    set +e
-
-    # check if our image is already in the current registry
-    # we store the sha of the digest and the layers
-    skopeo inspect docker://$LOCAL_IMAGE | jq '[.Digest, .Layers]' > local_sha
-
-    # check if our image is already in our gst-ci registry fork
-    skopeo inspect docker://$LOCAL_GST_CI_IMAGE | jq '[.Digest, .Layers]' > local_gst_ci_sha
-
-    # check if our image is already in the upstream registry
-    if [[ -z "$GST_UPSTREAM_REPO" ]]
-    then
-      echo "WARNING! Variable \$GST_UPSTREAM_REPO is undefined, cannot check for images"
-    else
-      skopeo inspect docker://$GST_UPSTREAM_IMAGE | jq '[.Digest, .Layers]' > upstream_sha
-    fi
-
-    # reenable exit on failure
-    set -e
-
-    # if the upstream repo has an image, ensure we use the same
-    if [ -s upstream_sha ]
-    then
-
-      echo "Checking if $LOCAL_IMAGE is up to date"
-      # ensure we use the same image from upstream
-      diff upstream_sha local_sha && exit 0 || true
-
-      echo "Copying image from gstreamer/gst-ci to local registry"
-      # copy the original image into the current project registry namespace
-      # we do 2 attempts with skopeo copy at most
-      skopeo copy --dest-creds $CI_REGISTRY_USER:$CI_REGISTRY_PASSWORD \
-                  docker://$GST_UPSTREAM_IMAGE \
-                  docker://$LOCAL_IMAGE || \
-      skopeo copy --dest-creds $CI_REGISTRY_USER:$CI_REGISTRY_PASSWORD \
-                  docker://$GST_UPSTREAM_IMAGE \
-                  docker://$LOCAL_IMAGE
-
-      exit 0
-    fi
-
-    set +x
-
-    # if the local ci fork repo has an image, ensure we use the same
-    if [ -s local_gst_ci_sha ]
-    then
-      echo "Checking if $LOCAL_GST_CI_IMAGE is up to date"
-      # ensure we use the same image from upstream
-      diff local_gst_ci_sha local_sha && exit 0 || true
-
-      echo "Copying image from $CI_PROJECT_NAMESPACE/gst-ci to local registry"
-      # copy the original image into the current project registry namespace
-      # we do 2 attempts with skopeo copy at most
-      skopeo copy --dest-creds $CI_REGISTRY_USER:$CI_REGISTRY_PASSWORD \
-                  docker://$LOCAL_GST_CI_IMAGE \
-                  docker://$LOCAL_IMAGE || \
-      skopeo copy --dest-creds $CI_REGISTRY_USER:$CI_REGISTRY_PASSWORD \
-                  docker://$LOCAL_GST_CI_IMAGE \
-                  docker://$LOCAL_IMAGE
-
-      exit 0
-    fi
-
-    # if we have a local image but none in the upstream repo, use our
-    if [ -s local_sha ]
-    then
-      echo "Using $LOCAL_IMAGE"
-      exit 0
-    fi
-  fi
-
-
-# Build docker images from Dockerfiles
-#
-# This is copied/adapted from citemplates/templates/fedora.yml
-# https://gitlab.freedesktop.org/freedesktop/ci-templates/-/blob/96b621fe9f57ec2464f8d1a0940446afbf6c8f59/templates/fedora.yml
-#
-# CITemplates builds uses buildah run/commit workflow to build the images which doesn't
-# fit us atm and our images need further adjustment to make use of it. Porting to
-# ci-templates is the next step though.
-#
-# All the documentation from citemplates should be applicable here, so please refer there
-.base:
-  image: "$CI_REGISTRY/freedesktop/ci-templates/buildah:2020-07-20.1"
+# This is an empty job that is used to trigger the pipeline.
+trigger:
+  image: alpine:latest
+  stage: 'preparation'
   variables:
-    STORAGE_DRIVER: 'vfs'
-    BUILDAH_FORMAT: 'docker'
-    BUILDAH_ISOLATION: 'chroot'
+    GIT_STRATEGY: none
   script:
-    - export LOCAL_IMAGE="$CI_REGISTRY_IMAGE/$REPO_SUFFIX:$TAG"
-    - export LOCAL_GST_CI_IMAGE="$CI_REGISTRY/$CI_PROJECT_NAMESPACE/gst-ci/$REPO_SUFFIX:$TAG"
-    - export GST_UPSTREAM_IMAGE="$CI_REGISTRY/$GST_UPSTREAM_REPO/$REPO_SUFFIX:$TAG"
-
-    # check if the docker registry is enabled, else the variable will be missing
-    - |
-      if [[ -z "$CI_REGISTRY_IMAGE" ]]
-      then
-        echo "ERROR! Looks like your repository/fork has disabled Docker Registries."
-        echo "Pleae enable them by following the documentation from here:"
-        echo "https://docs.gitlab.com/ee/user/packages/container_registry/#enable-the-container-registry-for-your-project"
-        exit 1
-      fi
-
-    # Newer versions of podman/buildah try to set overlayfs mount options when
-    # using the vfs driver, and this causes errors.
-    - sed -i '/^mountopt =.*/d' /etc/containers/storage.conf
-
-    - *check_image_exists
-
-    - echo "Building image $LOCAL_IMAGE"
-
-    - >
-      buildah bud
-      --build-arg DEFAULT_BRANCH=$GST_UPSTREAM_BRANCH
-      --label ci.job_id=$CI_JOB_ID
-      --label pipeline.url=$CI_PIPELINE_URL
-      --label git.ref_name=$CI_COMMIT_REF_NAME
-      --label git.sha=$CI_COMMIT_SHA
-      --label gitlab.project_path=$CI_PROJECT_PATH
-      --label gitlab.project_url=$CI_PROJECT_URL
-      --label fdo.upstream-repo=$GST_UPSTREAM_REPO
-      -f $DOCKERFILE
-      -t $LOCAL_IMAGE
-      $CONTEXT_DIR
-
-    - buildah login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY
-
-    # Sanity check
-    - |
-      if [ "$CI_PROJECT_PATH" = "gstreamer/gstreamer" ]; then
-        if [ "$LOCAL_IMAGE" != "$GST_UPSTREAM_IMAGE" ]; then
-          echo "ERROR!!! AAAAA! THE IMAGE URI DOES NOT MATCH THE EXPECTED UPSTREAM ONE"
-          echo $LOCAL_IMAGE
-          echo $GST_UPSTREAM_IMAGE
-          exit 1
-        fi
-      fi
-
-    -  buildah push $LOCAL_IMAGE
+    - echo "Trigger job done, now running the pipeline."
+  rules:
+    # 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, but we want to
+    # automatically trigger the integratation stage
+    - if: '$CI_PROJECT_NAMESPACE == "gstreamer" && $CI_COMMIT_BRANCH == $GST_UPSTREAM_BRANCH && $CI_JOB_STAGE != "integrate"'
+      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
 
-fedora amd64 docker:
-  stage: "build docker"
+.fedora image:
   variables:
-    REPO_SUFFIX: "$FEDORA_AMD64_SUFFIX"
-    TAG: "$FEDORA_TAG-$GST_UPSTREAM_BRANCH"
+    FDO_DISTRIBUTION_VERSION: '31'
+    FDO_REPO_SUFFIX: "$FEDORA_AMD64_SUFFIX"
+    FDO_DISTRIBUTION_TAG: "$FEDORA_TAG-$GST_UPSTREAM_BRANCH"
+    FDO_DISTRIBUTION_EXEC: 'GIT_BRANCH=$CI_COMMIT_REF_NAME GIT_URL=$CI_REPOSITORY_URL bash ci/docker/fedora/prepare.sh'
 
-    CONTEXT_DIR: "ci/docker/fedora/"
-    DOCKERFILE: "ci/docker/fedora/Dockerfile"
-  extends: .base
+fedora amd64 docker:
+  extends:
+    - '.fedora image'
+    - '.fdo.container-build@fedora'
+  stage: 'preparation'
+  needs: []
+  tags:
+    - 'packet.net'
 
-gst-indent amd64 docker:
-  stage: "build docker"
+.gst-indent image:
   variables:
-    REPO_SUFFIX: "$INDENT_AMD64_SUFFIX"
-    TAG: "$INDENT_TAG-$GST_UPSTREAM_BRANCH"
+    FDO_DISTRIBUTION_VERSION: 'stretch'
+    FDO_REPO_SUFFIX: "$INDENT_AMD64_SUFFIX"
+    FDO_DISTRIBUTION_TAG: "$INDENT_TAG-$GST_UPSTREAM_BRANCH"
+    FDO_DISTRIBUTION_PACKAGES: 'curl indent git findutils'
+    FDO_DISTRIBUTION_EXEC: 'ci/docker/indent/prepare.sh'
 
-    CONTEXT_DIR: "ci/docker/indent/"
-    DOCKERFILE: "ci/docker/indent/Dockerfile"
-  extends: .base
+gst-indent amd64 docker:
+  extends:
+    - '.gst-indent image'
+    - '.fdo.container-build@debian'
+  stage: 'preparation'
+  # Do not depend on the trigger, as we want to run indent always
+  needs: []
 
 windows amd64 docker:
-  stage: "build docker"
+  stage: "preparation"
+  needs:
+    - "trigger"
+  timeout: '3h'
   variables:
     # Unlike the buildah/linux jobs, this file
     # needs to be relative to docker/windows/ subdir
@@ -289,7 +166,7 @@ windows amd64 docker:
   tags:
     - windows
     - shell
-    - "1809"
+    - "2022"
   script:
     # We need to pass an array and to resolve the env vars, so we can't use a variable:
     - $DOCKER_BUILD_ARGS = @("--build-arg", "DEFAULT_BRANCH=$GST_UPSTREAM_BRANCH")
@@ -301,109 +178,42 @@ windows amd64 docker:
         Exit 1
       }
 
-.windows rust docker build:
-  stage: 'build docker'
-  needs:
-    - job: 'windows amd64 docker'
-      artifacts: false
-  rules:
-    - if: '$CI_PROJECT_NAME == "gst-ci"'
-  variables:
-    # Unlike the buildah/linux jobs, this file
-    # needs to be relative to docker/windows/ subdir
-    # as it makes life easier in the powershell script
-    #
-    # We also don't need a CONTEXT_DIR var as its also
-    # hardcoded to be docker/windows/
-    DOCKERFILE: 'docker/windows/rust.Dockerfile'
-  tags:
-    - 'windows'
-    - 'shell'
-    - '1809'
-  script:
-    # We need to pass an array and to resolve the env vars, so we can't use a variable:
-    - $DOCKER_BUILD_ARGS = @("--build-arg", "DEFAULT_BRANCH=$GST_UPSTREAM_BRANCH", "--build-arg", "BASE_IMAGE=$WINDOWS_IMAGE", "--build-arg", "RUST_VERSION=$RUST_VERSION")
-
-    - $env:WINDOWS_CONTAINER_SCRIPT_PATH = "$env:CI_PROJECT_DIR\container.ps1"
-    - echo "Fetching $env:WINDOWS_CONTAINER_SCRIPT_URL"
-    - Invoke-WebRequest -Uri $env:WINDOWS_CONTAINER_SCRIPT_URL -OutFile $env:WINDOWS_CONTAINER_SCRIPT_PATH
-
-    - "& $env:WINDOWS_CONTAINER_SCRIPT_PATH $CI_REGISTRY $CI_REGISTRY_USER $CI_REGISTRY_PASSWORD $RUST_IMAGE $RUST_UPSTREAM_IMAGE $DOCKERFILE"
-    - |
-      if (!($?)) {
-        echo "Failed to build the image"
-        Exit 1
-      }
-
-windows rust amd64 docker latest stable:
-  extends: '.windows rust docker build'
-  variables:
-    RUST_IMAGE: !reference [variables, "WINDOWS_RUST_LATEST_IMAGE"]
-    RUST_UPSTREAM_IMAGE: !reference [variables, "WINDOWS_RUST_LATEST_UPSTREAM_IMAGE"]
-    RUST_VERSION: !reference [variables, "RUST_LATEST_VERSION"]
-
-windows rust amd64 docker minimum supported version:
-  extends: '.windows rust docker build'
-  variables:
-    RUST_IMAGE: !reference [variables, "WINDOWS_RUST_MINIMUM_IMAGE"]
-    RUST_UPSTREAM_IMAGE: !reference [variables, "WINDOWS_RUST_MINIMUM_UPSTREAM_IMAGE"]
-    RUST_VERSION: !reference [variables, "RUST_MINIMUM_VERSION"]
-
-
 
 # ---- Preparation ----- #
 #
 # gst-indent!!
 #
 gst indent:
-  image: $INDENT_IMAGE
+  extends:
+    - '.gst-indent image'
+    - '.fdo.suffixed-image@debian'
   stage: 'preparation'
+  needs:
+    - job: 'gst-indent amd64 docker'
+      artifacts: false
   script:
-    # man indent. grep RETURN VALUE, grab a beer on my behalf...
-    - indent --version || true
-    - ./scripts/gst-indent-all
-    - |
-      if git diff --quiet -- ':!subprojects/gst-integration-testsuites/medias' .; then
-          echo "Code is properly formatted"
-      else
-          git diff --color=always -- ':!subprojects/gst-integration-testsuites/medias' .
-          echo 'style diverges, please run gst-indent first'
-          exit 1
-      fi
-
+    - ./scripts/check-format-c
+    - ./scripts/format-csharp --check
   rules:
-    # If the MR is assigned to the Merge bot, trigger the pipeline automatically
-    - if: '$CI_MERGE_REQUEST_ASSIGNEES == "gstreamer-merge-bot"'
-    # 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
-    # If this matches, it means the pipeline is running against either the main
-    # or a stable branch, so make it manual
-    - if: '$CI_COMMIT_BRANCH == $GST_UPSTREAM_BRANCH'
+    # Don't check indentation on post merge pipelines
+    - if: '$CI_PROJECT_NAMESPACE == "gstreamer" && $CI_COMMIT_BRANCH == $GST_UPSTREAM_BRANCH'
       when: 'manual'
-
-#
-# Check "allow-edit" checkbox on merge requests with ci-fairy
-#
-check allow-edit:
-  extends: '.fdo.ci-fairy'
-  needs: []
-  stage: 'preparation'
-  script:
-    - ci-fairy check-merge-request --require-allow-collaboration
-  rules:
-    - if: '$CI_PIPELINE_SOURCE == "merge_request_event"'
+    - if: '$CI_PROJECT_NAMESPACE != "gstreamer" || $CI_COMMIT_BRANCH != $GST_UPSTREAM_BRANCH'
+      when: 'always'
 
 #
 # build setup templates
 #
 .build_template: &build
+  - date -R
+  - ci/scripts/handle-subprojects-cache.py subprojects/
+  - date -R
   - echo $MESON_ARGS
-
+  - date -R
   - meson build/ $MESON_ARGS
+  - date -R
   - ninja -C build/
+  - date -R
   - ccache --show-stats
 
 .build_ccache_vars:
@@ -416,39 +226,10 @@ check allow-edit:
     CCACHE_MAXSIZE: '10G'
     CARGO_HOME: '/cache/gstreamer/cargo'
 
-.simple_fedora_build: &simple_build >-
-  ${DEFAULT_MESON_ARGS}
-  -Dsharp=enabled
-  -Domx=enabled
-  -Dgst-omx:target=generic
-  -Ddoc=disabled
-  -Drs=disabled
-  ${MESON_BUILDTYPE_ARGS}
-  ${MESON_GST_WERROR}
-
-.build:
-  stage: 'build'
-  extends:
-    - '.build_ccache_vars'
-  needs:
-    - "gst indent"
-  # Taking into account the slowest shared runner + time needed to upload the binaries to artifacts
-  # Also need to take into account I/O of pulling docker images and uploading artifacts
-  timeout: '45min'
-  variables:
-    MESON_ARGS: "${DEFAULT_MESON_ARGS} ${MESON_BUILDTYPE_ARGS} ${MESON_GST_WERROR}"
-  script:
-    *build
-  after_script:
-    - mv build/meson-logs/ meson-logs
-  artifacts:
-    expire_in: "7 days"
-    when: "always"
-    paths:
-      - 'meson-logs/'
-
 .base_modules_changes: &modules_changes
   - .gitlab-ci.yml
+  - gst-env.py
+  - ci/gitlab/*.py
   - meson.build
   - subprojects/*.wrap
   - subprojects/gst-devtools/**/*
@@ -480,17 +261,17 @@ check allow-edit:
   stage: 'build'
   extends:
     - '.build_ccache_vars'
+  needs:
+    - "trigger"
   # Taking into account the slowest shared runner + time needed to upload the binaries to artifacts
   # Also need to take into account I/O of pulling docker images and uploading artifacts
   timeout: '45min'
   variables:
     MESON_ARGS: "${DEFAULT_MESON_ARGS} ${MESON_BUILDTYPE_ARGS} ${MESON_GST_WERROR}"
-  before_script:
-    - ci/scripts/handle-subprojects-cache.py subprojects/
-    # Update subprojects to respect `.wrap` content
-    - meson subprojects update --reset
   script:
-    *build
+    - *build
+    - ./gst-env.py gst-inspect-1.0 --version
+    - ./gst-env.py gst-inspect-1.0
   after_script:
     - mv build/meson-logs/ meson-logs
   artifacts:
@@ -498,31 +279,50 @@ check allow-edit:
     when: "always"
     paths:
       - 'meson-logs/'
-
-.build fedora x86_64:
-  extends: '.build'
-  image: $FEDORA_IMAGE
-  variables:
-    MESON_ARGS: *simple_build
   rules:
+    # If this matches, it means the pipeline is running against either the main
+    # or a stable branch, so make it manual
+    - if: '$CI_PROJECT_NAMESPACE == "gstreamer" && $CI_COMMIT_BRANCH == $GST_UPSTREAM_BRANCH'
+      when: manual
     - changes:
         *modules_changes
 
-build nodebug fedora x86_64:
-  extends: '.build'
-  image: $FEDORA_IMAGE
+.build fedora x86_64:
+  extends:
+    - '.fedora image'
+    - '.fdo.suffixed-image@fedora'
+    - '.build'
+  needs:
+    - "trigger"
+    - "fedora amd64 docker"
   variables:
-    MESON_ARGS: "${DEFAULT_MESON_ARGS} -Dsharp=enabled -Dgstreamer:gst_debug=false -Domx=enabled -Dgst-omx:target=generic ${MESON_BUILDTYPE_ARGS} ${MESON_GST_WERROR}"
+    MESON_ARGS: *simple_build
 
-build static fedora x86_64:
-  extends: '.build fedora x86_64'
-  variables:
-    MESON_BUILDTYPE_ARGS: "--default-library=static -Dintrospection=disabled -Ddoc=disabled"
+build fedora x86_64:
+  extends:
+    - '.fedora image'
+    - '.fdo.suffixed-image@fedora'
+    - '.build fedora x86_64'
+  needs:
+    - "trigger"
+    - "fedora amd64 docker"
+  script:
+    - *build
+    - ./gst-env.py gst-inspect-1.0 --version
+    - ./gst-env.py gst-inspect-1.0
+    - meson install --destdir $CI_PROJECT_DIR/destdir -C build
+    - rm -rf $CI_PROJECT_DIR/destdir
 
-build static nodebug fedora x86_64:
-  extends: 'build nodebug fedora x86_64'
+build nodebug fedora x86_64:
+  extends:
+    - '.fedora image'
+    - '.fdo.suffixed-image@fedora'
+    - '.build'
+  needs:
+    - "trigger"
+    - "fedora amd64 docker"
   variables:
-    MESON_BUILDTYPE_ARGS: "--default-library=static -Dintrospection=disabled -Ddoc=disabled"
+    MESON_ARGS: "${DEFAULT_MESON_ARGS} -Dsharp=enabled -Dgstreamer:gst_debug=false -Domx=enabled -Dgst-omx:target=generic ${MESON_BUILDTYPE_ARGS} ${MESON_GST_WERROR}"
 
 build clang fedora x86_64:
   extends: '.build fedora x86_64'
@@ -536,9 +336,10 @@ build clang fedora x86_64:
   tags:
     - 'docker'
     - 'windows'
-    - '1809'
+    - '2022'
   needs:
-    - "gst indent"
+    - "trigger"
+    - "windows amd64 docker"
   timeout: '45min'
   variables:
     MESON_ARGS: >
@@ -548,35 +349,71 @@ build clang fedora x86_64:
       -Dvaapi=disabled
       -Dgst-plugins-base:pango=enabled
       -Dgst-plugins-good:cairo=enabled
+    # Needs to not be empty otherwise the newline -> space replace command in
+    # `script:` will fail
+    MESON_CROSS_ARGS: ' '
   rules:
+    # If this matches, it means the pipeline is running against either the main
+    # or a stable branch, so make it manual
+    - if: '$CI_PROJECT_NAMESPACE == "gstreamer" && $CI_COMMIT_BRANCH == $GST_UPSTREAM_BRANCH'
+      when: manual
     - changes:
         *modules_changes
-  before_script:
-    - ci/scripts/handle-subprojects-cache.py subprojects/
+    - changes:
+        - subprojects/win-*/*
   script:
+    # Make sure powershell exits on errors
+    # https://docs.microsoft.com/en-us/powershell/module/microsoft.powershell.core/about/about_preference_variables?view=powershell-6
+    - $ErrorActionPreference = "Stop"
+
+    # Set the code page to UTF-8
+    - chcp 65001
+
+    - ci/scripts/handle-subprojects-cache.py subprojects/
     # For some reason, options are separated by newline instead of space, so we
     # have to replace them first.
     - $env:MESON_ARGS = $env:MESON_ARGS.replace("`n"," ")
+    - $env:MESON_CROSS_ARGS = $env:MESON_CROSS_ARGS.replace("`n"," ")
     - cmd.exe /C "C:\BuildTools\Common7\Tools\VsDevCmd.bat -host_arch=amd64 -arch=$env:ARCH &&
-        meson build $env:MESON_ARGS &&
-        ninja -C build"
-  # XXX: Re-enable when uploading stops timing out
-  #artifacts:
-  #  expire_in: "7 days"
-  #  when: "always"
-  #  paths:
-  #    - 'build/meson-logs/'
-
-build vs2017 amd64:
+        meson build $env:MESON_ARGS $env:MESON_CROSS_ARGS &&
+        meson compile -C build"
+  artifacts:
+   expire_in: "7 days"
+   when: "always"
+   paths:
+     - 'build/meson-logs/'
+
+build vs2019 amd64:
   extends: '.build windows'
   variables:
     ARCH: 'amd64'
+  script:
+    - !reference [".build windows", "script",]
+    - cmd.exe /C "C:\BuildTools\Common7\Tools\VsDevCmd.bat -host_arch=amd64 -arch=$env:ARCH &&
+        .\gst-env.py gst-inspect-1.0.exe --version &&
+        .\gst-env.py gst-inspect-1.0.exe &&
+        mkdir .\destdir &&
+        meson install --destdir=$env:CI_PROJECT_DIR\destdir -C build &&
+        rmdir /s /q  $env:CI_PROJECT_DIR\destdir"
 
-build vs2017 x86:
+build vs2019 x86:
   extends: '.build windows'
   variables:
     ARCH: 'x86'
 
+build vs2019 arm64 uwp:
+  extends: '.build windows'
+  variables:
+    ARCH: 'arm64'
+    # pango pulls in cairo which pulls in pixman which doesn't build because of
+    # https://github.com/mesonbuild/meson/issues/9889
+    MESON_CROSS_ARGS: >
+      -Dgst-plugins-base:pango=disabled
+      -Dgst-plugins-good:cairo=disabled
+      -Dgst-devtools:cairo=disabled
+      --cross-file ci/meson/vs2019-arm64-cross-file.txt
+      --native-file ci/meson/vs2019-x64-native-file.txt
+
 build msys2 :
   extends: '.build windows'
   timeout: '60min'
@@ -586,30 +423,24 @@ build msys2 :
       allow_failure: true
       when: 'manual'
   script:
-    # Make sure powershell exists on errors
+    # Make sure powershell exits on errors
     # https://docs.microsoft.com/en-us/powershell/module/microsoft.powershell.core/about/about_preference_variables?view=powershell-6
     - $ErrorActionPreference = "Stop"
 
-    # For some reason docker build hangs if this is included in the image, needs more troubleshooting
-    - $env:PATH += ';C:\msys64\usr\bin;C:\msys64\mingw64\bin;C:\msys64\mingw32\bin'
-    # Copied from https://github.com/msys2/setup-msys2/blob/master/main.js#L98
-    - C:\msys64\usr\bin\bash -c "pacman-key --init && pacman-key --populate msys2 && pacman-key --refresh-keys || true"
-    - C:\msys64\usr\bin\bash -c "sed -i 's/^CheckSpace/#CheckSpace/g' /etc/pacman.conf"
-    - echo "Updating MSYS2"
-    - C:\msys64\usr\bin\bash -c "pacman -Syuu --noconfirm || echo Update failed, ignoring"
-    - echo "Killing all MSYS2 processes"
-    - taskkill /F /FI "MODULES eq msys-2.0.dll"
-    - echo "Completing MSYS2 update"
-    - C:\msys64\usr\bin\bash -c "pacman -Suu --noconfirm"
-    - echo "Installing needed MSYS2 packages"
-    - C:\msys64\usr\bin\bash -c "pacman -Sy --noconfirm --needed mingw-w64-x86_64-toolchain ninja"
+    # Set the code page to UTF-8
+    - chcp 65001
 
+    # Configure MSYS2 to use the UCRT64 environment, start in the same directory
+    # and inherit PATH
+    - $env:MSYSTEM = "UCRT64"
+    - $env:CHERE_INVOKING = "1"
+    - $env:MSYS2_PATH_TYPE = "inherit"
     # For some reason, options are separated by newline instead of space, so we
     # have to replace them first.
     - $env:MESON_ARGS = $env:MESON_ARGS.replace("`n"," ")
     # Replace forward slashes with backwards so bash doesn't complain
     - $env:_PROJECT_DIR = $env:CI_PROJECT_DIR.replace('\','/')
-    - C:\msys64\usr\bin\bash -c "meson build $env:MESON_ARGS && ninja -C build"
+    - C:\msys64\usr\bin\bash -lc "meson build $env:MESON_ARGS && ninja -C build"
 
 # ---- Tests ----- #
 
@@ -618,7 +449,7 @@ build msys2 :
   extends:
     - '.build_ccache_vars'
   needs:
-    - "gst indent"
+    - "trigger"
   variables:
     MESON_ARGS: *simple_build
 
@@ -641,6 +472,7 @@ build msys2 :
     - >
       ./gst-env.py
       gst-validate-launcher ${TEST_SUITE}
+      --check-bugs
       --dump-on-failure
       --mute
       --shuffle
@@ -664,8 +496,13 @@ build msys2 :
         - "validate-logs/*.xml"
 
 .test fedora x86_64:
-  image: $FEDORA_IMAGE
-  extends: '.test'
+  extends:
+    - '.fedora image'
+    - '.fdo.suffixed-image@fedora'
+    - '.test'
+  needs:
+    - "trigger"
+    - "fedora amd64 docker"
   tags: ['gstreamer']
 
 check fedora:
@@ -675,27 +512,35 @@ check fedora:
 
 integration testsuites fedora:
   extends: '.test fedora x86_64'
-  parallel: 4
+  parallel: 8
   variables:
-    EXTRA_VALIDATE_ARGS: "--timeout-factor=2 --retry-on-failures --check-bugs --parts=${CI_NODE_TOTAL} --part-index=${CI_NODE_INDEX}"
+    MESON_BUILDTYPE_ARGS: >
+      -Domx=disabled
+      -Dsharp=disabled
+      -Dvaapi=disabled
+      -Dexamples=disabled
+      -Dgst-examples=disabled
+      -Dtests=disabled
+      -Dnls=disabled
+      -Dqt5=disabled
+      -Dgstreamer:benchmarks=disabled
+      -Dgst-plugins-good:gtk3=disabled
+      -Dgst-plugins-bad:microdns=disabled
+      -Dgst-plugins-bad:avtp=disabled
+      -Dgst-plugins-bad:opencv=disabled
+      -Dgst-plugins-bad:webrtc=disabled
+    EXTRA_VALIDATE_ARGS: "--timeout-factor=2 --retry-on-failures --parts=${CI_NODE_TOTAL} --part-index=${CI_NODE_INDEX} --sync"
     TEST_SUITE: "validate ges"
 
 # gstreamer-full:
-# introspection has been disabled as the static build does not support it.
-# See https://gitlab.freedesktop.org/gstreamer/gst-build/-/issues/162
-gstreamer-full:
-  extends: 'build static fedora x86_64'
-  stage: integrate
+gstreamer-full static build:
+  extends: '.build fedora x86_64'
+  stage: 'build'
   variables:
     MESON_ARGS: >
       --default-library=static
-      -Dintrospection=disabled
+      -Ddoc=disabled
       $MESON_GST_WERROR
-  rules:
-    - changes:
-      - "*"
-      - scripts/*
-      - subprojects/gst-ci/**/*
 
   script:
   - *build
@@ -706,12 +551,14 @@ gstreamer-full:
     paths:
       - 'meson-logs/'
 
-gstreamer-full-minimal:
-  extends: 'build static fedora x86_64'
-  stage: integrate
+gstreamer-full-minimal static build:
+  extends: 'gstreamer-full static build'
+  stage: 'build'
   variables:
     MESON_ARGS: >
       --default-library=static
+      -Ddoc=disabled
+      -Dgstreamer:gst_debug=false
       -Dauto_features=disabled
       -Dgstreamer:check=enabled
       -Dtests=enabled
@@ -723,8 +570,6 @@ gstreamer-full-minimal:
       -Dgst-full-device-providers=alsa:alsadeviceprovider
       -Dgst-full-dynamic-types=pbtypes:video_multiview_flagset
       $MESON_GST_WERROR
-  rules:
-    - if: '$CI_PROJECT_NAME =~ /^(gst-build|gst-ci)$/'
 
   script:
   - *build
@@ -753,7 +598,7 @@ valgrind core:
     - changes:
       - "*"
       - scripts/*
-      - subprojects/gst-ci/**/*
+      - ci/**/*
       - subprojects/gst-devtools/**/*
       - subprojects/gstreamer/**/*
 
@@ -765,7 +610,7 @@ valgrind base:
     - changes:
       - "*"
       - scripts/*
-      - subprojects/gst-ci/**/*
+      - ci//**/*
       - subprojects/gst-devtools/**/*
       - subprojects/gstreamer/**/*
       - subprojects/gst-plugins-base/**/*
@@ -780,7 +625,7 @@ valgrind good:
     - changes:
       - "*"
       - scripts/*
-      - subprojects/gst-ci/**/*
+      - ci/**/*
       - subprojects/gst-devtools/**/*
       - subprojects/gstreamer/**/*
       - subprojects/gst-plugins-base/**/*
@@ -794,7 +639,7 @@ valgrind ugly:
     - changes:
       - "*"
       - scripts/*
-      - subprojects/gst-ci/**/*
+      - ci/**/*
       - subprojects/gst-devtools/**/*
       - subprojects/gstreamer/**/*
       - subprojects/gst-plugins-base/**/*
@@ -809,7 +654,7 @@ valgrind bad:
     - changes:
       - "*"
       - scripts/*
-      - subprojects/gst-ci/**/*
+      - ci/**/*
       - subprojects/gst-devtools/**/*
       - subprojects/gstreamer/**/*
       - subprojects/gst-plugins-base/**/*
@@ -824,30 +669,44 @@ valgrind ges:
     - changes:
       - "*"
       - scripts/*
-      - subprojects/gst-ci/**/*
+      - ci/**/*
       - subprojects/gst-devtools/**/*
       - subprojects/gstreamer/**/*
       - subprojects/gst-plugins-base/**/*
       - subprojects/gst-plugins-good/**/*
       - subprojects/gst-plugins-bad/**/*
       - subprojects/gst-editing-services/**/*
+      - subprojects/gst-python/**/*
+  # valgrind ges jobs are racy across the board and simply fail too often.
+  # Someone needs to go through job logs and figure out which jobs to mark
+  # as flaky. Until then, just ignore failures.
+  allow_failure: true
 
 # ---- Integration ----- #
 
 .documentation:
-  image: $FEDORA_DOCS_IMAGE
-  extends:
-    - '.build_ccache_vars'
+  extends: '.build fedora x86_64'
   variables:
     MESON_ARGS: *simple_build
-    MESON_BUILDTYPE_ARGS: "-Ddoc=enabled"
+    MESON_BUILDTYPE_ARGS: "-Ddoc=enabled -Drs=enabled -Dgst-docs:fatal_warnings=true"
+    # Disable werror for the docs build, we don't need it
+    MESON_GST_WERROR: ''
     CI_ARTIFACTS_URL: "${CI_PROJECT_URL}/-/jobs/${CI_JOB_ID}/artifacts/raw/"
   script:
-  - pip3 install --upgrade hotdoc
-  - *build
+  - export PATH=/usr/local/cargo/bin/:/usr/local/bin/:$PATH
+  - export RUSTUP_HOME='/usr/local/rustup'
+
+  - ci/scripts/handle-subprojects-cache.py subprojects/
+  - echo $MESON_ARGS
+  - meson build/ $MESON_ARGS
+  - ccache --show-stats
+
   - ./gst-env.py ninja -C build/ plugins_doc_caches
+  # Ignore modifications to wrap files made by meson
+  - git checkout subprojects/*.wrap
   - ./ci/scripts/check-documentation-diff.py
-  - ./gst-env.py hotdoc run --conf-file=build/subprojects/gst-docs/GStreamer-doc.json --fatal-warnings
+
+  - ./gst-env.py ninja -C build subprojects/gst-docs/GStreamer-doc
   - mv build/subprojects/gst-docs/GStreamer-doc/html documentation/
 
   artifacts:
@@ -857,26 +716,37 @@ valgrind ges:
     - documentation/
     - plugins-cache-diffs/
 
+#
+# This jobs runs in gstreamer namespace when after the merge into main branch.
+# The produced artifact is later used to automatically update the web page.
+#
 documentation:
   stage: integrate
   extends:
     - '.documentation'
-  needs: []
+  needs:
+    - "fedora amd64 docker"
   rules:
     - if: '$CI_PROJECT_NAMESPACE == "gstreamer" && $CI_COMMIT_BRANCH == "main"'
 
+#
+# This job is run in users namespace to validate documentation before merging
+# MR.
+#
 build documentation:
   extends:
     - '.documentation'
   stage: build
   needs:
-    - "gst indent"
-
-  stage: build
+    - "trigger"
+    - "fedora amd64 docker"
   rules:
+    # Never run post merge, we have the `documentation` always running for that
+    - if: '$CI_PROJECT_NAMESPACE == "gstreamer" && $CI_COMMIT_BRANCH == $GST_UPSTREAM_BRANCH'
+      when: never
     - changes:
       - .gitlab-ci.yml
-      - ci/gitlab/freedesktop_doc_importer.sh
+      - ci/gitlab/*.py
       - subprojects/*.wrap
       - subprojects/gst-docs/**/*
       - subprojects/gst-devtools/**/*
@@ -895,19 +765,25 @@ build documentation:
 # https://gitlab.com/gitlab-org/gitlab/-/issues/341737
 cerbero trigger:
   stage: build
-  image: $FEDORA_IMAGE
+  timeout: '4h'
+  tags:
+    - placeholder-job
+  extends:
+    - '.fedora image'
+    - '.fdo.suffixed-image@fedora'
+  needs:
+    - "trigger"
+    - "fedora amd64 docker"
   script:
-    - python3 -m pip install --user python-gitlab
     - ci/gitlab/trigger_cerbero_pipeline.py
 
-  variables:
-    # Use GST_UPSTREAM_BRANCH
-    UPSTREAM_BRANCH: 'main'
-
   rules:
+    # Never run post merge
+    - if: '$CI_PROJECT_NAMESPACE == "gstreamer" && $CI_COMMIT_BRANCH == $GST_UPSTREAM_BRANCH'
+      when: never
     - changes:
       - .gitlab-ci.yml
-      - ci/gitlab/tigger_cerbero_pipeline.py
+      - ci/gitlab/*.py
       - subprojects/gst-devtools/**/*
       - subprojects/gst-editing-services/**/*
       - subprojects/gst-libav/**/*
@@ -918,4 +794,4 @@ cerbero trigger:
       - subprojects/gst-python/**/*
       - subprojects/gstreamer/**/*
       - subprojects/gst-rtsp-server/**/*
-      - subprojects/gst-examples/**/*
\ No newline at end of file
+      - subprojects/gst-examples/**/*