.gitlab-ci.yml 1.72 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:
47
48
49
50
  stage: build
  tags:
    - secure-kvm
    - secure-virtualbox
51
  before_script:
52
    - pacman -Syu --needed --noconfirm qemu-headless virtualbox packer
53
  script:
54
    packer build -parallel-builds=1 -var 'headless=true' -var 'write_zeroes=yes' -except=vmware-iso local.json
55
56
57
58
  artifacts:
    paths:
      - "*.box"
    expire_in: 3h
59
  resource_group: vm-build
60
61
62
63
64
65
66
67
68
69

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