.gitlab-ci.yml 2.52 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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
build:cloud-qemu:
  stage: build
  tags:
    - secure-kvm
  before_script:
    - pacman -Syu --needed --noconfirm packer qemu-headless
  script:
    - packer build -parallel-builds=1 -var 'headless=true' -var 'write_zeroes=yes' -except=sign cloud.json
  artifacts:
    name: "cloud-qemu"
    paths:
      - "release/Arch-Linux-x86_64-cloudimg-*.img"
    expire_in: 2d
  resource_group: vm-build

build:vagrant-qemu:
62
63
64
  stage: build
  tags:
    - secure-kvm
65
  before_script:
66
    - pacman -Syu --needed --noconfirm packer qemu-headless
67
  script:
68
    - packer build -parallel-builds=1 -var 'headless=true' -var 'write_zeroes=yes' -only=qemu local.json
69
70
  artifacts:
    paths:
Sven-Hendrik Haase's avatar
Sven-Hendrik Haase committed
71
      - "Arch-Linux-x86_64-libvirt-*.box"
72
    expire_in: 3h
73
74
  resource_group: vm-build

75
build:vagrant-virtualbox:
76
77
78
79
80
81
82
83
84
85
  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"
86
    expire_in: 3h
87
  resource_group: vm-build
88
89
90
91
92
93
94
95
96

publish:
  stage: publish
  tags:
    - secure-kvm
    - secure-virtualbox
  before_script:
    - pacman -Syu --needed --noconfirm qemu-headless virtualbox packer
  script:
Sven-Hendrik Haase's avatar
Sven-Hendrik Haase committed
97
    - packer build -force -parallel-builds=1 -var "vagrant_cloud_token=$VAGRANT_API_TOKEN" -var 'headless=true' -var 'write_zeroes=yes' -except=vmware-iso vagrant.json
98
  only:
99
100
    refs:
      - release
101
102
    variables:
      - $SCHEDULED_PUBLISH == "TRUE"
103
  resource_group: vm-build