.gitlab-ci.yml 5.79 KB
Newer Older
1 2 3 4 5 6 7

# We can not do multi-level includes, so we need to manually include all of
# our templates here
include:
  # projects using these templates should not need to pull the bootstrap
  - local: '/bootstrap/bootstrap.yml'

8 9 10
  # Alpine container builder template
  # projects using this should reference this with the following:
  #
11
  # - project: 'freedesktop/ci-templates'
12
  #   ref: master # or git sha, see https://docs.gitlab.com/ce/ci/yaml/#includefile
13 14 15
  #   file: '/templates/alpine.yml'
  #
  - local: '/templates/alpine.yml'
16
  - local: '/.gitlab-ci/alpine-ci.yml'
17 18 19 20

  # Arch container builder template
  # projects using this should reference this with the following:
  #
21
  # - project: 'freedesktop/ci-templates'
22
  #   ref: master # or git sha, see https://docs.gitlab.com/ce/ci/yaml/#includefile
23 24 25
  #   file: '/templates/arch.yml'
  #
  - local: '/templates/arch.yml'
26
  - local: '/.gitlab-ci/arch-ci.yml'
27 28 29 30

  # Centos container builder template
  # projects using this should reference this with the following:
  #
31
  # - project: 'freedesktop/ci-templates'
32
  #   ref: master # or git sha, see https://docs.gitlab.com/ce/ci/yaml/#includefile
33 34 35
  #   file: '/templates/centos.yml'
  #
  - local: '/templates/centos.yml'
36
  - local: '/.gitlab-ci/centos-ci.yml'
37

38 39 40
  # Debian container builder template
  # projects using this should reference this with the following:
  #
41
  # - project: 'freedesktop/ci-templates'
42
  #   ref: master # or git sha, see https://docs.gitlab.com/ce/ci/yaml/#includefile
43 44 45
  #   file: '/templates/debian.yml'
  #
  - local: '/templates/debian.yml'
46
  - local: '/.gitlab-ci/debian-ci.yml'
47 48

  # Fedora container builder template
49 50
  # projects using this should reference this with the following:
  #
51
  # - project: 'freedesktop/ci-templates'
52
  #   ref: master # or git sha, see https://docs.gitlab.com/ce/ci/yaml/#includefile
53 54
  #   file: '/templates/fedora.yml'
  #
55
  - local: '/templates/fedora.yml'
56
  - local: '/.gitlab-ci/fedora-ci.yml'
57

Benjamin Tissoires's avatar
Benjamin Tissoires committed
58
  # Ubuntu container builder template
59 60
  # projects using this should reference this with the following:
  #
61
  # - project: 'freedesktop/ci-templates'
62
  #   ref: master # or git sha, see https://docs.gitlab.com/ce/ci/yaml/#includefile
63 64
  #   file: '/templates/ubuntu.yml'
  #
Benjamin Tissoires's avatar
Benjamin Tissoires committed
65
  - local: '/templates/ubuntu.yml'
66
  - local: '/.gitlab-ci/ubuntu-ci.yml'
Benjamin Tissoires's avatar
Benjamin Tissoires committed
67

68 69

stages:
70
  - sanity check
71
  - bootstrapping
72
  - bootstrapping_qemu
73 74
  - alpine_container_build
  - alpine_check
Benjamin Tissoires's avatar
Benjamin Tissoires committed
75 76
  - arch_container_build
  - arch_check
77 78
  - centos_container_build
  - centos_check
79 80 81 82
  - debian_container_build
  - debian_check
  - fedora_container_build
  - fedora_check
83 84
  - ubuntu_container_build
  - ubuntu_check
85
  - deploy
86
  - publish
87
  - test published images
88 89


90
#
91 92 93
# We want those to fail as early as possible, so we are using a plain fedora
# image, and there is no need to run `dnf update` as we only need to run
# one python script.
94
#
95 96

.pip_install:
97
  stage: sanity check
98
  image: python:alpine
99
  before_script:
100
    - apk add git
101 102 103

sanity check:
  extends: .pip_install
104 105 106 107 108 109 110 111
  script:
    - pip3 install --user jinja2 PyYAML
    - python3 ./src/generate_templates.py

    - git diff --exit-code && exit 0 || true

    - echo "some files were not generated through 'src/generate_templates.py' or
      have not been committed. Please edit the files under 'src', run
Bastien Nocera's avatar
Bastien Nocera committed
112
      'src/generate_templates.py' and then commit the result"
113 114
    - exit 1

115 116

check commits:
117
  extends: .pip_install
118
  script:
119 120
    - pip3 install .
    - ci-fairy check-commits --signed-off-by --junit-xml=results.xml
121
  except:
122
    - master@freedesktop/ci-templates
123 124
  variables:
    GIT_DEPTH: 100
125
    GIT_STRATEGY: clone
126 127 128 129
  artifacts:
    reports:
      junit: results.xml

130 131 132 133 134 135 136 137 138 139 140 141

pytest ci-fairy:
  extends: .pip_install
  script:
    - pip3 install pytest
    - pip3 install .
    - pytest --junitxml=results.xml
  artifacts:
    reports:
      junit: results.xml


142 143 144 145 146 147 148 149 150 151
flake8 ci-fairy:
  extends: .pip_install
  script:
    - pip3 install flake8
    # 501: line too long
    # 504: line break after binary operator
    # 741: ambiguous variable name
    - flake8 --ignore=W501,E501,W504,W741,E741


152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170
check merge request:
  extends: .pip_install
  stage: deploy
  script:
    - pip3 install .
    - ci-fairy check-merge-request --require-allow-collaboration --junit-xml=check-merge-request.xml
  artifacts:
    expire_in: 1 week
    when: on_failure
    paths:
      - check-merge-request.xml
    reports:
      junit: check-merge-request.xml
  variables:
    FDO_UPSTREAM_REPO: freedesktop/ci-templates
  # We allow this to fail because no MR may have been filed yet
  allow_failure: true


Peter Hutterer's avatar
Peter Hutterer committed
171 172
pages:
  extends: .pip_install
173
  stage: deploy
Peter Hutterer's avatar
Peter Hutterer committed
174
  script:
175 176 177 178
  - pip3 install sphinx sphinx-rtd-theme
  # Upstream bug in the HTML rendering for YAML nodes so let's used the fixed version
  # until this gets merged
  - pip3 install git+https://github.com/whot/sphinxcontrib-autoyaml.git@wip/fix-definition-rendering
179
  - sh -x doc/build-docs.sh
180
  - mv build public
Peter Hutterer's avatar
Peter Hutterer committed
181 182 183
  artifacts:
    paths:
    - public
184

Jonas Ådahl's avatar
Jonas Ådahl committed
185 186
bootstrap@x86_64:
  extends: .bootstrap@x86_64
187 188


Jonas Ådahl's avatar
Jonas Ådahl committed
189 190
bootstrap@aarch64:
  extends: .bootstrap@aarch64
191 192


Jonas Ådahl's avatar
Jonas Ådahl committed
193 194
bootstrap-qemu@x86_64:
  extends: .qemu@x86_64
195
  needs:
Jonas Ådahl's avatar
Jonas Ådahl committed
196
    - bootstrap@x86_64
197 198


Jonas Ådahl's avatar
Jonas Ådahl committed
199 200
bootstrap-qemu-mkosi@x86_64:
  extends: .qemu-mkosi@x86_64
201
  needs:
Jonas Ådahl's avatar
Jonas Ådahl committed
202
    - bootstrap@x86_64
203 204 205 206 207 208 209 210 211 212 213 214 215 216 217

#
# Verify that all quay.io images directly referenced by our templates
# exist
#
test published images:
  image: $CI_REGISTRY_IMAGE/x86_64/buildah:2020-10-30.1
  stage: test published images
  script:
    - skopeo inspect docker://quay.io/freedesktop.org/ci-templates:buildah-aarch64-2020-10-30.1
    - skopeo inspect docker://quay.io/freedesktop.org/ci-templates:buildah-x86_64-2020-10-30.1
    - skopeo inspect docker://quay.io/freedesktop.org/ci-templates:qemu-base-x86_64-2020-10-30.1
    - skopeo inspect docker://quay.io/freedesktop.org/ci-templates:qemu-mkosi-base-x86_64-2020-10-30.1
  rules:
    - if: '$CI_COMMIT_BRANCH == "master" && $CI_PROJECT_PATH == "freedesktop/ci-templates"'