-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.gitlab-ci.yml
109 lines (91 loc) · 3.19 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
# Automated build of the riscos-build-online tool and deb.
#
# Enable submodules
variables:
GIT_STRATEGY: clone
GIT_SUBMODULE_STRATEGY: recursive
linux-tool:
stage: build-and-test
script:
- make riscos-build-online
- make test
artifacts:
when: always
paths:
- riscos-build-online
tags:
- linux
linux-deb:
stage: package
script:
- make deb
artifacts:
when: always
paths:
- riscos-build-online_*.deb
tags:
- linux
riscos-tool:
stage: build-and-test
script:
# FIXME: With a bit of thought I could replace the curl running of the build with
# an invocation of the tool that we just built.
- |
set -o pipefail
mkdir /tmp/robuild
# Zip up the source to send to robuild
zip -q9r /tmp/source-archive.zip * .robuild.yaml
# Send the archive file to JFPatch as a service
curl -q -F 'source=@/tmp/source-archive.zip' -o /tmp/robuild/result.json https://json.build.riscos.online/build/json
# Extract any system messages and output
jq -r '.messages[]' /tmp/robuild/result.json > /tmp/robuild/messages.txt || { echo "Server response:" ; cat /tmp/robuild/result.json ; false ; }
jq -r 'reduce .output[] as $i ("";. + $i)' /tmp/robuild/result.json > /tmp/robuild/output.txt
# Extract return code
rc=$(jq -r .rc /tmp/robuild/result.json | tee /tmp/robuild/rc.json)
# Marker files for the state
if [ "$rc" != "0" ] ; then touch /tmp/robuild/failed ; else touch /tmp/robuild/ok ; fi
# Extract the built binary if we had any
if [ "$rc" = "0" ] ; then
jq -r .data /tmp/robuild/result.json | base64 --decode - > /tmp/robuild/built
fi
# Outputs:
# /tmp/robuild/result.json - JSON output from the service.
# /tmp/robuild/{ok,failed} - status of the build (whether RC was 0).
# /tmp/robuild/built - the output result from the build.
# /tmp/robuild/rc - the value of the return code (decimal string)
# /tmp/robuild/messages.txt - system messages
# /tmp/robuild/output.txt - output from the build
- |
echo "System messages:"
sed 's/^/ /' < /tmp/robuild/messages.txt
echo
echo "Build output:"
sed 's/^/ /' < /tmp/robuild/output.txt
echo
if [ ! -f /tmp/robuild/ok ] ; then
echo "FAILED! Aborting"
exit 1
fi
- |
if [[ -f VersionNum ]] ; then
version=$(sed '/MajorVersion / ! d ; s/.*MajorVersion *"\(.*\)"/\1/' VersionNum)
else
version=$(git rev-parse --short HEAD)
fi
echo This is version: $version
mkdir robuild-client-$version
if [ -f /tmp/robuild/built ] ; then
cp /tmp/robuild/built robuild-client-$version/riscos-build-online,ff8
else
echo "No archive was built?"
exit 1
fi
artifacts:
when: always
paths:
- robuild-client-*/riscos-build-online,ff8
tags:
- linux
stages:
- build-and-test
- package