-
Notifications
You must be signed in to change notification settings - Fork 0
/
.gitlab-ci.yml
141 lines (129 loc) · 3.43 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
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
include:
- remote: 'https://gitlab.freedesktop.org/freedesktop/ci-templates/-/raw/34039cd573a2df832d465bc9e4c5f543571f5241/templates/ci-fairy.yml'
- remote: 'https://gitlab.gnome.org/guidog/meta-phosh/-/raw/f3c92e90dcc0d65322888217429b75dd101bd0d3/ci/phosh-common-jobs.yml'
stages:
- build
- test
- style-checks
- package
workflow:
rules:
- if: $CI_PIPELINE_SOURCE == 'merge_request_event'
# Don't trigger a branch pipeline if there is an open MR
- if: $CI_COMMIT_BRANCH && $CI_OPEN_MERGE_REQUESTS
when: never
- if: $CI_COMMIT_TAG
- if: $CI_COMMIT_BRANCH
.before_script: &before_script
before_script:
- export DEBIAN_FRONTEND=noninteractive
- apt-get -y update
- apt-get -y upgrade
- apt-get -y build-dep .
- '[ -z "${EXTRA_PKGS}" ] || echo "Extra packages: ${EXTRA_PKGS}"'
- apt-get -y install gcovr git build-essential ${EXTRA_PKGS}
.image: &image
image:
name: debian:trixie
.tags: &tags
tags:
- librem5:arm64
# Regular, full build
build:gcc:native-debian-trixie:full:
<<: *tags
<<: *image
<<: *before_script
stage: build
artifacts:
paths:
- _build
script:
- meson setup -Db_coverage=true --werror _build
- meson compile -C _build
except:
variables:
- $PKG_ONLY == "1"
# Minimal build for e.g. submodule usage
build:gcc:native-debian-trixie:lib:
<<: *tags
<<: *image
<<: *before_script
stage: build
script:
- meson setup --werror -Ddaemon=false -Dgtk_doc=false _build
- meson compile -C _build
except:
variables:
- $PKG_ONLY == "1"
# Build using clang
build:clang:native-debian-trixie:full:
variables:
EXTRA_PKGS: clang
<<: *tags
<<: *image
<<: *before_script
stage: build
artifacts:
paths:
- _build
script:
- CC=clang meson setup --werror _build
- meson compile -C _build
except:
variables:
- $PKG_ONLY == "1"
allow_failure: true
test:native-debian-trixie:
<<: *tags
<<: *image
<<: *before_script
stage: test
needs:
- build:gcc:native-debian-trixie:full
coverage: '/^\s+lines\.+:\s+([\d.]+\%)\s+/'
script:
- dbus-run-session ninja -C _build test coverage
except:
variables:
- $PKG_ONLY == "1"
format-check:
<<: *tags
<<: *image
before_script:
- export DEBIAN_FRONTEND=noninteractive
- apt-get -y update
- apt-get -y install uncrustify git python3
stage: style-checks
needs: []
script:
- |
if [ -n "$CI_MERGE_REQUEST_TARGET_BRANCH_NAME" ]; then
git remote add target $CI_MERGE_REQUEST_PROJECT_URL.git
echo "Fetching MR target branch $CI_MERGE_REQUEST_TARGET_BRANCH_NAME from $CI_MERGE_REQUEST_PROJECT_URL"
git fetch target "$CI_MERGE_REQUEST_TARGET_BRANCH_NAME"
git fetch --deepen=100 origin HEAD
merge_base=$(git merge-base "target/$CI_MERGE_REQUEST_TARGET_BRANCH_NAME" HEAD)
if [ -z "$merge_base" ]; then
echo "Could't determine merge base"
exit 1
fi
echo "Merge base: $merge_base"
./.gitlab-ci/check-style.py --dry-run --sha $merge_base
else
echo "Not a merge request"
fi
allow_failure: true
rules:
- if: '$CI_MERGE_REQUEST_TARGET_BRANCH_NAME'
format-check:
<<: *tags
stage: style-checks
extends: .phosh-format-check
allow_failure: true
package:deb-debian-trixie:arm64:
tags:
- librem5:arm64
stage: package
variables:
PHOSH_DOCKER_IMAGE: debian:trixie
extends: .phosh-build-debian-package