File: ci.yml

package info (click to toggle)
apptainer 1.4.5-2
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 12,780 kB
  • sloc: sh: 3,329; ansic: 1,706; awk: 414; python: 103; makefile: 54
file content (489 lines) | stat: -rw-r--r-- 15,176 bytes parent folder | download | duplicates (2)
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
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
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
name: ci
on:
  pull_request:

jobs:
  check_go_mod:
    name: check_go_mod
    runs-on: ubuntu-22.04
    container: golang:1.23.6
    steps:
      - uses: actions/checkout@v2

      - name: Check go.mod
        run: |
          git config --global --add safe.directory $(pwd)
          ./scripts/check-go.mod

  lint_markdown:
    name: lint_markdown
    runs-on: ubuntu-22.04
    container: node:20-slim
    steps:
      - uses: actions/checkout@v2

      - name: Install markdownlint
        run: npm install -g markdownlint-cli

      - name: Check for Lint
        run: markdownlint --ignore LICENSE_DEPENDENCIES.md .

  check_source:
    name: check_source
    runs-on: ubuntu-22.04
    container: golangci/golangci-lint:v1.60.1
    steps:
      - uses: actions/checkout@v2

      - name: Check apptainer source
        run: |
          git config --global --add safe.directory $(pwd)
          ./mconfig -v -p /usr/local --with-suid
          make -C ./builddir check

  shellcheck:
    name: shellcheck
    runs-on: ubuntu-22.04
    container: koalaman/shellcheck-alpine
    steps:
      - uses: actions/checkout@v2
      - name: shellcheck files that appear to be sh or bash scripts (or some cousin thereof)
        run: |
          shellcheck $( ./scripts/get-shell-files.sh )

  alpine:
    name: alpine
    runs-on: ubuntu-22.04
    container: golang:1.23-alpine
    steps:
      - name: Fetch deps
        run: apk add -q --no-cache git bash alpine-sdk automake libtool linux-headers libarchive-dev util-linux-dev libuuid openssl-dev gawk sed cryptsetup

      - uses: actions/checkout@v2

      - name: Build Apptainer
        run: |
          git config --global --add safe.directory $(pwd)
          ./mconfig -v -p /usr/local --with-suid
          make -C ./builddir all

  oldgo:
    name: oldgo
    runs-on: ubuntu-22.04
    # match the minimum version required by mconfig
    container: golang:1.23-alpine
    steps:
      - name: Fetch deps
        run: apk add -q --no-cache git bash alpine-sdk automake libtool linux-headers libarchive-dev util-linux-dev libuuid openssl-dev gawk sed cryptsetup

      - uses: actions/checkout@v2

      - name: Build Apptainer
        run: |
          git config --global --add safe.directory $(pwd)
          ./mconfig -v -p /usr/local --with-suid
          make -C ./builddir all

  check_test_corpus:
    name: check_test_corpus
    runs-on: ubuntu-22.04
    container: golang:1.23.6
    steps:
      - uses: actions/checkout@v2

      - name: Generate Certificates
        run: |
          git config --global --add safe.directory $(pwd)
          cd test/certs/ && go run ./gen_certs.go && cd ../..

      - name: Check Test Corpus Tidiness
        run: git diff --exit-code --

  check_license_dependencies:
    name: check_license_dependencies
    runs-on: ubuntu-22.04
    container: golang:1.23.6
    steps:
      - uses: actions/checkout@v2

      - name: Update LICENSE_DEPENDENCIES.md
        run: |
          git config --global --add safe.directory $(pwd)
          ./scripts/update-license-dependencies.sh

      - name: Check License Changes
        run: git diff --exit-code -- LICENSE_DEPENDENCIES.md

  debbuild-debian11:
    name: debbuild-debian11
    runs-on: ubuntu-22.04
    steps:
      - uses: actions/checkout@v2
      # fetch tags as checkout@v2 doesn't do that by default
      - run: git fetch --prune --unshallow --tags --force

      - name: Build and test deb under docker
        env:
          OS_TYPE: debian
          OS_VERSION: 11
          # setting GO_ARCH speeds things by using go binaries instead of source
          GO_ARCH: linux-amd64
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
        run: ./scripts/ci-docker-run

  debbuild-debian12:
    name: debbuild-debian12
    runs-on: ubuntu-22.04
    steps:
      - uses: actions/checkout@v2
      # fetch tags as checkout@v2 doesn't do that by default
      - run: git fetch --prune --unshallow --tags --force

      - name: Build and test deb under docker
        env:
          OS_TYPE: debian
          OS_VERSION: 12
          # setting GO_ARCH speeds things by using go binaries instead of source
          GO_ARCH: linux-amd64
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
        run: ./scripts/ci-docker-run

  debbuild-ubuntu22:
    name: debbuild-ubuntu22
    runs-on: ubuntu-22.04
    steps:
      - uses: actions/checkout@v2
      # fetch tags as checkout@v2 doesn't do that by default
      - run: git fetch --prune --unshallow --tags --force

      - name: Build and test deb under docker
        env:
          OS_TYPE: ubuntu
          OS_VERSION: '22.04'
          GO_ARCH: linux-amd64
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
        run: ./scripts/ci-docker-run
  
  debbuild-ubuntu24:
    name: debbuild-ubuntu24
    runs-on: ubuntu-22.04
    steps:
      - uses: actions/checkout@v2
      # fetch tags as checkout@v2 doesn't do that by default
      - run: git fetch --prune --unshallow --tags --force

      - name: Build and test deb under docker
        env:
          OS_TYPE: ubuntu
          OS_VERSION: 24.04
          GO_ARCH: linux-amd64
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
        run: ./scripts/ci-docker-run

  rpmbuild-rocky8:
    name: rpmbuild-rocky8
    runs-on: ubuntu-22.04
    steps:
      - uses: actions/checkout@v2
      # fetch tags as checkout@v2 doesn't do that by default
      - run: git fetch --prune --unshallow --tags --force

      - name: Build and test rpm under docker
        env:
          OS_TYPE: rockylinux
          OS_VERSION: 8
          GO_ARCH: linux-amd64
        run: ./scripts/ci-docker-run

      - name: Install and test unprivileged for rocky 8
        env:
          OS_TYPE: rockylinux
          OS_VERSION: 8
          TEST_TYPE: unpriv
        run: ./scripts/ci-docker-run

      - name: Install and test unprivileged for rocky 9 with rocky 8 container
        env:
          OS_TYPE: rockylinux
          OS_VERSION: 9
          CONTAINER_VERS: rockylinux:8
          TEST_TYPE: unpriv
        run: ./scripts/ci-docker-run

      - name: Install and test unprivileged for ubuntu 20.04
        env:
          OS_TYPE: ubuntu
          OS_VERSION: 20.04
          TEST_TYPE: unpriv
        run: ./scripts/ci-docker-run

      - name: Install and test unprivileged for debian 11
        env:
          OS_TYPE: debian
          OS_VERSION: 11
          TEST_TYPE: unpriv
        run: ./scripts/ci-docker-run

      - name: Install and test unprivileged for openSUSE leap
        env:
          OS_TYPE: opensuse/leap
          OS_VERSION: latest
          TEST_TYPE: unpriv
        run: ./scripts/ci-docker-run

      - name: Install and test unprivileged for openSUSE tumbleweed
        env:
          OS_TYPE: opensuse/tumbleweed
          OS_VERSION: latest
          TEST_TYPE: unpriv
        run: ./scripts/ci-docker-run

  rpmbuild-rocky9:
    name: rpmbuild-rocky9
    runs-on: ubuntu-22.04
    steps:
      - uses: actions/checkout@v2
      # fetch tags as checkout@v2 doesn't do that by default
      - run: git fetch --prune --unshallow --tags --force

      - name: Build and test rpm under docker
        env:
          OS_TYPE: rockylinux
          OS_VERSION: 9
          GO_ARCH: linux-amd64
        run: ./scripts/ci-docker-run

      - name: Install and test unprivileged for rocky 9
        env:
          OS_TYPE: rockylinux
          OS_VERSION: 9
          TEST_TYPE: unpriv
        run: ./scripts/ci-docker-run

      - name: Install and test unprivileged for ubuntu 22.04
        env:
          OS_TYPE: ubuntu
          OS_VERSION: 22.04
          TEST_TYPE: unpriv
        run: ./scripts/ci-docker-run

  rpmbuild-opensuse-leap:
    name: rpmbuild-opensuse-leap
    runs-on: ubuntu-22.04
    steps:
      - uses: actions/checkout@v2
      # fetch tags as checkout@v2 doesn't do that by default
      - run: git fetch --prune --unshallow --tags --force

      - name: Build and test rpm under docker
        env:
          OS_TYPE: opensuse/leap
          OS_VERSION: latest
          GO_ARCH: linux-amd64
        run: ./scripts/ci-docker-run

      - name: Install and test unprivileged for openSUSE leap
        env:
          OS_TYPE: opensuse/leap
          OS_VERSION: latest
          INS_OPTS: -o -d suse15
          TEST_TYPE: unpriv
        run: ./scripts/ci-docker-run

  rpmbuild-opensuse-tumbleweed:
    name: rpmbuild-opensuse-tumbleweed
    runs-on: ubuntu-22.04
    steps:
      - uses: actions/checkout@v2
      # fetch tags as checkout@v2 doesn't do that by default
      - run: git fetch --prune --unshallow --tags --force

      - name: Build and test rpm under docker
        env:
          OS_TYPE: opensuse/tumbleweed
          OS_VERSION: latest
          GO_ARCH: linux-amd64
        run: ./scripts/ci-docker-run

      - name: Install and test unprivileged for openSUSE tumbleweed
        env:
          OS_TYPE: opensuse/tumbleweed
          OS_VERSION: latest
          INS_OPTS: -o -d opensuse-tumbleweed
          TEST_TYPE: unpriv
        run: ./scripts/ci-docker-run

  unit_tests:
    name: unit_tests
    runs-on: ubuntu-22.04
    steps:
      - uses: actions/checkout@v2
      # fetch tags as checkout@v2 doesn't do that by default
      - run: git fetch --prune --unshallow --tags --force

      - name: Setup Go
        uses: actions/setup-go@v2
        with:
          go-version: 1.23.6

      - name: Fetch deps
        run: |
          set -e
          sudo apt-get -q update
          sudo DEBIAN_FRONTEND=noninteractive apt-get install -y build-essential libseccomp-dev fakeroot cryptsetup dbus-user-session 
          sudo DEBIAN_FRONTEND=noninteractive apt-get install -y autoconf automake libtool pkg-config libfuse3-dev zlib1g-dev liblzo2-dev liblz4-dev liblzma-dev libzstd-dev

      - name: Download, compile, and install dependent packages
        run: |
          set -ex
          ./scripts/download-dependencies 
          ./scripts/compile-dependencies
          sudo mkdir -p /usr/local/libexec/apptainer/bin
          sudo ./scripts/install-dependencies /usr/local/libexec

      - name: Build and install Apptainer
        run: |
          ./mconfig -v -p /usr/local --with-suid
          make -C ./builddir all && sudo make -C ./builddir install

      - name: Run unit tests
        run: make -C ./builddir unit-test

      - name: Check NFPM
        run: |
          go install github.com/goreleaser/nfpm/v2/cmd/nfpm@v2.10.0
          go run ./dist/nfpm/generate.go -version $(./scripts/get-version) -prefix /usr/local | \
          $HOME/go/bin/nfpm package -f /dev/stdin -p deb -t ./builddir

  integration_tests:
    name: integration_tests
    runs-on: ubuntu-22.04
    steps:
      - uses: actions/checkout@v2
      # fetch tags as checkout@v2 doesn't do that by default
      - run: git fetch --prune --unshallow --tags --force

      - name: Setup Go
        uses: actions/setup-go@v2
        with:
          go-version: 1.23.6

      - name: Fetch deps
        run: sudo apt-get -q update && sudo DEBIAN_FRONTEND=noninteractive apt-get install -y build-essential libseccomp-dev cryptsetup dbus-user-session

      - name: Build and install Apptainer
        run: |
          ./mconfig -v -p /usr/local --with-suid
          make -C ./builddir all && sudo make -C ./builddir install

      - name: Run integration tests
        run: make -C ./builddir integration-test

  e2e_tests:
    name: e2e_tests
    runs-on: ubuntu-22.04
    steps:
      - uses: actions/checkout@v2
      # fetch tags as checkout@v2 doesn't do that by default
      - run: git fetch --prune --unshallow --tags --force

      - name: Check changes
        env:
          PROJECT_REF: ${{ github.ref }}
          PROJECT_REPOSITORY: ${{ github.repository }}
          PROJECT_PR_NUMBER: ${{ github.event.pull_request.number }}
        run: |
          git config --global --add safe.directory $(pwd)
          rc=0
          ./scripts/should-e2e-run "${PROJECT_REPOSITORY}" "${PROJECT_REF##*/}" "${PROJECT_PR_NUMBER}" || rc=$?
          case $rc in
            0)
              echo "Verifying critical changes"
              echo "run_tests=true" >> $GITHUB_ENV ;;
            1)
              echo "No critical changes, skipping tests" ;;
            *)
              echo "E: ./scripts/should-e2e-run returned with exit code $rc. Abort."
              exit $rc ;;
          esac

      - name: Setup Go
        if: env.run_tests
        uses: actions/setup-go@v2
        with:
          go-version: 1.23.6

      - name: Fetch deps
        if: env.run_tests
        run: |
          set -e
          sudo apt-get -q update
          sudo DEBIAN_FRONTEND=noninteractive apt-get install -y build-essential libseccomp-dev uidmap fakeroot cryptsetup dbus-user-session
          sudo DEBIAN_FRONTEND=noninteractive apt-get install -y autoconf automake libtool pkg-config libfuse3-dev zlib1g-dev liblzo2-dev liblz4-dev liblzma-dev libzstd-dev

      - name: Download, compile, and install dependent packages
        if: env.run_tests
        run: |
          set -ex
          ./scripts/download-dependencies 
          ./scripts/compile-dependencies
          sudo mkdir -p /usr/local/libexec/apptainer/bin
          sudo ./scripts/install-dependencies /usr/local/libexec

      - name: Enable full cgroups v2 delegation
        if: env.run_tests
        run: |
          sudo mkdir -p /etc/systemd/system/user@.service.d
          cat <<EOF | sudo tee /etc/systemd/system/user@.service.d/delegate.conf
          [Service]
          Delegate=cpu cpuset io memory pids
          EOF
          sudo systemctl daemon-reload

      - name: Build and install Apptainer
        if: env.run_tests
        run: |
          ./mconfig -v -p /usr/local --with-suid
          make -C ./builddir all && sudo make -C ./builddir install

      - name: Run E2E tests
        if: env.run_tests
        env:
          E2E_PARALLEL: 8
        run: |
          # Set up systemd for the rootless cgroups tests
          systemctl --user daemon-reload
          systemctl --user start dbus
          export DBUS_SESSION_BUS_ADDRESS="unix:path=/run/user/$UID/bus"
          systemd-run --user --scope make -C ./builddir e2e-test

      - name: Upload artifacts
        if: env.run_tests
        uses: actions/upload-artifact@v4
        with:
          name: e2e-artifact
          path: builddir/e2e-cmd-report.txt
          retention-days: 7

  check_pkg_no_buildcfg:
    name: check_pkg_no_buildcfg
    runs-on: ubuntu-22.04
    steps:
      - uses: actions/checkout@v2
      # fetch tags as checkout@v2 doesn't do that by default
      - run: git fetch --prune --unshallow --tags --force

      - name: Setup Go
        uses: actions/setup-go@v2
        with:
          go-version: 1.23.6

      - name: Check pkg/... doesn't depend on buildcfg
        run: |
          if $(/usr/local/go/bin/go list -f '{{.Deps}}' ./pkg/... | grep -q buildcfg)
          then
            echo "Prohibited buildcfg dependency found in pkg/:"
            echo
            /usr/local/go/bin/go list -f '{{.ImportPath}} - {{.Deps}}' ./pkg/... | grep buildcfg
            exit 1
          fi