-
Notifications
You must be signed in to change notification settings - Fork 75
/
Copy path.gitlab-ci.yml
192 lines (191 loc) · 4.57 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
191
image: debian:buster
default:
interruptible: true
before_script:
- apt-get update > /dev/null
- apt-get install -y curl git libncurses-dev build-essential make gawk unzip wget
python2.7 file tar bzip2 tree ccache ecdsautils > /dev/null
- mkdir -p ccache
- PATH="/usr/lib/ccache:$PATH"
variables:
GIT_SUBMODULE_STRATEGY: recursive
FORCE_UNSAFE_CONFIGURE: '1'
CCACHE_DIR: $CI_PROJECT_DIR/ccache
CCACHE_MAXSIZE: 20G
stages:
- pre-build-tests
- build
- test
- prepare-deploy
- test-deploy
- deploy
check-ci-tests:
image: alpine:latest
stage: pre-build-tests
allow_failure: false
before_script:
- apk update
- apk add shellcheck bash
script:
- shellcheck scripts/ci/test_manifest_length.sh
build-all:
image: registry.chaotikum.net/freifunk-luebeck/gluon-build:latest
stage: build
tags:
- fast
cache:
paths:
- ccache
key: ${TARGET}
parallel:
matrix:
- TARGET:
- ar71xx-generic
- ar71xx-tiny
- ar71xx-nand
- ath79-generic
- brcm2708-bcm2708
- brcm2708-bcm2709
- ipq40xx-generic
- ipq806x-generic
- lantiq-xrx200
- lantiq-xway
- mpc85xx-generic
- mpc85xx-p1020
- ramips-mt7620
- ramips-mt7621
- ramips-mt76x8
- ramips-rt305x
- sunxi-cortexa7
- x86-generic
- x86-geode
- x86-legacy
- x86-64
variables:
GLUON_SITEDIR: ..
GLUON_DEPRECATED: 1
GLUON_AUTOUPDATER_ENABLED: 1
GLUON_AUTOUPDATER_BRANCH: stable
GLUON_BRANCH: $GLUON_AUTOUPDATER_BRANCH
CCACHE_DIR: $CI_PROJECT_DIR/ccache
CCACHE_MAXSIZE: 20G
script:
- file $(which gcc)
- tree -L 3
- env | grep CI
- make -C gluon update
- 'make -C gluon -j $((($(nproc)+1) / 2)) GLUON_TARGET=$TARGET '
- ccache -s
artifacts:
when: always
expire_in: 3 day
paths:
- gluon/output
test:images:
stage: test
needs:
- build-all
allow_failure: true
before_script:
- apt update
- apt install -qq -y tree
script:
- ls gluon/output/images/sysupgrade/ | grep wdr3600
- ls gluon/output/images/sysupgrade/ | grep wr841
- ls gluon/output/images/sysupgrade/ | grep ubiquiti-unifi
- ls gluon/output/images/sysupgrade/ | grep nanostation-m2
- ls gluon/output/images/sysupgrade/ | grep wr1043n
- ls gluon/output/images/sysupgrade/ | grep wdr4300
artifacts:
when: always
expire_in: 3 day
paths:
- gluon/output
test:image-count:
stage: test
needs:
- build-all
allow_failure: true
before_script:
- apt update
- apt install -qq -y tree
script:
- N=$(ls gluon/output/images/sysupgrade/ | wc -l)
- echo $N
- '[ $N -ge 260 ]'
artifacts:
when: always
expire_in: 3 day
paths:
- gluon/output
manifest:
stage: prepare-deploy
needs:
- build-all
tags:
- fast
cache:
paths:
- ccache
key: manifest
variables:
FORCE_UNSAFE_CONFIGURE: '1'
script:
- make -C gluon GLUON_SITEDIR=.. update
- make -C gluon GLUON_SITEDIR=.. GLUON_PRIORITY=7 GLUON_AUTOUPDATER_BRANCH=stable
GLUON_BRANCH=stable manifest
- make -C gluon GLUON_SITEDIR=.. GLUON_PRIORITY=0 GLUON_AUTOUPDATER_BRANCH=beta
GLUON_BRANCH=beta manifest
- make -C gluon GLUON_SITEDIR=.. GLUON_PRIORITY=0 GLUON_AUTOUPDATER_BRANCH=experimental
GLUON_BRANCH=experimental manifest
- echo $SIGNING_KEY > ecdsa.key
- ./gluon/contrib/sign.sh ecdsa.key gluon/output/images/sysupgrade/experimental.manifest
artifacts:
when: always
expire_in: 3 day
paths:
- gluon/output
test:manifest-length:
stage: test-deploy
needs:
- manifest
before_script: []
script:
- bash scripts/ci/test_manifest_length.sh
artifacts:
when: always
paths:
- gluon/output
upload:
stage: deploy
before_script:
- apt-get -qq update
- apt-get -qq install -y git make gawk wget python2.7 file tar bzip2 rsync tree
- mkdir -p ~/.ssh
- echo -e "StrictHostKeyChecking no" > ~/.ssh/config
- eval $(ssh-agent -s)
- echo "$DEPLOY_KEY" | ssh-add -
script:
- tree -L 3 gluon/output
- TAG=${CI_COMMIT_BRANCH}_$(date +%F_%H-%M-%S)
- mkdir -p "public/$TAG"
- cd gluon
- mv output $TAG
- ln -s ./$TAG ./latest
- rsync -rvhl ./$TAG ${DEPLOY_USER}@${DEPLOY_HOST}:data/
- rsync -rvhl ./latest ${DEPLOY_USER}@${DEPLOY_HOST}:data/
pages:
stage: deploy
script:
- TAG=${CI_COMMIT_REF_SLUG}_$(date +%F_%H-%M-%S)
- mkdir -p public
- mv gluon/output/* public
- find public/ -type d -exec sh -c 'tree -I "index.html" -H "." -T "$TAG" -s -h
--si -L 2 "{}" > "{}/index.html" ' \;
artifacts:
when: always
expire_in: 3 day
paths:
- public
rules:
- if: $CI_COMMIT_REF_NAME == $CI_DEFAULT_BRANCH