.gitlab-ci.yml 8.95 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/
Eric Timmons's avatar
Eric Timmons committed
141
    expire_in: 2 weeks
142

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

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

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

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

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

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

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

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

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

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

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

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

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
281
.test-dynamic-release:linux:arm:
Eric Timmons's avatar
Eric Timmons committed
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
  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
308
    - sudo sh install.sh
Eric Timmons's avatar
Eric Timmons committed
309
310
311
312
313
314
315
316
317
318
    - 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
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
# 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'