.gitlab-ci.yml 6.32 KB
Newer Older
1 2
# -*- indent-tabs-mode: nil -*-

3
variables:
4
  # Container(OCI) images for various distros and architectures and compilers
5

6 7 8 9 10
  AMD64_FEDORA_LATEST:       "registry.gitlab.gnome.org/gnome/librsvg-oci-images/amd64/fedora:latest"
  AMD64_FEDORA_RAWHIDE:      "registry.gitlab.gnome.org/gnome/librsvg-oci-images/amd64/fedora:rawhide"
  AMD64_OPENSUSE_TUMBLEWEED: "registry.gitlab.gnome.org/gnome/librsvg-oci-images/amd64/opensuse:tumbleweed"
  AMD64_DEBIAN_TESTING:      "registry.gitlab.gnome.org/gnome/librsvg-oci-images/amd64/debian:testing"
  AMD64_UBUNTU_BIONIC:       "registry.gitlab.gnome.org/gnome/librsvg-oci-images/amd64/ubuntu:18.04"
11

12 13
  I386_DEBIAN_TESTING:       "registry.gitlab.gnome.org/gnome/librsvg-oci-images/i386/debian:testing"
  I386_UBUNTU_BIONIC:        "registry.gitlab.gnome.org/gnome/librsvg-oci-images/i386/ubuntu:18.04"
14

15
  RUSTC_1_26:                "registry.gitlab.gnome.org/gnome/librsvg-oci-images/rustc:1.26"
16 17
  RUSTC_1_27:                "registry.gitlab.gnome.org/gnome/librsvg-oci-images/rustc:1.27"
  RUSTC_1_28:                "registry.gitlab.gnome.org/gnome/librsvg-oci-images/rustc:1.28"
18

19
  RUSTFMT_NIGHTLY:           "registry.gitlab.com/alatiera/rustfmt-oci-image/rustfmt:nightly"
20
  CLIPPY_NIGHTLY:            "registry.gitlab.gnome.org/gnome/librsvg-oci-images/clippy:nightly"
21

22 23
  DEBIAN_WORKAROUND: ""

24 25
stages:
  - test
26
  - lint
27
  - distcheck
28
  - rustc
29
  - cross_distro
30

31
.test_template: &test
Jordan Petridis's avatar
Jordan Petridis committed
32 33 34
  before_script:
    # CCache Config
    - mkdir -p ccache
35
    - mkdir -p .cargo_cache
Jordan Petridis's avatar
Jordan Petridis committed
36 37 38 39
    - export CCACHE_BASEDIR=${PWD}
    - export CCACHE_DIR=${PWD}/ccache
    - export CC="ccache gcc"

40 41
    # Only stuff inside the repo directory can be cached
    # Override the CARGO_HOME variable to force it location
42
    - export CARGO_HOME="${PWD}/.cargo_cache"
Jordan Petridis's avatar
Jordan Petridis committed
43
  script:
44
    - rustc --version && cargo --version
45 46 47 48 49
    - mkdir -p _build
    - cd _build
    - ../autogen.sh ${DEBIAN_WORKAROUND} --enable-gtk-doc --enable-vala
    - make
    - make check
50 51 52 53

  artifacts:
    when: on_failure
    paths:
54 55
      - _build/tests/*.log
      - _build/tests/output/
56 57

  cache:
58 59 60 61
    # JOB_NAME - Each job will have it's own cache
    # COMMIT_REF_SLUG = Lowercase name of the branch
    # ^ Keep diffrerent caches for each branch
    key: "$CI_JOB_NAME-$CI_COMMIT_REF_SLUG"
Jordan Petridis's avatar
Jordan Petridis committed
62
    paths:
63
      - _build/target/
Jordan Petridis's avatar
Jordan Petridis committed
64 65
      - .cargo_cache/
      - ccache/
66

67 68 69 70 71 72
.distro_template: &distro_test
    stage: cross_distro
    <<: *test

.rustc_template: &rustc
    stage: rustc
73 74
    variables:
      DEBIAN_WORKAROUND: "GDK_PIXBUF_QUERYLOADERS=/usr/lib/x86_64-linux-gnu/gdk-pixbuf-2.0/gdk-pixbuf-query-loaders"
75
    <<: *test
76 77 78 79 80 81 82 83 84 85 86 87 88 89 90

# Jobs that are marked with stage_1 will be run on every commit, across every
# fork and branch. This only serves as documentation since it's equivelant to
# ommiting only: key. Thus why stage_1 jobs might not be marked.
.test_stage_1: &stage_1
  only: {}

# Jobs that are marked as stage 2 will be run for every commit
# at GNOME/librsvg/master too. Ideal targets for this stage are
# debug cross_distro tests, and debug cross_arch tests to avoid
# breakign i386 and arm builds again.
.test_stage_2: &stage_2
  only:
    # When branching a stable branch,
    # update the following line from master to branch's name.
91
    - librsvg-2.44@GNOME/librsvg
92
    - librsvg-2.42@GNOME/librsvg
93
    - master@GNOME/librsvg
94
    - librsvg-2.44
95
    - librsvg-2.42
96 97 98 99 100 101 102 103 104 105 106 107 108 109
    - schedules
    - tags
    - web

# Jobs that are marked as stage 3 will only run on scheduled pipelines.
# Ideal targets for this stage are expensive task, that only need to be run
# on a regular time interval. Ex testing all the gcc/rustc version that we target
.test_stage_3: &stage_3
  only:
    - schedules
    - tags
    - web

# STAGE 1 TESTS
110 111
########################################################################

112
fedora test:
113
  image: $AMD64_FEDORA_LATEST
114
  stage: test
115 116
  variables:
    LIBRSVG_DEBUG: "yes"
117
  <<: *test
118

119 120 121 122 123 124 125 126 127 128
# STAGE 1 LINTS
########################################################################

# Configure and run rustfmt on nightly
# Exits and builds fails on bad format
rustfmt:
  image: $RUSTFMT_NIGHTLY
  stage: lint
  script:
    - rustc --version && cargo --version
Jordan Petridis's avatar
Jordan Petridis committed
129 130
    - cargo fmt --version
    - cargo fmt --all -- --check
131

132

133 134 135 136 137 138 139 140 141 142 143
# Configure and run clippy on nightly
# Only fails on errors atm.
clippy:
  image: $CLIPPY_NIGHTLY
  stage: lint
  script:
    - rustc --version && cargo --version
    - cargo install clippy --force
    - cargo clippy --all
  when: manual

144 145
tarball:
  image: $AMD64_FEDORA_LATEST
146
  stage: lint
147 148 149 150
  variables:
    LIBRSVG_DEBUG: "yes"
  script:
    - rustc --version && cargo --version
151
    - |
152
      mkdir -p _build
153 154 155
      cd _build
      ../autogen.sh --enable-gtk-doc --enable-vala
      make distcheck DESTDIR=/tmp/distcheck
156 157
  <<: *stage_2

158
# STAGE 2 CROSS DISTRO TESTS
159 160
#######################################################################

161
fedora:rawhide:
162
  image: $AMD64_FEDORA_RAWHIDE
163 164
  variables:
    LIBRSVG_DEBUG: "yes"
165
  <<: *distro_test
166
  <<: *stage_2
167 168

opensuse:tumbleweed:
169
  image: $AMD64_OPENSUSE_TUMBLEWEED
170 171
  variables:
    LIBRSVG_DEBUG: "yes"
172
  <<: *distro_test
173
  <<: *stage_2
174

175
debian:testing:
176
  image: $AMD64_DEBIAN_TESTING
177 178
  variables:
    LIBRSVG_DEBUG: "yes"
179
    DEBIAN_WORKAROUND: "GDK_PIXBUF_QUERYLOADERS=/usr/lib/x86_64-linux-gnu/gdk-pixbuf-2.0/gdk-pixbuf-query-loaders"
180
  <<: *distro_test
181
  <<: *stage_2
182

183
debian_i386:testing:
184
  image: $I386_DEBIAN_TESTING
185 186
  variables:
    LIBRSVG_DEBUG: "yes"
187
    DEBIAN_WORKAROUND: "GDK_PIXBUF_QUERYLOADERS=/usr/lib/i386-linux-gnu/gdk-pixbuf-2.0/gdk-pixbuf-query-loaders"
188 189 190
  <<: *distro_test
  <<: *stage_2

191
# STAGE 3 CROSS DISTRO TESTS
192 193
#######################################################################

194 195 196 197 198 199 200 201
fedora:test_release:
  image: $AMD64_FEDORA_LATEST
  stage: test
  variables:
    LIBRSVG_DEBUG: "no"
  <<: *distro_test
  <<: *stage_3

202
debian:testing_release_i386:
203
  image: $I386_DEBIAN_TESTING
204 205
  variables:
    LIBRSVG_DEBUG: "no"
206
    DEBIAN_WORKAROUND: "GDK_PIXBUF_QUERYLOADERS=/usr/lib/i386-linux-gnu/gdk-pixbuf-2.0/gdk-pixbuf-query-loaders"
207
  <<: *distro_test
208
  <<: *stage_3
209 210 211 212

# STAGE 3 RUSTC TESTS
#######################################################################

213
rustc 1.26 1:
214 215 216 217 218
  image: $RUSTC_1_26
  variables:
    LIBRSVG_DEBUG: "yes"
  <<: *rustc
  <<: *stage_3
219

220
rustc 1.27 2:
221 222 223 224 225 226
  image: $RUSTC_1_27
  variables:
    LIBRSVG_DEBUG: "yes"
  <<: *rustc
  <<: *stage_3

227
rustc 1.28 3:
228 229 230 231 232
  image: $RUSTC_1_28
  variables:
    LIBRSVG_DEBUG: "yes"
  <<: *rustc
  <<: *stage_3