image: claudioandre/settings:job-502.6_fedora.dev # temporarily pinned to old tag stages: - build - test - delivery .Log files: &log_files [./*.log, _build/meson-logs/] .Build logs: &save_build_logs artifacts: name: log when: always paths: *log_files .Git Untracked files: &save_untracked_files artifacts: name: untracked paths: [$(pwd)] expire_in: 3h30min .Show Info: &environment_information echo "== Info ==" && build-aux/ci/ci-helper.sh "INFO" && build-aux/ci/ci-helper.sh "GIT_INFO" .Build procedure: &build_procedure echo "== Building ==" && rm -rf _build/ && meson . _build ${BUILD_OPTS} && ninja -C _build 2>&1 | tee compilation.log ## # Stage: Build # # Checks if GNOME Control Center is properly building and installing. This is the # most important stage of the CI, and no MR should ever be merged if it breaks # any of them. ## build: <<: *save_untracked_files stage: build script: - *environment_information - *build_procedure - echo "== Installing ==" - ninja -C _build install - echo "== Report ==" - build-aux/ci/ci-helper.sh "WARNINGS" # Save all but git-related files - rm -rf .git .gitignore .gitmodules ## # Stage: Test # # Runs the unit tests. ## test: <<: *save_build_logs stage: test dependencies: - build script: - *environment_information - | if [[ -n "${CI_COMMIT_TAG}" ]]; then echo "== Distro Test ==" meson test -C _build ninja dist -C _build else echo "== Testing ==" meson test -C _build --verbose --no-stdsplit fi ## # Stage: Test # # Runs the coverage test. ## coverage: <<: *save_build_logs stage: test variables: BUILD_OPTS: "-Db_coverage=true" coverage: '/^Lines:.\d+.\d+.(\d+\.\d+\%)/' script: - *environment_information - *build_procedure - echo "== Testing ==" - ninja -C _build test - ninja -C _build coverage-html # Parse the report to get the coverage result - | echo == Coverage == sed -e 's/<[^>]*>//g' _build/meson-logs/coveragereport/index.html | tr -d ' \t' | grep -A3 -P '^Lines:$' | tr '\n' ' '; echo ## # Stage: Delivery # # Publish the Coverage Report generated above ## pages: stage: delivery dependencies: - coverage script: - mv _build/meson-logs/coveragereport/ public/ artifacts: paths: - public only: - master@GNOME/gnome-control-center ## # Stage: Test # # Runs the address sanitizer. ## asan: <<: *save_build_logs stage: test allow_failure: true variables: BUILD_OPTS: "-Db_sanitize=address" script: - *environment_information - *build_procedure - export LSAN_OPTIONS="suppressions=$(pwd)/build-aux/ci/lsan.supp" - echo "== Testing ==" - ninja -C _build test ## # Stage: Delivery # # Create a flatpak ## packaging: stage: delivery image: claudioandre/settings:fedora.flatpak artifacts: name: package paths: - $(pwd)/*.flatpak variables: APPID: "org.gnome.SettingsDevel" BUNDLE: "org.gnome.SettingsDevel.flatpak" MANIFEST_PATH: "org.gnome.Settings.json" PATCHES: "build-aux/flatpak/*.patch" PROJECT_FILE: "build-aux/flatpak/org.gnome.Settings.json" PROJECT_ID: "org.gnome.Settings" PROJECT_NAME: "gnome-control-center.git" RUNTIME_REPO: "https://sdk.gnome.org/gnome-nightly.flatpakrepo" script: - echo "== Flatpak packaging ==" # Move needed files to the root folder - cp ${PATCHES} . || true - cp ${PROJECT_FILE} ${MANIFEST_PATH} # Make it a develoment manifest - sed -i -n "p; s/$PROJECT_NAME//p" ${MANIFEST_PATH} - > sed -i "s,\"app-id\" : \"$PROJECT_ID\",\"app-id\" : \"<>\",g" ${MANIFEST_PATH} - > sed -i "s,\"url\" : \"https://gitlab.gnome.org/GNOME/$PROJECT_NAME\",\"branch\" : \"<>\"\,,g" ${MANIFEST_PATH} - > sed -i "s,\"url\" : \"https://gitlab.gnome.org/GNOME/\",\"path\" : \".\",g" ${MANIFEST_PATH} # Adjust the manifest to HEAD - sed -i "s,<>,$APPID,g" ${MANIFEST_PATH} - sed -i "s,<>,origin/$CI_COMMIT_REF_NAME,g" ${MANIFEST_PATH} - flatpak-builder --bundle-sources --repo=devel build ${MANIFEST_PATH} - flatpak build-bundle devel ${BUNDLE} --runtime-repo=${RUNTIME_REPO} ${APPID} cache: paths: - .flatpak-builder/cache environment: name: review/$CI_COMMIT_REF_NAME url: https://gitlab.gnome.org/$CI_PROJECT_PATH/-/jobs/$CI_JOB_ID/artifacts/raw/${BUNDLE} when: manual