aboutsummaryrefslogtreecommitdiff
path: root/tcwg-dev-build.yaml.in
blob: b1f0c449c3557b5125df94719e3d43b80283b46f (plain)
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
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
#include tcwg/default.yaml.inc

- job:
#if TOOLCHAIN_llvm && HOST_windows
    name: tcwg-llvm_woa-build
#else
    name: tcwg-#{TOOLCHAIN}-build
#endif
    project-type: freestyle
    defaults: global
    properties:
      - default-properties
    parameters:
#if TOOLCHAIN_gnu
        - string:
            name: release_name
            default: default
            description: 'Name of release series; default is "date +%Y%m%d-%H_%M_%S"'
#elif TOOLCHAIN_llvm
        - string:
            name: release
# if !HOST_windows
            default: ''
            description: 'Release number. Ex. 4.0.1'
# else
            default: 'main'
            description: 'Release build ID (13.0.0-rc1, 13.0.0) or git branch/sha1'
# endif
#endif
#if TOOLCHAIN_gnu
        - string:
            name: buildnumber
            default: 0
            description: 'Build number in release series'
        - choice:
            name: target
            choices:
              - aarch64-linux-gnu
              - aarch64-elf
              - aarch64-linux-gnu_ilp32
              - aarch64_be-elf
              - aarch64_be-linux-gnu
              - arm-eabi
              - arm-linux-gnueabi
              - arm-linux-gnueabihf
              - armeb-eabi
              - armeb-linux-gnueabi
              - armeb-linux-gnueabihf
              - armv8l-linux-gnueabihf
              - native
            description: 'Target'
        - choice:
            name: version
            choices:
              - default
              - latest-rel
              - master
              - gcc8
              - gcc7
              - gcc6
              - gcc5
              - gcc4_9
            description: 'Toolchain version; should match a supported ABE config'
#elif TOOLCHAIN_llvm
# if !HOST_windows
        - string:
            name: candidate
            default: 'git-ref=main'
            description: 'RC number. Ex. 1, 2, final'
        - string:
            name: toolchain
            default: ''
            description: 'URL of the toolchain to use. This needs to be a tarball with a /bin directory inside with either GCC or LLVM from make install'
        - string:
            name: compiler
            default: 'clang'
            description: 'Override the default system compiler. Only used if "toolchain" is empty.'
        - bool:
            name: useninja
            default: true
            description: 'Whether or not to use ninja for the release (works for releases > 9.0.0)'
        - bool:
            name: testsuite
            default: true
            description: 'Whether or not to trigger a test-suite with this build.'
# else
        - choice:
            name: build_type
            choices:
              - test
              - release
# endif
#endif
#if TOOLCHAIN_gnu
        - choice:
            name: distro
            choices:
              - lts_1
              - lts
            description: 'Ubuntu distro to use for build environment'
#elif TOOLCHAIN_llvm && !HOST_windows
        - string:
            name: build_container_tag
            default: 'lts_1'
            description: 'Type of image to use in the container: lts_1, lts, ...'
#endif
        - label:
            name: builder
#if HOST_windows
            default: tcwg-surface
#else
            default: tcwg-x86_64-build
#endif
            description: 'Jenkins label to build on; determines host of the toolchain'
#if TOOLCHAIN_gnu
        - file:
            name: manifest.txt
            description: 'Use provided manifest file (which may override above settings)'
        - bool:
            name: verbose
            default: false
            description: 'Whether to be verbose'
#endif
        - string:
            name: scripts_branch
#if TOOLCHAIN_gnu || HOST_windows
            default: master
#elif TOOLCHAIN_llvm
            default: tested
#endif
            description: 'Scripts revision to use'
#if TOOLCHAIN_gnu
        - text:
            name: extra_options
            default:
            description: 'Extra options to pass to docker-run'
#endif
    disabled: false
    concurrent: true
    display-name: 'TCWG AAA #{TOOLCHAIN} #{HOST} Build'
#if HOST_windows
    # Save bytes in limited 250-byte windows PATHs
    workspace: ws/tdb$EXECUTOR_NUMBER
#endif
    scm:
      - jenkins-scripts
    wrappers:
        - timeout:
#if TOOLCHAIN_gnu
            timeout: 300
#else TOOLCHAIN_llvm
            timeout: 1800
#endif
        - timestamps
#if HOST_linux
        - ssh-agent-credentials:
            # tcwg-buildslave user id
            users:
                - 'e0958a95-204f-4c14-a66c-5e2be6c5d50a'
#endif
        - build-name:
#if TOOLCHAIN_gnu
            name: '#$BUILD_NUMBER-$version-$release_name-$buildnumber/$builder-$target'
#elif TOOLCHAIN_llvm && !HOST_windows
            name: '#$BUILD_NUMBER-$release-$candidate/$builder'
#elif TOOLCHAIN_llvm && HOST_windows
            name: '#$BUILD_NUMBER-$release/$builder'
#endif
        - workspace-cleanup
    builders:
#if TOOLCHAIN_gnu
        - shell: |
            #!/bin/bash
            set -ex
            abe_branch=tested
            eval $extra_options
            ./jenkins-scripts/docker-run.sh --distro "$distro" \
            -- \
            ./jenkins-scripts/tcwg-dev-build.sh \
            --abe_branch "$abe_branch" \
            --release_name "$release_name" \
            --buildnumber "$buildnumber" \
            --target "$target" \
            --version "$version" \
            --manifest "$(pwd)/manifest.txt" \
            --verbose "$verbose"
#elif TOOLCHAIN_llvm
# if HOST_linux
        - shell: |
            #!/bin/bash

            set -ex

            rm -rf artifacts
            mkdir artifacts

            # Until we figure out a way to use heavy-job with different weights
            # based on the builder, we hardcode to one.
            buildjobs=1

            # Select builder arch/type/container
            case ${builder} in
                tcwg-x86_64-build|tcwg-x86_64-cam)
                    builder_arch=amd64
                    buildjobs=8 # 1 slot is 32/4
                    ;;
                tcwg-tk1_32-build|tcwg-llvm_tk1-*)
                    builder_arch=armhf
                    buildjobs=3 # TK1s only have 4 cores and little RAM
                    ;;
                tcwg-jade*)
                    builder_arch=arm64
                    buildjobs=64 # Jades have lots of cores
                    ;;
                *) echo "ERROR: Unsupported label: $builder"; exit 1 ;;
            esac

            # Sets the system compiler
            compiler_option=''
            if [ "${toolchain:+set}" != "set" ] && [ "${compiler:+set}" = "set" ]; then
              compiler_option="--compiler=${compiler}"
            fi

            # Trigger toolchain name
            toolchain_file="${WORKSPACE}/llvm.params.toolchain"
            toolchain_file_option=""
            if ${twostage} || ${testsuite}; then
              toolchain_file_option="--toolchain-file=$toolchain_file"
            fi

            # Setup job parameters and run (for now, just pretend to run)
            ret=0
            ./jenkins-scripts/docker-run.sh \
                --arch ${builder_arch} \
                --distro ${build_container_tag} \
                -- \
                bash -x ./jenkins-scripts/tcwg-llvm-release.sh \
                --workspace=${WORKSPACE} \
                --release=${release} \
                --candidate=${candidate} \
                --buildjobs=${buildjobs} \
                --toolchain=${toolchain} \
                --use-ninja=${useninja} \
                $toolchain_file_option $compiler_option \
                > artifacts/release.log 2>&1 || ret=$?

            if [ $ret -ne 0 ]; then
                touch llvm.failed
            fi

            # Chained jobs
            if ${testsuite}; then
              echo "target_list=$builder" > llvm.params.testsuite
              cat $toolchain_file >> llvm.params.testsuite
            fi

            # failure is handled by conditional step on llvm.failed
            # so that the testsuite job is always triggered
            exit 0
        - conditional-step:
            condition-kind: file-exists
            condition-filename: llvm.params.testsuite
            steps:
                - trigger-builds:
                    - project: 'tcwg-llvm-testsuite'
                      property-file: llvm.params.testsuite
                      current-parameters: true
                      block: true
        - conditional-step:
            condition-kind: file-exists
            condition-filename: llvm.failed
            steps:
                - shell: "exit 1"
# elif HOST_windows
      - batch: |
          jenkins-scripts\tcwg-llvm-release.bat %release% %build_type%
# endif
#endif
    publishers:
        - archive:
            artifacts: 'artifacts/**'
            latest-only: false