forked from golioth/golioth-zephyr-sdk
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.gitlab-ci.yml
151 lines (136 loc) · 3.15 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
image: zephyrprojectrtos/ci:v0.23.1
variables:
WEST_MANIFEST: west-zephyr.yml
.west-init: &west-init
- rm -rf .west modules/lib/golioth
- west init -m $CI_REPOSITORY_URL --mf ${WEST_MANIFEST} --mr $CI_COMMIT_REF_NAME
- (cd modules/lib/golioth; git checkout $CI_COMMIT_SHA)
.cache-deps: &cache-deps
key: west-modules
paths:
- bootloader
- modules
- tools
- zephyr
stages:
- cache
- check
- build
- test
.check:
stage: check
needs: []
allow_failure: true
except:
- main
- tags
.west-prepare:
variables:
GIT_STRATEGY: none
needs: []
cache:
<<: *cache-deps
policy: pull
before_script:
- *west-init
- >
west update -o=--depth=1 -n ||
(west forall -c 'git clean -ffdx && git reset --hard' &&
west update -o=--depth=1 -n)
- west forall -c 'git clean -ffdx && git reset --hard'
- west patch --apply
.west-build:
extends: .west-prepare
stage: build
cache-deps:
extends: .west-build
stage: cache
cache:
<<: *cache-deps
policy: pull-push
script:
- west forall -c 'git clean -ffdx && git reset --hard'
- rm -rf modules/lib/golioth
only:
refs:
- main
checkpatch:
extends: [.check, .west-prepare]
before_script:
- *west-init
- west update modules/lib/golioth
- >
west update zephyr -o=--depth=1 -n ||
(west forall -c 'git clean -ffdx && git reset --hard' &&
west update zephyr -o=--depth=1 -n)
- west forall -c 'git clean -ffdx && git reset --hard'
script:
- cd modules/lib/golioth
- git fetch
- CHECKPATCH="../../../zephyr/scripts/checkpatch.pl --color=always --quiet"
- EXITCODE=0
- $CHECKPATCH --git origin/main.. || EXITCODE=$?
- exit $EXITCODE
gitlint:
extends: .check
variables:
GIT_DEPTH: 0
script:
- pip3 install gitlint
- gitlint --commits origin/main..
pre-commit:
extends: .check
variables:
GIT_DEPTH: 0
script:
- pip3 install pre-commit
- |
CODE=0 # run pre-commit
for CID in `git rev-list --reverse origin/main..`; do
git show $CID -s --format=' pre-commit %h ("%s")'
git checkout -f -q $CID
pre-commit run --color always --show-diff-on-failure --from-ref $CID^ --to-ref $CID || CODE=$?
done
exit $CODE
.twister:
extends: .west-prepare
stage: test
artifacts:
when: always
paths:
- reports/*
- twister-out/**/build.log
reports:
junit: reports/twister.xml
twister:
extends: .twister
script:
- >
zephyr/scripts/twister
-p nrf52840dk_nrf52840
-p qemu_x86
-o reports
-T modules/lib/golioth
twister-esp:
extends: .twister
script:
- west espressif install
- west espressif update
- export ZEPHYR_TOOLCHAIN_VARIANT="espressif"
- export ESPRESSIF_TOOLCHAIN_PATH="${HOME}/.espressif/tools/zephyr"
- >
zephyr/scripts/twister
-p esp32
-o reports
-T modules/lib/golioth
twister-ncs:
extends: .twister
variables:
WEST_MANIFEST: west-ncs.yml
script:
- >
zephyr/scripts/twister
--board-root nrf/boards
-p nrf9160dk_nrf9160_ns
-o reports
-T modules/lib/golioth