.gitlab-ci.yml 8.69 KB
Newer Older
Eric Timmons's avatar
Eric Timmons committed
1
2
variables:
  GIT_SUBMODULE_STRATEGY: recursive
Eric Timmons's avatar
Eric Timmons committed
3
4
  DOCKER_HUB_CI_REPO: daewok/clpm-ci

Eric Timmons's avatar
Eric Timmons committed
5
include:
6
  - template: 'Workflows/MergeRequest-Pipelines.gitlab-ci.yml'
7
  - local: "/.gitlab-ci.versions.yml"
Eric Timmons's avatar
Eric Timmons committed
8

Eric Timmons's avatar
Eric Timmons committed
9
10
stages:
  - prep
Eric Timmons's avatar
Eric Timmons committed
11
  - build
Eric Timmons's avatar
Eric Timmons committed
12
  - test
Eric Timmons's avatar
Eric Timmons committed
13

14
15
16
17
18
19
20
21
22
##############################################################################
# Build Docker images for CI
##############################################################################

.alpine-image:
  stage: prep
  image:
    name: gcr.io/kaniko-project/executor:debug
    entrypoint: [""]
23
24
  variables:
    GIT_SUBMODULE_STRATEGY: none
25
26
27
28
29
30
31
32
33
34
  script:
    - mkdir -p /kaniko/.docker
    - echo "{\"auths\":{\"$CI_REGISTRY\":{\"username\":\"$CI_REGISTRY_USER\",\"password\":\"$CI_REGISTRY_PASSWORD\"}}}" > /kaniko/.docker/config.json
    - |
      /kaniko/executor --cache --cache-repo $CI_REGISTRY_IMAGE/kaniko \
                       --context $CI_PROJECT_DIR \
                       --build-arg sbcl_version=$SBCL_VERSION \
                       --build-arg alpine_version=$ALPINE_VERSION \
                       --dockerfile $CI_PROJECT_DIR/docker/Dockerfile.alpine-ci \
                       --destination $CI_REGISTRY_IMAGE/ci:$SBCL_VERSION-alpine$ALPINE_VERSION-$ARCH
35
  rules:
36
    - if: '($CI_PIPELINE_SOURCE == "merge_request_event" || $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH) && ($ARCH == "amd64" || ($ARCH == "arm" && $CLPM_CI_LINUX_ARM64) || ($ARCH == "arm64" && $CLPM_CI_LINUX_ARM64))'
37
38
39
      changes:
        - .gitlab-ci.versions.yml
        - docker/Dockerfile.alpine-ci
40
41
42
43
44
45

.debian-image:
  stage: prep
  image:
    name: gcr.io/kaniko-project/executor:debug
    entrypoint: [""]
46
47
  variables:
    GIT_SUBMODULE_STRATEGY: none
48
49
50
51
52
53
54
55
  script:
    - mkdir -p /kaniko/.docker
    - echo "{\"auths\":{\"$CI_REGISTRY\":{\"username\":\"$CI_REGISTRY_USER\",\"password\":\"$CI_REGISTRY_PASSWORD\"}}}" > /kaniko/.docker/config.json
    - |
      /kaniko/executor --cache --cache-repo $CI_REGISTRY_IMAGE/kaniko \
                       --context $CI_PROJECT_DIR \
                       --build-arg sbcl_version=$SBCL_VERSION \
                       --build-arg debian_version=$DEBIAN_VERSION \
Eric Timmons's avatar
Eric Timmons committed
56
                       --customPlatform=linux/$ARCH \
57
58
                       --dockerfile $CI_PROJECT_DIR/docker/Dockerfile.debian-ci \
                       --destination $CI_REGISTRY_IMAGE/ci:$SBCL_VERSION-$DEBIAN_VERSION-$ARCH
59
  rules:
60
    - if: '($CI_PIPELINE_SOURCE == "merge_request_event" || $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH) && ($ARCH == "amd64" || ($ARCH == "arm" && $CLPM_CI_LINUX_ARM64) || ($ARCH == "arm64" && $CLPM_CI_LINUX_ARM64))'
61
62
63
      changes:
        - .gitlab-ci.versions.yml
        - docker/Dockerfile.debian-ci
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

alpine-image:amd64:
  extends: .alpine-image
  variables:
    ARCH: amd64

alpine-image:arm64:
  extends: .alpine-image
  variables:
    ARCH: arm64
  tags:
    - arm64

debian-image:amd64:
  extends: .debian-image
  variables:
    ARCH: amd64

debian-image:arm64:
  extends: .debian-image
  variables:
    ARCH: arm64
  tags:
    - arm64

Eric Timmons's avatar
Eric Timmons committed
89
90
91
92
93
94
95
96
97
debian-image:arm:
  extends: .debian-image
  variables:
    ARCH: arm
  tags:
    - arm64
  rules:
    - when: on_success

98
##############################################################################
Eric Timmons's avatar
Eric Timmons committed
99
# Utils
100
101
##############################################################################

Eric Timmons's avatar
Eric Timmons committed
102
.git-repo-needed:
Eric Timmons's avatar
Eric Timmons committed
103
  before_script:
104
105
106
107
    # This looks a little funky, but only one of
    # $CI_MERGE_REQUEST_SOURCE_BRANCH_NAME and $CI_COMMIT_BRANCH will ever be
    # defined at once.
    - git checkout -B $CI_MERGE_REQUEST_SOURCE_BRANCH_NAME $CI_COMMIT_BRANCH $CI_COMMIT_SHA
Eric Timmons's avatar
Eric Timmons committed
108
109

.git-repo-needed:windows:
110
111
112
113
  variables:
    GIT_STRATEGY: clone
    GIT_SUBMODULE_STRATEGY: none
    GIT_CHECKOUT: "false"
Eric Timmons's avatar
Eric Timmons committed
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
  before_script:
    # This looks a little funky, but only one of
    # $CI_MERGE_REQUEST_SOURCE_BRANCH_NAME and $CI_COMMIT_BRANCH will ever be
    # defined at once.
    - git checkout -B $CI_MERGE_REQUEST_SOURCE_BRANCH_NAME $CI_COMMIT_BRANCH $CI_COMMIT_SHA
    - git submodule init
    - git submodule update

##############################################################################
# Build static releases
##############################################################################

.static-release:
  stage: build
  image: $CI_REGISTRY_IMAGE/ci:$SBCL_VERSION-alpine$ALPINE_VERSION-$ARCH
  extends: .git-repo-needed
130
  script:
131
    - sbcl --script scripts/build-release.lisp --static
132
133
  artifacts:
    paths:
134
      - releases/
135

136
137
static-release:linux:amd64:
  extends: .static-release
138
139
140
  variables:
    ARCH: amd64

Eric Timmons's avatar
Eric Timmons committed
141
142
143
144
145
static-release:linux:arm64:
  extends: .static-release
  variables:
    ARCH: arm64
  tags:
146
    - arm64
147
  rules:
148
    - if: '$CLPM_CI_LINUX_ARM64'
Eric Timmons's avatar
Eric Timmons committed
149

150
##############################################################################
151
# Build dynamic releases
152
##############################################################################
Eric Timmons's avatar
Eric Timmons committed
153

154
.dynamic-release:
155
  stage: build
156
  image: $CI_REGISTRY_IMAGE/ci:$SBCL_VERSION-$DEBIAN_VERSION-$ARCH
Eric Timmons's avatar
Eric Timmons committed
157
  extends: .git-repo-needed
158
  script:
159
    - sbcl --script scripts/build-release.lisp
160
161
  artifacts:
    paths:
162
      - releases/
Eric Timmons's avatar
Eric Timmons committed
163

164
165
dynamic-release:linux:amd64:
  extends: .dynamic-release
Eric Timmons's avatar
Eric Timmons committed
166
167
168
  variables:
    ARCH: amd64

169
170
171
172
173
174
dynamic-release:linux:arm64:
  extends: .dynamic-release
  variables:
    ARCH: arm64
  tags:
    - arm64
175
  rules:
176
    - if: '$CLPM_CI_LINUX_ARM64'
Eric Timmons's avatar
Eric Timmons committed
177

178
dynamic-release:linux:arm:
Eric Timmons's avatar
Eric Timmons committed
179
180
181
182
183
184
  extends: .dynamic-release
  variables:
    ARCH: arm
  tags:
    - arm64
  rules:
185
    - if: '$CLPM_CI_LINUX_ARM64'
Eric Timmons's avatar
Eric Timmons committed
186

187
dynamic-release:macos:amd64:
Eric Timmons's avatar
Eric Timmons committed
188
  stage: build
189
  extends: .dynamic-release
Eric Timmons's avatar
Eric Timmons committed
190
191
  tags:
    - macos-0.4-amd64
Eric Timmons's avatar
Eric Timmons committed
192
  needs: []
193
  rules:
194
    - if: '$CLPM_CI_MACOS_AMD64'
Eric Timmons's avatar
Eric Timmons committed
195

196
dynamic-release:windows:amd64:
Eric Timmons's avatar
Eric Timmons committed
197
  stage: build
198
  image: $CI_REGISTRY_IMAGE/ci:$SBCL_VERSION-windowsservercore
Eric Timmons's avatar
Eric Timmons committed
199
  extends: .git-repo-needed:windows
200
201
202
203
  script:
    - $env:WIX = "C:\wix"
    - sbcl --script scripts/build-release.lisp
    - sbcl --script scripts/build-msi.lisp
204
205
206
207
  artifacts:
    paths:
      - releases/
  rules:
208
    - if: '$CLPM_CI_WINDOWS_AMD64'
Eric Timmons's avatar
Eric Timmons committed
209
  needs: []
Eric Timmons's avatar
Eric Timmons committed
210
211
  tags:
    - windows-amd64
Eric Timmons's avatar
Eric Timmons committed
212
213
214
215
216

##############################################################################
# Tests
##############################################################################

Eric Timmons's avatar
Eric Timmons committed
217
.linux-test:
Eric Timmons's avatar
Eric Timmons committed
218
219
  stage: test
  image: clfoundation/sbcl:$SBCL_VERSION
Eric Timmons's avatar
Eric Timmons committed
220
  extends: .git-repo-needed
Eric Timmons's avatar
Eric Timmons committed
221
222
223
224
  script:
    # Install from the release archive!
    - VERSION=$(sbcl --script scripts/version.lisp)
    - cd /tmp
Eric Timmons's avatar
Eric Timmons committed
225
    - tar xvf $CI_PROJECT_DIR/releases/$VARIANT/clpm-$VERSION-linux-$ARCH.tar.gz
Eric Timmons's avatar
Eric Timmons committed
226
227
228
229
230
    - cd clpm-$VERSION-linux-$ARCH
    - sh install.sh
    - clpm version -VV
    - cd $CI_PROJECT_DIR
    - sbcl --script scripts/test.lisp
Eric Timmons's avatar
Eric Timmons committed
231
232
233
234
235
236

test-static-release:linux:amd64:
  extends: .linux-test
  variables:
    ARCH: amd64
    VARIANT: static
Eric Timmons's avatar
Eric Timmons committed
237
238
  needs:
    - static-release:linux:amd64
Eric Timmons's avatar
Eric Timmons committed
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
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298

test-static-release:linux:arm64:
  extends: .linux-test
  variables:
    ARCH: arm64
    VARIANT: static
  needs:
    - static-release:linux:arm64
  tags:
    - arm64
  rules:
    - if: '$CLPM_CI_LINUX_ARM64'

test-dynamic-release:linux:amd64:
  extends: .linux-test
  variables:
    ARCH: amd64
    VARIANT: dynamic
  needs:
    - dynamic-release:linux:amd64

test-dynamic-release:linux:arm64:
  extends: .linux-test
  variables:
    ARCH: arm64
    VARIANT: dynamic
  needs:
    - dynamic-release:linux:arm64
  tags:
    - arm64
  rules:
    - if: '$CLPM_CI_LINUX_ARM64'

test-dynamic-release:linux:arm:
  extends: .linux-test
  # We need an image that specifes the arch directly since we're testing on an
  # arm64 machine.
  image: $CI_REGISTRY_IMAGE/ci:$SBCL_VERSION-$DEBIAN_VERSION-$ARCH
  variables:
    ARCH: arm
    VARIANT: dynamic
  needs:
    - dynamic-release:linux:arm
  tags:
    - arm64
  rules:
    - if: '$CLPM_CI_LINUX_ARM64'

test-dynamic-release:macos:amd64:
  stage: test
  extends: .git-repo-needed
  variables:
    ARCH: amd64
    VARIANT: dynamic
  script:
    # Install from the release archive!
    - VERSION=$(sbcl --script scripts/version.lisp)
    - cd /tmp
    - tar xvf $CI_PROJECT_DIR/releases/$VARIANT/clpm-$VERSION-darwin-$ARCH.tar.gz
    - cd clpm-$VERSION-darwin-$ARCH
Eric Timmons's avatar
Eric Timmons committed
299
    - sudo sh install.sh
Eric Timmons's avatar
Eric Timmons committed
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
    - clpm version -VV
    - cd $CI_PROJECT_DIR
    - sbcl --script scripts/test.lisp
  needs:
    - dynamic-release:macos:amd64
  tags:
    - macos-0.4-amd64
  rules:
    - if: '$CLPM_CI_MACOS_AMD64'

test-dynamic-release:windows:amd64:
  stage: test
  extends: .git-repo-needed:windows
  image: $CI_REGISTRY_IMAGE/ci:$SBCL_VERSION-windowsservercore
  variables:
    ARCH: amd64
    VARIANT: dynamic
  script:
    - $VERSION = sbcl --script scripts/version.lisp
    - cp "releases/$VARIANT/clpm-$VERSION-windows-amd64.msi" "C:\clpm-installer.msi"
    - Start-Process msiexec.exe -Wait -ArgumentList '/I C:\clpm-installer.msi'
    - clpm version -VV
    - sbcl --script scripts/test.lisp
  needs:
    - dynamic-release:windows:amd64
  tags:
    - windows-amd64
  rules:
    - if: '$CLPM_CI_WINDOWS_AMD64'