forked from mozilla-b2g/gecko-b2g
-
Notifications
You must be signed in to change notification settings - Fork 33
/
.gitlab-ci.yml
133 lines (115 loc) · 3.6 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
# (c) 2017 KAI OS TECHNOLOGIES (HONG KONG) LIMITED All rights reserved. This
# file or any portion thereof may not be reproduced or used in any manner
# whatsoever without the express written permission of KAI OS TECHNOLOGIES
# (HONG KONG) LIMITED. KaiOS is the trademark of KAI OS TECHNOLOGIES (HONG KONG)
# LIMITED or its affiliate company and may be registered in some jurisdictions.
# All other trademarks are the property of their respective owners.
workflow:
rules:
- if: '$CI_MERGE_REQUEST_PROJECT_PATH == "KaiOS/gecko-dev"'
- if: '$CI_PROJECT_PATH == "KaiOS/gecko-dev" && $CI_COMMIT_BRANCH == "next"'
- when: never
include:
- '.gitlab/ci/bases.yml'
- '.gitlab/ci/lint.yml'
- '.gitlab/ci/scm/sidl_services.yml'
default:
image: ${CI_REGISTRY}/re/kaios-build/next/daily:1.53.0_6_1
tags:
- sh-runners
interruptible: true
variables:
# GIT_CLONE_PATH would be overidden with "koost" if pipeline gets triggered from within koost
# also, in order for sccache, perisitent path is preferred
GIT_CLONE_PATH: ${CI_BUILDS_DIR}/kaios/gecko
# since we can always get nearly the whole git history from mirror,
# it's ok to `fetch` the incoming MR instead of re-cloning the repo.
GIT_STRATEGY: fetch
GIT_LFS_SKIP_SMUDGE: "1"
stages:
- lint
- build
- test
- deploy
Check if MR is good to merge:
extends: .mr_validation
lint:eslint:
extends: .lint_eslint
stage: lint
lint:common:
extends: .lint_common
stage: lint
lint:cpp:
extends: .lint_cpp
stage: lint
lint:python:
extends: .lint_python
stage: lint
lint:rs:
extends: .lint_rs
stage: lint
lint:yml:
extends: .lint_yml
stage: lint
build:arm:gonk-10:
extends:
- .build_arm
- .rules:unskippable
stage: build
build:arm64:gonk-13:
extends:
- .build_arm64
- .rules:unskippable
stage: build
build:desktop:
extends:
- .build_desktop
- .build:rules:delayed
stage: build
test:wpt:
stage: test
extends:
- .test_wpt
needs:
- job: 'build:desktop'
production:desktop:
extends: .build_desktop
stage: deploy
variables:
GIT_CHECKOUT: 'true'
# releng/ci-util/b2g-desktop
B2G_DESKTOP_PROJECT_ID: 11099
# override the whole before_script since we don't need the typical preparartion of repository
interruptible: false
before_script:
- '[[ -f /entrypoint.sh ]] && /entrypoint.sh'
- |
if ${CI_USE_MIRROR}; then
git clone ${LOCAL_GIT_MIRROR}/KaiOS/koost.git -b ${CI_COMMIT_BRANCH}
echo -e "machine ${CI_SERVER_HOST}\nlogin gitlab-ci-token\npassword ${CI_JOB_TOKEN}" > ~/.netrc
git -C koost fetch ${CI_SERVER_URL}/KaiOS/koost.git ${CI_COMMIT_BRANCH}
git -C koost checkout FETCH_HEAD -f -q
else
git clone ${CI_SERVER_URL}/KaiOS/koost.git -b ${CI_COMMIT_BRANCH} --depth 1
fi
- git -C koost log -1
after_script:
- ./mach package
- base64 ${MOZ_OBJDIR}/dist/b2g*.tar.bz2 > b2g-desktop-b64
- |
cat <<-EOF >commit_message
${CI_COMMIT_MESSAGE}
Source: ${CI_PROJECT_PATH}@${CI_COMMIT_SHORT_SHA}
EOF
cat commit_message
- |
curl --request POST --header "PRIVATE-TOKEN: ${B2G_DESKTOP_DEPLOY_KEY}" \
--form "branch=${CI_COMMIT_BRANCH}" \
--form "commit_message=$(cat commit_message)" \
--form "actions[][action]=update" \
--form "actions[][file_path]=b2g.linux-x86_64.tar.bz2" \
--form "actions[][content]=<./b2g-desktop-b64" \
--form "actions[][encoding]=base64" \
"${CI_API_V4_URL}/projects/${B2G_DESKTOP_PROJECT_ID}/repository/commits"
rules:
- if: '$CI_PROJECT_PATH == "KaiOS/gecko-dev" && $CI_COMMIT_BRANCH == "next"'