-
-
Notifications
You must be signed in to change notification settings - Fork 35
/
.gitlab-ci.yml
97 lines (82 loc) · 3.58 KB
/
.gitlab-ci.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
---
stages:
- docker_image
- build
variables:
MANIFEST: /build/pitivi/build/flatpak/org.pitivi.Pitivi.json
DBUS_ID: org.pitivi.Pitivi
GST_DEBUG_NO_COLOR: "true"
GNOME_SDK: 46
pitivi:master:
stage: docker_image
tags:
- privileged
image: docker:latest
variables:
DOCKER_DRIVER: overlay2
DOCKER_TLS_CERTDIR: ""
services:
- docker:20.10.11-dind
before_script:
- docker info
script:
# GNOME -> gnome
- export NAMESPACE="$(echo "${CI_PROJECT_NAMESPACE}" | tr A-Z a-z)"
- export IMAGE="${CI_REGISTRY}/${NAMESPACE}/${CI_PROJECT_NAME}:master-sdk_${GNOME_SDK}"
- export BASE_IMAGE="quay.io/gnome_infrastructure/gnome-runtime-images:x86_64-gnome-${GNOME_SDK}"
# Commands to be run in the Docker image.
# Clone the Pitivi repo.
- export CLONE_PITIVI="git clone ${CI_PROJECT_URL}.git --single-branch /build/pitivi -b ${CI_COMMIT_REF_NAME}"
# All the downloads, build dirs, build cache, etc. are stored in /build/flatpak-cache.
- export BUILD_PITIVI="flatpak-builder --user --disable-rofiles-fuse /build/flatpak-build-dir ${MANIFEST} --state-dir=/build/flatpak-cache --ccache"
# Run pre-commit to download and cache the hooks.
- export PRE_COMMIT="cd /build/pitivi && flatpak-builder --disable-rofiles-fuse --filesystem=/build/pitivi --env=PRE_COMMIT_HOME=/build/pre-commit-home --share=network --run /build/flatpak-build-dir ${MANIFEST} pre-commit install-hooks"
# The /build/flatpak-build-dir since it's very large and can be recreated
# easily out of /build/flatpak-cache.
- export CLEANUP="rm -rf /build/pitivi && rm -rf /build/flatpak-build-dir"
- env
- docker run --privileged --name local-pitivi-image ${BASE_IMAGE} bash -c "${CLONE_PITIVI} && ${BUILD_PITIVI} && ${PRE_COMMIT} && ${CLEANUP}"
- docker commit local-pitivi-image ${IMAGE}
- docker rm local-pitivi-image
- docker login -u gitlab-ci-token -p $CI_JOB_TOKEN $CI_REGISTRY
- docker push ${IMAGE}
only:
- triggers
- schedules
retry: 1
build:
stage: build
tags:
- flatpak
image: registry.gitlab.gnome.org/gnome/pitivi:master-sdk_${GNOME_SDK}
variables:
XUNIT_PATH: ${CI_PROJECT_DIR}/xunit.xml
script:
- export RUN_IN_SANDBOX="flatpak-builder --disable-rofiles-fuse --filesystem=${CI_PROJECT_DIR} --env=PITIVI_DEVELOPMENT=1 --env=GST_DEBUG=2 --env=GST_DEBUG_NO_COLOR=true --env=PRE_COMMIT_HOME=/build/pre-commit-home --env=SKIP=gitlab-ci-linter --env=GITLAB_CI=${GITLAB_CI} --run /build/flatpak-build-dir ${MANIFEST}"
- env
# Move the Pitivi git repo so it has the same location as when the
# /build/flatpak-cache has been created.
- mv ${CI_PROJECT_DIR} /build/pitivi
# Create the folder as we need to store here the artifacts.
- mkdir ${CI_PROJECT_DIR}
# Recreate the flatpak build dir using the cache.
- flatpak-builder --user --disable-rofiles-fuse --state-dir=/build/flatpak-cache --disable-download --ccache --force-clean /build/flatpak-build-dir ${MANIFEST}
# Build Pitivi.
- cd /build/pitivi
- ${RUN_IN_SANDBOX} meson mesonbuild/
- ${RUN_IN_SANDBOX} ninja -C mesonbuild/
# Run the pre-commit hooks.
- ${RUN_IN_SANDBOX} pre-commit run --all-files
# Run the unit tests.
- xvfb-run -n 32 -s "-screen 0 640x480x24" ${RUN_IN_SANDBOX} gst-validate-launcher /build/pitivi/tests/ptv_testsuite.py --dump-on-failure --timeout-factor 10 --xunit-file ${XUNIT_PATH} --logs-dir ${CI_PROJECT_DIR}/tests-logs
cache:
paths:
- flatpak-cache
artifacts:
expire_in: 30 days
paths:
- xunit.xml
- tests-logs/
reports:
junit:
- ${XUNIT_PATH}