forked from gregkh/linux
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.gitlab-ci.yml
191 lines (179 loc) · 6.09 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
stages:
- setup
- compile
- test
- patch
- upload
- release
- announce
variables_job:
tags: ["docker"]
stage: setup
image: illinoisrobert/kernel-build
script:
- echo BASETAG=$CI_COMMIT_TAG | sed s/-mem.*// > basetag.env
- echo PACKAGE_REGISTRY_URL="${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/packages/generic/memorizer/${CI_COMMIT_TAG}" >> basetag.env
artifacts:
reports:
dotenv: basetag.env
variables:
GIT_STRATEGY: none
compile_job:
tags: ["docker"]
stage: compile
image: illinoisrobert/kernel-build
script:
# Some people like tarballs; some like debs. We'll build both
- make O=o defconfig memorizer.config
- make O=o -j $(expr $(nproc) / 3 + 1) targz-pkg
- make O=o -j $(expr $(nproc) / 3 + 1) deb-pkg
artifacts:
expire_in: 1 week
paths:
- ./o/.config
- ./o/vmlinux
- ./o/arch/x86/boot/bzImage
- ./o/*.tar.gz
- ./*.deb
compile_baremetal_job:
tags: ["docker"]
stage: compile
image: illinoisrobert/kernel-build
script:
- cp arch/x86/configs/memorizer-baremetal.config .config
- make -j $(expr $(nproc) / 3 + 1)
artifacts:
expire_in: 1 week
paths:
- ./arch/x86/boot/bzImage
patch_job:
tags: ["docker"]
stage: patch
needs: ["variables_job"]
image: illinoisrobert/kernel-build
script:
- git fetch --depth=1 origin tag "$BASETAG"
- git diff -p "$BASETAG" "$CI_COMMIT_TAG" > "$CI_COMMIT_TAG.patch"
rules:
- if: $CI_COMMIT_TAG
artifacts:
expire_in: 1 week
paths:
- $CI_COMMIT_TAG.patch
documentation_job:
tags: ["docker"]
needs: ["variables_job"]
stage: patch
image: illinoisrobert/kernel-build
script:
- make O=o SPHINXDIRS="memorizer" pdfdocs htmldocs
artifacts:
expire_in: 1 week
paths:
- o/Documentation/output/memorizer/pdf/memorizer.pdf
- o/Documentation/output/memorizer/*.html
- o/Documentation/output/memorizer/*.js
- o/Documentation/output/memorizer/_sources/*
- o/Documentation/output/memorizer/_static/*
test_job:
tags: ["shell"]
needs: ["compile_job"]
stage: test
script:
- ls -l o/arch/x86/boot/bzImage
- '[ -f arch/x86/boot/bzImage ] || cp o/arch/x86/boot/bzImage arch/x86/boot/.'
- ls -l arch/x86/boot/bzImage
- cd scripts/memorizer/testVM
- cp -r ~/mz-img-hack/* .
- python3 ./qemu_test.py
artifacts:
expire_in: 1 week
paths:
- ./scripts/memorizer/testVM/kmap
test_baremetal_job:
tags: ["shell"]
needs: ["compile_baremetal_job"]
stage: test
script:
- ls -l arch/x86/boot/bzImage
- cd scripts/memorizer/testVM
- cp -r ~/mz-img-hack/* .
- python3 ./qemu_test.py
artifacts:
expire_in: 1 week
paths:
- ./scripts/memorizer/testVM/kmap
upload_job:
tags: ["docker"]
stage: upload
needs: ["compile_job", "documentation_job", "patch_job", "variables_job"]
image: curlimages/curl:latest
rules:
- if: $CI_COMMIT_TAG
variables:
GIT_STRATEGY: none
script:
- 'curl --header "JOB-TOKEN: ${CI_JOB_TOKEN}" --upload-file o/vmlinux "${PACKAGE_REGISTRY_URL}/vmlinux-${CI_COMMIT_TAG}"'
- 'curl --header "JOB-TOKEN: ${CI_JOB_TOKEN}" --upload-file o/.config "${PACKAGE_REGISTRY_URL}/config-${CI_COMMIT_TAG}"'
- 'curl --header "JOB-TOKEN: ${CI_JOB_TOKEN}" --upload-file o/arch/x86/boot/bzImage "${PACKAGE_REGISTRY_URL}/bzImage-${CI_COMMIT_TAG}"'
- 'curl --header "JOB-TOKEN: ${CI_JOB_TOKEN}" --upload-file o/*.tar.gz "${PACKAGE_REGISTRY_URL}/linux-${CI_COMMIT_TAG}.tar.gz"'
- 'tar cfz debs-${CI_COMMIT_TAG}.tgz *.deb && curl --header "JOB-TOKEN: ${CI_JOB_TOKEN}" --upload-file debs-${CI_COMMIT_TAG}.tgz "${PACKAGE_REGISTRY_URL}/debs-${CI_COMMIT_TAG}.tgz"'
- 'curl --header "JOB-TOKEN: ${CI_JOB_TOKEN}" --upload-file $CI_COMMIT_TAG.patch "${PACKAGE_REGISTRY_URL}/${CI_COMMIT_TAG}.patch"'
- 'curl --header "JOB-TOKEN: ${CI_JOB_TOKEN}" --upload-file o/Documentation/output/memorizer/pdf/memorizer.pdf "${PACKAGE_REGISTRY_URL}/memorizer-${CI_COMMIT_TAG}.pdf"'
- |
set -ex
cd o/Documentation/output/memorizer
tar cfz html-${CI_COMMIT_TAG}.tgz *.html *.js _sources _static
curl --header "JOB-TOKEN: ${CI_JOB_TOKEN}" --upload-file html-${CI_COMMIT_TAG}.tgz "${PACKAGE_REGISTRY_URL}/html-${CI_COMMIT_TAG}.tgz"
variables:
GIT_STRATEGY: none
bats:
tags: ["docker"]
needs: ["compile_job"]
stage: test
image: illinoisrobert/kernel-build
script:
- ./scripts/memorizer/test/boottest.sh
release_job:
tags: ["docker"]
stage: release
image: registry.gitlab.com/gitlab-org/release-cli:latest
variables:
GIT_STRATEGY: none
rules:
- if: $CI_COMMIT_TAG # Run this job when a tag is created
script:
- echo "running release_job"
release: # See https://docs.gitlab.com/ee/ci/yaml/#release for available properties
tag_name: '$CI_COMMIT_TAG'
description: '$CI_COMMIT_TAG'
assets:
links:
- name: vmlinux-$CI_COMMIT_TAG
url: "${PACKAGE_REGISTRY_URL}/vmlinux-${CI_COMMIT_TAG}"
- name: config-$CI_COMMIT_TAG
url: "${PACKAGE_REGISTRY_URL}/config-${CI_COMMIT_TAG}"
- name: bzImage-$CI_COMMIT_TAG
url: $PACKAGE_REGISTRY_URL/bzImage-$CI_COMMIT_TAG
- name: linux-$CI_COMMIT_TAG.tar.gz
url: $PACKAGE_REGISTRY_URL/linux-$CI_COMMIT_TAG.tar.gz
- name: Debian packages
url: "${PACKAGE_REGISTRY_URL}/debs-$CI_COMMIT_TAG.tgz"
- name: $CI_COMMIT_TAG.patch
url: $PACKAGE_REGISTRY_URL/$CI_COMMIT_TAG.patch
- name: PDF Documentation
url: ${PACKAGE_REGISTRY_URL}/memorizer-${CI_COMMIT_TAG}.pdf
- name: HTML Documentation
url: "${PACKAGE_REGISTRY_URL}/html-${CI_COMMIT_TAG}.tgz"
variables:
GIT_STRATEGY: none
announce_job:
tags: ["docker"]
stage: announce
image: illinoisrobert/kernel-build
needs: ["release_job"]
rules:
- if: $CI_COMMIT_TAG
script:
# slack-announce returns true even if the announcement didn't work.
- slack-announce "$SLACK_CHANNEL_ID" "$SLACK_AUTH_TOKEN" "There is a new memorizer release $CI_COMMIT_TAG. You can download it from $CI_PROJECT_URL/-/releases/$CI_COMMIT_TAG."