gnome-control-center/.gitlab-ci.yml
Georges Basile Stavracas Neto 2520aea647 info: use UDisks to retrieve disk size
The current code relies on GLib API and uses the
available mounts to calculate the available partition
size. This is because this code assumes that more
than one OS can be installed in the same drive, and
wouldn't make sense to show the whole disk size in
this situation.

That, however, clashes with the general purpose of
the panel, for it is meant to show general information
about the user's computer, and it is not reporting
the full disk size.

Fix that by using the UDisks API to get the real size
of the full disks.

https://bugzilla.gnome.org/show_bug.cgi?id=639376

Slighly modified by Iain Lane <iainl@gnome.org> to
port to meson and add udisks2 to CI deps.

Fixes #285.
Fixes #302.
2019-02-13 17:04:26 +00:00

407 lines
9.5 KiB
YAML

image: registry.gitlab.gnome.org/gnome/gnome-control-center:fedora.dev
stages:
- build
- test
- manual
- review
- deploy
.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
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
.Run Tests: &run_tests
echo "== Testing ==" &&
ninja -C _build test
##
# 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:
- dnf -y install libudisks2-devel # FIXME: Remove when new images built
- *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
except:
variables:
- $CI_PIPELINE_SOURCE == "schedule"
##
# Stage: Test
#
# Runs the unit tests.
##
test:
<<: *save_build_logs
stage: test
dependencies:
- build
script:
- *environment_information
- dnf -y install libudisks2-devel # FIXME: Remove when new images built
- |
if [[ -n "${CI_COMMIT_TAG}" ]]; then
*run_tests
echo "== Distro Test =="
ninja dist -C _build
else
echo "== Testing =="
meson test -C _build --verbose --no-stdsplit
fi
except:
variables:
- $CI_PIPELINE_SOURCE == "schedule"
- $CI_COMMIT_TITLE =~ /^Update.*translation$/
# Runs the coverage test.
coverage:
<<: *save_build_logs
stage: test
variables:
BUILD_OPTS: "-Db_coverage=true"
coverage: '/^Lines:.\d+.\d+.(\d+\.\d+\%)/'
only:
- master@GNOME/gnome-control-center
script:
- *environment_information
- *build_procedure
- *run_tests
- 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
except:
variables:
- $CI_PIPELINE_SOURCE == "schedule"
- $CI_COMMIT_TITLE =~ /^Update.*translation$/
# Runs the address sanitizer.
# - below, at the "sanitizers section"
##
# Stage: Deploy
#
# Publishes the Coverage Report generated above
##
pages:
stage: deploy
dependencies:
- coverage
script:
- mv _build/meson-logs/coveragereport/ public/
artifacts:
paths:
- public
only:
- master@GNOME/gnome-control-center
except:
variables:
- $CRON_TASK == "BUILD_CI_IMAGES"
- $CI_COMMIT_TITLE =~ /^Update.*translation$/
##
# Stage: Manual
#
# Creates a flatpak
##
flatpak:
stage: manual
image: registry.gitlab.gnome.org/gnome/gnome-runtime-images/gnome:master
artifacts:
name: package
paths:
- $(pwd)/*.flatpak
expire_in: 7 days
variables:
OLD_APPID: "org.gnome.Settings"
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\" : \"<<ID>>\",g" ${MANIFEST_PATH}
- >
sed -i "s,\"url\" : \"https://gitlab.gnome.org/GNOME/$PROJECT_NAME\",\"branch\" : \"<<current>>\"\,,g" ${MANIFEST_PATH}
- >
sed -i "s,\"url\" : \"https://gitlab.gnome.org/GNOME/\",\"path\" : \".\",g" ${MANIFEST_PATH}
# Adjust the manifest to HEAD
- sed -i "s,<<ID>>,$APPID,g" ${MANIFEST_PATH}
- sed -i "s,<<current>>,origin/$CI_COMMIT_REF_NAME,g" ${MANIFEST_PATH}
# Update the icon name
- mv data/icons/hicolor/scalable/apps/$OLD_APPID.svg data/icons/hicolor/scalable/apps/$APPID.svg
- mv data/icons/hicolor/symbolic/apps/$OLD_APPID-symbolic.svg data/icons/hicolor/symbolic/apps/$APPID-symbolic.svg
- flatpak-builder --bundle-sources --repo=devel build ${MANIFEST_PATH}
- flatpak build-bundle devel ${BUNDLE} --runtime-repo=${RUNTIME_REPO} ${APPID}
cache:
paths:
- .flatpak-builder/cache
when: manual
except:
- tags
- gnome-3-.*
- master@GNOME/gnome-control-center
##
# Review
#
# Stage: review
#
# Starts the Flatpak review process.
##
review:
stage: review
dependencies:
- flatpak
when: manual
variables:
BUNDLE: "org.gnome.SettingsDevel.flatpak"
script:
- echo "Generating flatpak deployment"
artifacts:
paths:
- ${BUNDLE}
expire_in: 30 days
environment:
name: review/$CI_COMMIT_REF_NAME
url: https://gitlab.gnome.org/$CI_PROJECT_PATH/-/jobs/$CI_JOB_ID/artifacts/raw/${BUNDLE}
on_stop: stop_review
except:
- tags
- gnome-3-.*
- master@GNOME/gnome-control-center
##
# Stop Review
#
# Stage: review
#
# Stops the Flatpak review process.
##
stop_review:
stage: review
script:
- echo "Stopping flatpak deployment"
when: manual
environment:
name: review/$CI_COMMIT_REF_NAME
action: stop
except:
variables:
- $CI_PIPELINE_SOURCE == "schedule"
# Runs the sanitizers [address, thread, undefined, and memory].
.sanitizer: &sanitizer
<<: *save_build_logs
stage: manual
when: manual
script:
- dnf -y install libudisks2-devel # FIXME: Remove when new images built
- *environment_information
- *build_procedure
- *run_tests
except:
variables:
- $CI_PIPELINE_SOURCE == "schedule"
- $CI_COMMIT_TITLE =~ /^Update.*translation$/
asan:
<<: *sanitizer
stage: test
when: on_success
variables:
BUILD_OPTS: "-Db_sanitize=address"
LSAN_OPTIONS: "suppressions=${CI_PROJECT_DIR}/build-aux/ci/lsan.supp"
tsan:
<<: *sanitizer
variables:
BUILD_OPTS: "-Db_sanitize=thread"
ubsan:
<<: *sanitizer
variables:
BUILD_OPTS: "-Db_sanitize=undefined"
msan:
<<: *sanitizer
variables:
BUILD_OPTS: "-Db_sanitize=memory"
CC: "clang"
# Runs multiarch build test.
.qemu: &multiarch
<<: *save_build_logs
image: docker:latest
services:
- docker:dind
script:
# Register QEMU archs
- docker run --rm --privileged multiarch/qemu-user-static:register --reset
# Run the multiarch test job using QEMU
- 'docker run -v $(pwd):/cwd $IMAGE bash -e -c "cd /cwd &&
echo == Building == &&
rm -rf _build/ &&
meson . _build ${BUILD_OPTS} &&
ninja -C _build 2>&1 | tee compilation.log &&
echo == Testing == &&
ninja -C _build test"
'
except:
variables:
- $CI_PIPELINE_SOURCE == "schedule"
- $CI_COMMIT_TITLE =~ /^Update.*translation$/
armv8:
<<: *multiarch
stage: manual
when: manual
variables:
DOCKER_DRIVER: overlay
IMAGE: "registry.gitlab.gnome.org/gnome/gnome-control-center:fedora.aarch64"
ppc64le:
<<: *multiarch
stage: manual
when: manual
allow_failure: true
variables:
DOCKER_DRIVER: overlay
IMAGE: "registry.gitlab.gnome.org/gnome/gnome-control-center:fedora.ppc64le"
#############################################
# Create CI Docker Images #
#############################################
.Docker image template: &create_docker_image
image: docker:latest
stage: deploy
services:
- docker:dind
only:
variables:
- $CRON_TASK == "BUILD_CI_IMAGES"
script:
# Skip the build (if requested)
- |
if [[ -z "${CI_COMMIT_MESSAGE##*'[skip images]'*}" ]]; then
echo "== Nothing to do =="
exit 0
fi
# Get multiarch stuff
- |
if [[ -n "${TARGET_ARCH}" ]]; then
docker run --rm --privileged multiarch/qemu-user-static:register --reset
wget https://github.com/multiarch/qemu-user-static/releases/download/v2.12.0/x86_64_qemu-${TARGET_ARCH}-static.tar.gz
fi
# Build using the Dockerfile
- docker build -f "$DOCKERFILE" -t "$CI_REGISTRY_IMAGE:$NAME" .
# Prepare to publish
- docker tag "$CI_REGISTRY_IMAGE:$NAME" "$CI_REGISTRY_IMAGE:job-"$CI_JOB_ID"_$NAME"
- docker images
- docker login ${CI_REGISTRY} -u ${CI_REGISTRY_USER} -p ${CI_REGISTRY_PASSWORD}
# Publish (if running on a schedule)
- |
if [[ "${CI_PIPELINE_SOURCE}" == "schedule" ]]; then
docker push "$CI_REGISTRY_IMAGE"
fi
fedora.dev:
<<: *create_docker_image
variables:
DOCKER_DRIVER: overlay
DOCKERFILE: "build-aux/ci/Dockerfile.fedora.rawhide"
NAME: "fedora.dev"
fedora.aarch64:
<<: *create_docker_image
variables:
DOCKER_DRIVER: overlay
DOCKERFILE: "build-aux/ci/Dockerfile.arm64v8.fedora.rawhide"
NAME: "fedora.aarch64"
TARGET_ARCH: "aarch64"
fedora.ppc64le:
<<: *create_docker_image
variables:
DOCKER_DRIVER: overlay
DOCKERFILE: "build-aux/ci/Dockerfile.ppc64le.fedora.rawhide"
NAME: "fedora.ppc64le"
TARGET_ARCH: "ppc64le"