.gitlab-ci.yml 2.13 KB
Newer Older
1
2
default:
  image: "archlinux:latest"
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
14
15
16
  script:
    find . -iname "*.sh" -exec shellcheck {} +

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

yapf:
24
  stage: lint
25
26
  before_script:
    - pacman -Syu --needed --noconfirm yapf
Christian Rebischke's avatar
Christian Rebischke committed
27
28
29
30
  script:
    find . -iname "*.py" -exec python3 -m yapf -d {} +

flake8:
31
  stage: lint
32
33
  before_script:
    - pacman -Syu --needed --noconfirm flake8
Christian Rebischke's avatar
Christian Rebischke committed
34
35
36
37
  script:
    find . -iname "*.py" -exec python3 -m flake8 {} +

validate-packer:
38
  stage: lint
39
40
  before_script:
    - pacman -Syu --needed --noconfirm packer
Christian Rebischke's avatar
Christian Rebischke committed
41
  script:
42
43
44
    - packer validate -var "iso_checksum_url=https://mirror.pkgbuild.com/iso/latest/sha1sums.txt" -except=vagrant-cloud vagrant.json
    - packer validate local.json
    - packer validate cloud.json
Christian Rebischke's avatar
Christian Rebischke committed
45

46
build:qemu:
47
48
49
  stage: build
  tags:
    - secure-kvm
50
  before_script:
51
    - pacman -Syu --needed --noconfirm packer qemu-headless
52
  script:
53
    - packer build -parallel-builds=1 -var 'headless=true' -var 'write_zeroes=yes' -only=qemu local.json
54
55
  artifacts:
    paths:
56
      - "Arch-Linux-x86_64-qemu-*.box"
Sven-Hendrik Haase's avatar
Sven-Hendrik Haase committed
57
      - "output-qemu"
58
59
60
61
62
63
64
65
66
67
68
69
70
71
    expire_in: 2d
  resource_group: vm-build

build:virtualbox:
  stage: build
  tags:
    - secure-virtualbox
  before_script:
    - pacman -Syu --needed --noconfirm packer virtualbox
  script:
    - packer build -parallel-builds=1 -var 'headless=true' -var 'write_zeroes=yes' -only=virtualbox-iso local.json
  artifacts:
    paths:
      - "Arch-Linux-x86_64-virtualbox-*.box"
Sven-Hendrik Haase's avatar
Sven-Hendrik Haase committed
72
      - "output-virtualbox-iso"
73
    expire_in: 2d
74
  resource_group: vm-build
75
76
77
78
79
80
81
82
83

publish:
  stage: publish
  tags:
    - secure-kvm
    - secure-virtualbox
  before_script:
    - pacman -Syu --needed --noconfirm qemu-headless virtualbox packer
  script:
84
    - packer build -parallel-builds=1 -var "vagrant_cloud_token=$VAGRANT_API_TOKEN" -var 'headless=true' -var 'write_zeroes=yes' -except=vmware-iso vagrant.json
85
86
87
  only:
    variables:
      - $SCHEDULED_PUBLISH == "TRUE"
88
  resource_group: vm-build