Merge branch 'ci-docs' into 'master'

Restructure CI jobs

See merge request GNOME/gtk!1476
This commit is contained in:
Emmanuele Bassi 2020-02-25 19:47:57 +00:00
commit 06ff60aa35
4 changed files with 61 additions and 30 deletions

View File

@ -1,8 +1,9 @@
stages:
- style-check
- build
- deploy
- analysis
- docs
- flatpak
- deploy
.cache-paths: &cache-paths
paths:
@ -26,14 +27,14 @@ variables:
style-check-diff:
extends: .only-default
image: registry.gitlab.gnome.org/gnome/gtk/fedora:v13
stage: style-check
image: registry.gitlab.gnome.org/gnome/gtk/fedora:v14
stage: .pre
allow_failure: true
script:
- .gitlab-ci/run-style-check-diff.sh
fedora-x86_64:
image: registry.gitlab.gnome.org/gnome/gtk/fedora:v13
image: registry.gitlab.gnome.org/gnome/gtk/fedora:v14
stage: build
variables:
EXTRA_MESON_FLAGS: "--buildtype=debug --default-library=both"
@ -65,7 +66,7 @@ fedora-x86_64:
<<: *cache-paths
release-build:
image: registry.gitlab.gnome.org/gnome/gtk/fedora:v13
image: registry.gitlab.gnome.org/gnome/gtk/fedora:v14
stage: build
variables:
EXTRA_MESON_FLAGS: "--buildtype=release"
@ -166,18 +167,39 @@ flatpak-master:icon-browser:
APPID: org.gtk.IconBrowser4
<<: *flatpak-master
pages:
image: registry.gitlab.gnome.org/gnome/gtk/fedora:v13
stage: deploy
static-scan:
image: registry.gitlab.gnome.org/gnome/gtk/fedora:v14
stage: analysis
variables:
EXTRA_MESON_FLAGS: "--buildtype=debug"
script:
- meson ${COMMON_MESON_FLAGS} ${EXTRA_MESON_FLAGS} _scan_build
- ninja -C _scan_build scan-build
artifacts:
paths:
- _scan_build/meson-logs
allow_failure: true
reference:
image: registry.gitlab.gnome.org/gnome/gtk/fedora:v14
stage: docs
variables:
EXTRA_MESON_FLAGS: "--buildtype=release"
script:
- meson ${COMMON_MESON_FLAGS} -Dgtk_doc=true _build
- meson ${COMMON_MESON_FLAGS} ${EXTRA_MESON_FLAGS} -Dgtk_doc=true _build
- ninja -C _build gdk4-doc gsk4-doc gtk4-doc
- mkdir -p public/
- mv _build/docs/reference/gdk/html/ public/gdk/
- mv _build/docs/reference/gsk/html/ public/gsk/
- mv _build/docs/reference/gtk/html/ public/gtk/
- mkdir -p _reference/
- mv _build/docs/reference/gdk/html/ _reference/gdk/
- mv _build/docs/reference/gsk/html/ _reference/gsk/
- mv _build/docs/reference/gtk/html/ _reference/gtk/
artifacts:
paths:
- _reference
pages:
stage: deploy
script:
- mv _reference/ public/
artifacts:
paths:
- public

View File

@ -9,6 +9,7 @@ RUN dnf -y install \
cairo-gobject-devel \
ccache \
clang \
clang-analyzer \
colord-devel \
cups-devel \
dbus-daemon \

View File

@ -85,20 +85,25 @@ else
base_version="v$base_version"
fi
TAG="registry.gitlab.gnome.org/gnome/gtk/${base}:${base_version}"
if [ ! -x "$(command -v docker)" ] || [ docker --help |& grep -q podman ]; then
# Docker is actually implemented by podman, and its OCI output
# is incompatible with some of the dockerd instances on GitLab
# CI runners.
echo "Using: Podman"
format="--format docker"
CMD="podman"
else
echo "Using: Docker"
format=""
CMD="sudo socker"
fi
REGISTRY="registry.gitlab.gnome.org"
TAG="${REGISTRY}/gnome/gtk/${base}:${base_version}"
if [ $build == 1 ]; then
if docker --help |& grep -q podman; then
# Docker is actually implemented by podman, and its OCI output
# is incompatible with some of the dockerd instances on GitLab
# CI runners.
format="--format docker"
else
format=""
fi
echo -e "\e[1;32mBUILDING\e[0m: ${base} as ${TAG}"
sudo docker build \
${CMD} build \
${format} \
--build-arg HOST_USER_ID="$UID" \
--tag "${TAG}" \
@ -110,16 +115,16 @@ if [ $push == 1 ]; then
echo -e "\e[1;32mPUSHING\e[0m: ${base} as ${TAG}"
if [ $no_login == 0 ]; then
sudo docker login registry.gitlab.gnome.org
${CMD} login ${REGISTRY}
fi
sudo docker push $TAG
${CMD} push ${TAG}
exit $?
fi
if [ $run == 1 ]; then
echo -e "\e[1;32mRUNNING\e[0m: ${base} as ${TAG}"
sudo docker run \
${CMD} run \
--rm \
--volume "$(pwd)/..:/home/user/app" \
--workdir "/home/user/app" \

View File

@ -1,6 +1,6 @@
#!/bin/bash
set +e
set -e
# We need to add a new remote for the upstream master, since this script could
# be running in a personal fork of the repository which has out of date branches.
@ -13,8 +13,9 @@ git fetch upstream
#
# `${CI_MERGE_REQUEST_TARGET_BRANCH_NAME}` is only defined if were running in
# a merge request pipeline; fall back to `${CI_DEFAULT_BRANCH}` otherwise.
newest_common_ancestor_sha=$(diff --old-line-format='' --new-line-format='' <(git rev-list --first-parent upstream/${CI_MERGE_REQUEST_TARGET_BRANCH_NAME:-${CI_DEFAULT_BRANCH}}) <(git rev-list --first-parent HEAD) | head -1)
newest_common_ancestor_sha=$(diff --old-line-format='' --new-line-format='' <(git rev-list --first-parent "upstream/${CI_MERGE_REQUEST_TARGET_BRANCH_NAME:-${CI_DEFAULT_BRANCH}}") <(git rev-list --first-parent HEAD) | head -1)
git diff -U0 --no-color "${newest_common_ancestor_sha}" | .gitlab-ci/clang-format-diff.py -binary "clang-format" -p1
exit_status=$?
# The style check is not infallible. The clang-format configuration cannot
# perfectly describe GTKs coding style: in particular, it cannot align
@ -32,3 +33,5 @@ echo " https://gitlab.gnome.org/GNOME/gtk/blob/master/docs/CODING-STYLE"
echo "Warnings from this tool can be ignored in favour of the documented "
echo "coding style, or in favour of matching the style of existing"
echo "surrounding code."
exit ${exit_status}