.gitlab-ci.yml 5.83 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
stages:
  - test
24
  - lint
25
  - distcheck
26
  - rustc
27
  - cross_distro
28

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

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

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

  cache:
57 58 59 60
    # 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
61
    paths:
62
      - _build/target/
Jordan Petridis's avatar
Jordan Petridis committed
63 64
      - .cargo_cache/
      - ccache/
65

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

.rustc_template: &rustc
    stage: rustc
    <<: *test
73 74 75 76 77 78 79 80 81 82 83 84 85 86 87

# 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.
88
    - librsvg-2.44@GNOME/librsvg
89
    - librsvg-2.42@GNOME/librsvg
90
    - master@GNOME/librsvg
91
    - librsvg-2.44
92
    - librsvg-2.42
93 94 95 96 97 98 99 100 101 102 103 104 105 106
    - 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
107 108
########################################################################

109
fedora test:
110
  image: $AMD64_FEDORA_LATEST
111
  stage: test
112 113
  variables:
    LIBRSVG_DEBUG: "yes"
114
  <<: *test
115

116 117 118 119 120 121 122 123 124 125
# 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
126 127
    - cargo fmt --version
    - cargo fmt --all -- --check
128

129

130 131 132 133 134 135 136 137 138 139 140
# 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

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

155
# STAGE 2 CROSS DISTRO TESTS
156 157
#######################################################################

158
fedora:rawhide:
159
  image: $AMD64_FEDORA_RAWHIDE
160 161
  variables:
    LIBRSVG_DEBUG: "yes"
162
  <<: *distro_test
163
  <<: *stage_2
164 165

opensuse:tumbleweed:
166
  image: $AMD64_OPENSUSE_TUMBLEWEED
167 168
  variables:
    LIBRSVG_DEBUG: "yes"
169
  <<: *distro_test
170
  <<: *stage_2
171

172
.debian:testing:
173
  image: $AMD64_DEBIAN_TESTING
174 175
  variables:
    LIBRSVG_DEBUG: "yes"
176
  <<: *distro_test
177
  <<: *stage_2
178

179
.debian_i386:testing:
180
  image: $I386_DEBIAN_TESTING
181 182 183 184 185
  variables:
    LIBRSVG_DEBUG: "yes"
  <<: *distro_test
  <<: *stage_2

186
# STAGE 3 CROSS DISTRO TESTS
187 188
#######################################################################

189 190 191 192 193 194 195 196
fedora:test_release:
  image: $AMD64_FEDORA_LATEST
  stage: test
  variables:
    LIBRSVG_DEBUG: "no"
  <<: *distro_test
  <<: *stage_3

197
.debian:testing_release_i386:
198
  image: $I386_DEBIAN_TESTING
199 200
  variables:
    LIBRSVG_DEBUG: "no"
201
  <<: *distro_test
202
  <<: *stage_3
203 204 205 206

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

207
.rustc 1.26 1:
208 209 210 211 212
  image: $RUSTC_1_26
  variables:
    LIBRSVG_DEBUG: "yes"
  <<: *rustc
  <<: *stage_3
213

214
.rustc 1.27 2:
215 216 217 218 219 220
  image: $RUSTC_1_27
  variables:
    LIBRSVG_DEBUG: "yes"
  <<: *rustc
  <<: *stage_3

221
.rustc 1.28 3:
222 223 224 225 226
  image: $RUSTC_1_28
  variables:
    LIBRSVG_DEBUG: "yes"
  <<: *rustc
  <<: *stage_3