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

View File

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

View File

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

View File

@ -1,6 +1,6 @@
#!/bin/bash #!/bin/bash
set +e set -e
# We need to add a new remote for the upstream master, since this script could # 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. # 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 # `${CI_MERGE_REQUEST_TARGET_BRANCH_NAME}` is only defined if were running in
# a merge request pipeline; fall back to `${CI_DEFAULT_BRANCH}` otherwise. # 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 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 # The style check is not infallible. The clang-format configuration cannot
# perfectly describe GTKs coding style: in particular, it cannot align # 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 "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 "coding style, or in favour of matching the style of existing"
echo "surrounding code." echo "surrounding code."
exit ${exit_status}