.gitlab-ci.yml 8.88 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
debian-image:arm:
  extends: .debian-image
  variables:
    ARCH: arm
  tags:
    - arm64

96
##############################################################################
Eric Timmons's avatar
Eric Timmons committed
97
# Utils
98
99
##############################################################################

Eric Timmons's avatar
Eric Timmons committed
100
.git-repo-needed:
Eric Timmons's avatar
Eric Timmons committed
101
  before_script:
102
103
104
    # 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.
105
106
107
108
    - |
      if [ -z "$CI_COMMIT_TAG" ]; then
        git checkout -B $CI_MERGE_REQUEST_SOURCE_BRANCH_NAME $CI_COMMIT_BRANCH $CI_COMMIT_SHA
      fi
Eric Timmons's avatar
Eric Timmons committed
109
110

.git-repo-needed:windows:
111
112
113
114
  variables:
    GIT_STRATEGY: clone
    GIT_SUBMODULE_STRATEGY: none
    GIT_CHECKOUT: "false"
Eric Timmons's avatar
Eric Timmons committed
115
116
117
118
  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.
119
120
121
122
123
124
    - |
      if ($CI_COMMIT_TAG) {
        git checkout $CI_COMMIT_TAG
      } else {
        git checkout -B $CI_MERGE_REQUEST_SOURCE_BRANCH_NAME $CI_COMMIT_BRANCH $CI_COMMIT_SHA
      }
Eric Timmons's avatar
Eric Timmons committed
125
126
127
128
129
130
131
132
133
134
135
    - 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
136
  script:
137
    - sbcl --script scripts/build-release.lisp --static
138
139
  artifacts:
    paths:
140
      - releases/
141

142
143
static-release:linux:amd64:
  extends: .static-release
144
145
146
  variables:
    ARCH: amd64

Eric Timmons's avatar
Eric Timmons committed
147
148
149
150
151
static-release:linux:arm64:
  extends: .static-release
  variables:
    ARCH: arm64
  tags:
152
    - arm64
153
  rules:
154
    - if: '$CLPM_CI_LINUX_ARM64'
Eric Timmons's avatar
Eric Timmons committed
155

156
##############################################################################
157
# Build dynamic releases
158
##############################################################################
Eric Timmons's avatar
Eric Timmons committed
159

160
.dynamic-release:
161
  stage: build
162
  image: $CI_REGISTRY_IMAGE/ci:$SBCL_VERSION-$DEBIAN_VERSION-$ARCH
Eric Timmons's avatar
Eric Timmons committed
163
  extends: .git-repo-needed
164
  script:
165
    - sbcl --script scripts/build-release.lisp
166
167
  artifacts:
    paths:
168
      - releases/
Eric Timmons's avatar
Eric Timmons committed
169

170
171
dynamic-release:linux:amd64:
  extends: .dynamic-release
Eric Timmons's avatar
Eric Timmons committed
172
173
174
  variables:
    ARCH: amd64

175
176
177
178
179
180
dynamic-release:linux:arm64:
  extends: .dynamic-release
  variables:
    ARCH: arm64
  tags:
    - arm64
181
  rules:
182
    - if: '$CLPM_CI_LINUX_ARM64'
Eric Timmons's avatar
Eric Timmons committed
183

184
dynamic-release:linux:arm:
Eric Timmons's avatar
Eric Timmons committed
185
186
187
188
189
190
  extends: .dynamic-release
  variables:
    ARCH: arm
  tags:
    - arm64
  rules:
191
    - if: '$CLPM_CI_LINUX_ARM64'
Eric Timmons's avatar
Eric Timmons committed
192

193
dynamic-release:macos:amd64:
Eric Timmons's avatar
Eric Timmons committed
194
  stage: build
195
  extends: .dynamic-release
Eric Timmons's avatar
Eric Timmons committed
196
197
  tags:
    - macos-0.4-amd64
Eric Timmons's avatar
Eric Timmons committed
198
  needs: []
199
  rules:
200
    - if: '$CLPM_CI_MACOS_AMD64'
Eric Timmons's avatar
Eric Timmons committed
201

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

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

Eric Timmons's avatar
Eric Timmons committed
223
.linux-test:
Eric Timmons's avatar
Eric Timmons committed
224
225
  stage: test
  image: clfoundation/sbcl:$SBCL_VERSION
Eric Timmons's avatar
Eric Timmons committed
226
  extends: .git-repo-needed
Eric Timmons's avatar
Eric Timmons committed
227
228
229
230
  script:
    # Install from the release archive!
    - VERSION=$(sbcl --script scripts/version.lisp)
    - cd /tmp
Eric Timmons's avatar
Eric Timmons committed
231
    - tar xvf $CI_PROJECT_DIR/releases/$VARIANT/clpm-$VERSION-linux-$ARCH.tar.gz
Eric Timmons's avatar
Eric Timmons committed
232
233
234
235
236
    - 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
237
238
239
240
241
242

test-static-release:linux:amd64:
  extends: .linux-test
  variables:
    ARCH: amd64
    VARIANT: static
Eric Timmons's avatar
Eric Timmons committed
243
244
  needs:
    - static-release:linux:amd64
Eric Timmons's avatar
Eric Timmons committed
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

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'

Eric Timmons's avatar
Eric Timmons committed
278
.test-dynamic-release:linux:arm:
Eric Timmons's avatar
Eric Timmons committed
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
  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
305
    - sudo sh install.sh
Eric Timmons's avatar
Eric Timmons committed
306
307
308
309
310
311
312
313
314
315
    - 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'

Eric Timmons's avatar
Eric Timmons committed
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
# 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'
#     - Update-SessionEnvironment
#     - clpm version -VV
#     - sbcl --script scripts/test.lisp
#   needs:
#     - dynamic-release:windows:amd64
#   tags:
#     - windows-amd64
#   rules:
#     - if: '$CLPM_CI_WINDOWS_AMD64'