.gitlab-ci.yml 1.43 KB
Newer Older
1
2
default:
  image: "archlinux:latest"
Sven-Hendrik Haase's avatar
Sven-Hendrik Haase committed
3

4
stages:
5
  - lint
6
  - build
7
  - publish
8

Christian Rebischke's avatar
Christian Rebischke committed
9
shellcheck:
10
  stage: lint
11
12
  before_script:
    - pacman -Syu --needed --noconfirm shellcheck
Christian Rebischke's avatar
Christian Rebischke committed
13
  script:
14
    - find . -iname "*.sh" -exec shellcheck {} +
Christian Rebischke's avatar
Christian Rebischke committed
15
16

shfmt:
17
  stage: lint
18
19
  before_script:
    - pacman -Syu --needed --noconfirm shfmt
Christian Rebischke's avatar
Christian Rebischke committed
20
  script:
21
    - find . -iname "*.sh" -exec shfmt -i 2 -ci -d {} +
Christian Rebischke's avatar
Christian Rebischke committed
22

23
24
# Note: We explicitly need the `ipv6` tag here because otherwise we'd get random
# gpg/pacman-key issues.
25
build:
26
  stage: build
Sven-Hendrik Haase's avatar
Sven-Hendrik Haase committed
27
28
  tags:
    - ipv6
29
  before_script:
30
    - pacman -Syu --needed --noconfirm qemu-headless libisoburn
31
  script:
32
33
    - echo "BUILD_DATE=$(date -I)" > build.env
    - . build.env
34
    - ./build-in-qemu.sh
35
    - mv build.env output/
36
  artifacts:
37
    name: "output"
38
    paths:
39
      - "output/*"
40
    expire_in: 2d
41
42
43
44

publish:
  stage: publish
  tags:
45
46
    - ipv6
    - secure
47
  before_script:
48
    - pacman -Syu --needed --noconfirm vagrant
49
  script:
50
51
    - . output/build.env
    - vagrant cloud auth login --token "${VAGRANT_API_TOKEN}"
52
53
    - vagrant cloud auth login --check
    - vagrant cloud box show archlinux/archlinux
54
55
    - vagrant cloud publish archlinux/archlinux "v${BUILD_DATE}" libvirt output/Arch-Linux-x86_64-libvirt-*.box --release -f
    - vagrant cloud publish archlinux/archlinux "v${BUILD_DATE}" virtualbox output/Arch-Linux-x86_64-virtualbox-*.box --release -f
56
57
58
  only:
    variables:
      - $SCHEDULED_PUBLISH == "TRUE"
59
  resource_group: vm-build