-
Notifications
You must be signed in to change notification settings - Fork 7
/
.gitlab-ci.yml
190 lines (172 loc) · 4.47 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
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
---
# global settings
image: alpine:latest
before_script: &global_before_scripts
- apk upgrade -U
after_script:
- .ci/lib/move_logs.sh $CI_PROJECT_DIR
stages:
- lint
- build
- autoupdate
variables:
PMBOOTSTRAP_TAG: "master"
# This defines the rules for when a pipeline should run.
workflow:
rules:
# Don't run branch pipeline if an MR is open (only the MR pipeline will run)
- if: $CI_COMMIT_BRANCH && $CI_OPEN_MERGE_REQUESTS && $CI_PIPELINE_SOURCE == "push"
when: never
# Run for merge requests
- if: $CI_PIPELINE_SOURCE == "merge_request_event"
# Run scheduled pipeline for autoupdate or manually triggered pipeline
- if: $CI_PIPELINE_SOURCE == "schedule" || $CI_PIPELINE_SOURCE == "web"
# device documentation
wiki:
stage: lint
rules:
- if: $CI_PIPELINE_SOURCE == "merge_request_event" || $CI_COMMIT_REF_PROTECTED == "false"
changes:
- .ci/**/*
- .gitlab-ci.yml
- device/*/device-*/*
script:
- .ci/lib/gitlab_prepare_ci.sh
- .ci/wiki.sh
# testcases linting
ruff:
stage: lint
rules:
- if: $CI_PIPELINE_SOURCE == "merge_request_event" || $CI_COMMIT_REF_PROTECTED == "false"
changes:
- .ci/*
- .ci/*/*
- .gitlab-ci.yml
script:
- .ci/lib/gitlab_prepare_ci.sh
- .ci/ruff.sh
# shellcheck and various grep checks
shellcheck-grep:
stage: lint
image: alpine:edge
rules:
- if: $CI_PIPELINE_SOURCE == "merge_request_event" || $CI_COMMIT_REF_PROTECTED == "false"
script:
- .ci/lib/gitlab_prepare_ci.sh
- .ci/shellcheck.sh
- .ci/grep.sh
- .ci/codeowners.sh
editor-config:
stage: lint
image: alpine:edge
rules:
- if: $CI_PIPELINE_SOURCE == "merge_request_event" || $CI_COMMIT_REF_PROTECTED == "false"
script:
- .ci/lib/gitlab_prepare_ci.sh
- .ci/ec.sh
# aports checks (generic)
pytest-commits:
stage: lint
rules:
- if: $CI_PIPELINE_SOURCE == "merge_request_event" || $CI_COMMIT_REF_PROTECTED == "false"
script:
- .ci/lib/gitlab_prepare_ci.sh
- .ci/pytest.sh
- .ci/commits.sh
artifacts:
when: on_failure
paths:
- log.txt
- log_testsuite_pmaports.txt
- pmbootstrap.cfg
expire_in: 1 week
# APKBUILD linting
aport-lint:
stage: lint
rules:
- if: $CI_PIPELINE_SOURCE == "merge_request_event" || $CI_COMMIT_REF_PROTECTED == "false"
script:
- .ci/lib/gitlab_prepare_ci.sh
- .ci/apkbuild-lint.sh
allow_failure: true
# kernel kconfig check
kernel-kconfig:
stage: lint
rules:
- if: $CI_PIPELINE_SOURCE == "merge_request_event" || $CI_COMMIT_REF_PROTECTED == "false"
changes:
- kconfigcheck.toml
- device/*/linux-*/config-*
- main/linux-*/config-*
script:
- .ci/lib/gitlab_prepare_ci.sh
- .ci/kconfig.sh
# MR settings
# (Checks for "Allow commits from members who can merge to the target branch")
mr-settings:
stage: lint
rules:
- if: $CI_PIPELINE_SOURCE == "merge_request_event"
before_script:
- *global_before_scripts
- apk -q add python3
script:
- wget -q "https://gitlab.com/postmarketOS/ci-common/-/raw/master/check_mr_settings.py"
- python3 ./check_mr_settings.py
# build changed aports
.build:
stage: build
rules:
- if: $CI_PIPELINE_SOURCE == "merge_request_event" || $CI_COMMIT_REF_PROTECTED == "false"
before_script:
- *global_before_scripts
- .ci/lib/gitlab_prepare_ci.sh
after_script:
- cp -r /home/pmos/.local/var/pmbootstrap/packages/ packages/ || true
artifacts:
expire_in: 1 week
paths:
- packages/
timeout: 10 h
build-x86_64:
extends: .build
script:
- .ci/build-x86_64.sh
build-x86:
extends: .build
script:
- .ci/build-x86.sh
build-aarch64:
extends: .build
script:
- .ci/build-aarch64.sh
build-armv7:
extends: .build
script:
- .ci/build-armv7.sh
build-armhf:
extends: .build
script:
- .ci/build-armhf.sh
build-riscv64:
extends: .build
script:
- .ci/build-riscv64.sh
auto-update:
stage: autoupdate
rules:
# This variable is set in the scheduled pipeline configuration. It should be a space separated list of
# package names to update.
- if: $AUTOUPDATE_PACKAGES != null && $CI_PIPELINE_SOURCE == "schedule" || $CI_PIPELINE_SOURCE == "web"
before_script:
- .ci/lib/gitlab_prepare_ci.sh
script:
- .ci/autoupdate.sh "$AUTOUPDATE_PACKAGES"
after_script:
- .ci/lib/move_logs.sh $CI_PROJECT_DIR
artifacts:
when: on_failure
paths:
- log.txt
- log_testsuite_pmaports.txt
- pmbootstrap.cfg