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

3 4 5 6 7 8 9 10 11 12 13 14
variables:
  # Docker images for various distros and architectures

  AMD64_FEDORA_LATEST:       "registry.gitlab.com/alatiera/librsvg-oci-images/amd64/fedora:latest"
  AMD64_OPENSUSE_TUMBLEWEED: "registry.gitlab.com/alatiera/librsvg-oci-images/amd64/opensuse:tumbleweed"
  AMD64_DEBIAN_TESTING:      "registry.gitlab.com/alatiera/librsvg-oci-images/amd64/debian:testing"

  I386_DEBIAN_TESTING:       "registry.gitlab.com/alatiera/librsvg-oci-images/i386/debian:testing"

  RUSTFMT_NIGHTLY:           "registry.gitlab.com/alatiera/rustfmt-oci-image/rustfmt:nightly"
  RUST_NIGHTLY:              "rustlang/rust:nightly"

Federico Mena Quintero's avatar
Federico Mena Quintero committed
15 16
stages:
  - test
17
  - lint
18
  - cross_distro
Federico Mena Quintero's avatar
Federico Mena Quintero committed
19

20
.test_template: &distro_test
Jordan Petridis's avatar
Jordan Petridis committed
21 22 23
  before_script:
    # CCache Config
    - mkdir -p ccache
24
    - mkdir -p .cargo_cache
Jordan Petridis's avatar
Jordan Petridis committed
25 26 27 28
    - export CCACHE_BASEDIR=${PWD}
    - export CCACHE_DIR=${PWD}/ccache
    - export CC="ccache gcc"

29 30
    # Only stuff inside the repo directory can be cached
    # Override the CARGO_HOME variable to force it location
31
    - export CARGO_HOME="${PWD}/.cargo_cache"
Jordan Petridis's avatar
Jordan Petridis committed
32
  script:
33
    - rustc --version && cargo --version
34
    - ./autogen.sh --enable-gtk-doc --enable-vala
35 36 37 38 39 40 41 42 43 44 45 46 47
    - make check

  after_script:
    - mkdir png_artifacts
    - cp /tmp/*.png png_artifacts

  artifacts:
    when: on_failure
    paths:
      - tests/*.log
      - png_artifacts

  cache:
48 49 50 51
    # 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
52 53 54 55
    paths:
      - target/
      - .cargo_cache/
      - ccache/
56

57 58 59 60 61 62 63 64
# .deb_template: &deb_deps
#   before_script:
#     - apt update -yqq
#     - apt-get install -yqq gcc make
#                   automake autoconf libtool gettext itstool
#                   libgdk-pixbuf2.0-dev libgirepository1.0-dev
#                   gtk-doc-tools git libgtk-3-dev rustc cargo
#                   libxml2-dev libcroco3-dev libcairo2-dev libpango1.0-dev
65

66 67 68
# TEST STAGE
########################################################################

69
fedora:test:
70
  image: $AMD64_FEDORA_LATEST
71
  stage: test
72 73
  variables:
    LIBRSVG_DEBUG: "yes"
74 75
  <<: *distro_test

76
fedora:test_release:
77
  image: $AMD64_FEDORA_LATEST
78
  stage: test
79 80
  variables:
    LIBRSVG_DEBUG: "no"
81
  <<: *distro_test
82

83

84
# CROSS DISTRO AMD64 TEST STAGE
85 86
#######################################################################

87
fedora:rawhide:
88
  image: $AMD64_FEDORA_LATEST
89
  stage: cross_distro
90 91
  variables:
    LIBRSVG_DEBUG: "yes"
92 93 94 95 96 97
  <<: *distro_test
  only:
    - master
    - schedules
    - tags
    - web
98 99

opensuse:tumbleweed:
100
  image: $AMD64_OPENSUSE_TUMBLEWEED
101
  stage: cross_distro
102 103
  variables:
    LIBRSVG_DEBUG: "yes"
104 105
  <<: *distro_test
  only:
106 107 108 109
    - master
    - schedules
    - tags
    - web
110

111
debian:testing:
112
  image: $AMD64_DEBIAN_TESTING
113
  stage: cross_distro
114 115
  variables:
    LIBRSVG_DEBUG: "yes"
116 117
  <<: *distro_test
  only:
118 119 120 121
    - master
    - schedules
    - tags
    - web
122 123 124 125 126

# TODO: Enable this when ubuntu update it's rustc package
# https://launchpad.net/ubuntu/+source/rustc/1.23.0+dfsg1+llvm-0ubuntu2
# ubuntu:18.04:
#   image: ubuntu:18.04
127
#   stage: cross_distro
128 129 130
#   <<: *deb_deps
#   <<: *distro_test
#   only:
Jordan Petridis's avatar
Jordan Petridis committed
131 132 133 134
#     - master
#     - schedules
#     - tags
#     - web
135 136


137
# CROSS DISTRO RELEASE AMD64 TEST STAGE
138 139 140
#######################################################################

fedora:rawhide_release:
141
  image: $AMD64_FEDORA_LATEST
142
  stage: cross_distro
143 144
  variables:
    LIBRSVG_DEBUG: "no"
145
  <<: *distro_test
146 147 148 149 150 151
  only:
    - schedules
    - tags
    - web

opensuse:tumbleweed_release:
152
  image: $AMD64_OPENSUSE_TUMBLEWEED
153
  stage: cross_distro
154 155
  variables:
    LIBRSVG_DEBUG: "no"
156
  <<: *distro_test
157 158 159 160 161 162
  only:
    - schedules
    - tags
    - web

debian:testing_release:
Jordan Petridis's avatar
Jordan Petridis committed
163
  image: $AMD64_DEBIAN_TESTING
164
  stage: cross_distro
165 166
  variables:
    LIBRSVG_DEBUG: "no"
167
  <<: *distro_test
168 169 170 171 172
  only:
    - schedules
    - tags
    - web

173 174 175 176
# CROSS DISTRO i386
#######################################################################

debian:testing_i386:
177
  image: $I386_DEBIAN_TESTING
178
  stage: cross_distro
179 180
  variables:
    LIBRSVG_DEBUG: "yes"
181 182
  <<: *distro_test
  only:
183
    - master
184 185 186 187
    - schedules
    - tags
    - web

188 189 190 191
# CROSS DISTRO RELEASE i386
#######################################################################

debian:testing_release_i386:
192
  image: $I386_DEBIAN_TESTING
193
  stage: cross_distro
194 195
  variables:
    LIBRSVG_DEBUG: "no"
196 197 198 199 200
  <<: *distro_test
  only:
    - schedules
    - tags
    - web
201 202 203 204

# LINT STAGE
#######################################################################

205
# Configure and run rustfmt on nightly
Jordan Petridis's avatar
Jordan Petridis committed
206
# Exits and builds fails on bad format
207
rustfmt:
208
  image: $RUSTFMT_NIGHTLY
209 210
  stage: lint
  script:
211 212
    - rustc --version && cargo --version
    - cargo fmt --all -- --write-mode=diff
213

214

215 216 217
# Configure and run clippy on nightly
# Only fails on errors atm.
clippy:
218
  image: $RUST_NIGHTLY
219
  stage: lint
Jordan Petridis's avatar
Jordan Petridis committed
220 221 222 223 224 225
  before_script:
    - apt update -yqq
    - apt-get install -yqq --no-install-recommends libgdk-pixbuf2.0-dev
                      libgirepository1.0-dev gtk-doc-tools git  libgtk-3-dev
                      libxml2-dev libcroco3-dev libcairo2-dev libpango1.0-dev

226
  script:
227 228 229
    - rustc --version && cargo --version
    - cargo install clippy --force
    - cargo clippy --all
230
  when: manual