From 329eaceb80d9dd710c4d44ff139cf8dc266cd289 Mon Sep 17 00:00:00 2001 From: Alexander Batischev Date: Tue, 15 Jun 2021 18:01:34 +0300 Subject: Migrate CI to Docker --- .gitlab-ci.yml | 38 +++++++++----------------------------- 1 file changed, 9 insertions(+), 29 deletions(-) (limited to '.gitlab-ci.yml') diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 0f701b0..8c2f77f 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -1,48 +1,28 @@ -# Debian Buster (10) with the latest Rust stable -image: rust:1-buster - variables: # GitLab CI can only cache data that resides in /builds/ and /cache/ # directories[1]. Both of these locations are *not* writeable to non-privileged # users, but the project directory (the Git workdir) is — it's - # world-writeable. So we ask Cargo to put its caches inside the Git workdir, - # and install binaries (e.g. cargo-sweep) in there too. + # world-writeable. So we ask Cargo to put its caches inside the Git workdir. # # 1. https://gitlab.com/gitlab-org/gitlab-runner/-/issues/327 CARGO_HOME: $CI_PROJECT_DIR/.cargo - CARGO_INSTALL_ROOT: $CI_PROJECT_DIR/.local/ + +default: + image: registry.gitlab.com/obnam/container-images:main check: script: - - sh -c 'echo "deb http://ci-prod-controller.vm.liw.fi/debian unstable-ci main" > /etc/apt/sources.list.d/liw.fi.list' - - echo -e '-----BEGIN PGP PUBLIC KEY BLOCK-----\n\nmQINBFrLO7kBEADdz6mHstYmKU5Dp6OSjxWtWaqTDOX1sJdmmaIK/9EKVIH0Maxp\n5kvVO5G6mULLAjv/kLG0MxasHPrq8I2A/y8AqKAGVL8QelwLjQMIFZ30/VbGQPHS\n+T5TZXEnoQtNce1GUhFwJ38ZyjjwHBFV9tSec7rZ2Q3YeM3nNnGPf6DacXGfEOPO\nHIN4sXAN2hzNXNjKRzTIvxQseb6nr7afUh/SlZ3yhQOCrIzmYlD7tP9WJe7ofL0p\nJY4pDQYw8rT6nC2BE/ioemh84kERCT1vCe+OVFlSRuMlqfEv+ZpKQ+itOmPDQ/lM\njpUm1K2hrW/lWpxT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oMStgnv/Wnw6LacEL32ek39Desero/D8iGLZernK\nQ2mC9mua5A/bYGVhsNWyURNFkKdbFa+/wW3NfdKYyZnsSfo+jJ2luNewrhAY7Kod\nGWXTer9RxzTGA3EXFGvNr+BBOOxSj0SfWTl0Olo7J5dnxof+jLAUS1VHpceHGHps\nGSJSdir7NkZidgwoCPA7BTqsb5LN\n=dXB0\n-----END PGP PUBLIC KEY BLOCK-----' | apt-key add - - - apt-get update - - apt-get install --assume-yes summain subplot daemonize python3-requests python3-yaml - - - rustup component add clippy rustfmt - - - useradd --create-home tester - # A tool we use to keep the size of Cargo's "target" directory in check - - su tester sh -c 'cargo install cargo-sweep' - - # The following should closely match the contents of the "check" script, - # minus Subplot docgen - - su tester sh -c 'cargo clippy --all-targets' - - su tester sh -c 'cargo build --all-targets' - - su tester sh -c 'cargo fmt -- --check' - - su tester sh -c 'cargo test' - - su tester sh -c 'subplot codegen obnam.md -o test.py' - - su tester sh -c 'python3 test.py --log test.log || cat test.log' - + # If any of the checks fail, print out the Subplot log and propagate the + # error. + - ./check -v || (cat test.log; exit 1) # Remove all build artifacts unrelated to the currently installed Rust # toolchain(s). We have to tweak the PATH because of the caching-related # shenanigans described in the "variables" section above. - - su tester sh -c 'PATH=${CARGO_INSTALL_ROOT}/bin:${PATH} cargo sweep --installed' + - PATH=${CARGO_INSTALL_ROOT}/bin:${PATH} cargo sweep --installed cache: - key: check-job-cache + key: check-job-cache-for-docker paths: - $CARGO_HOME/registry/cache - $CARGO_HOME/registry/index - - $CARGO_INSTALL_ROOT - target -- cgit v1.2.1