From 6df6e01c38cc95c95e490a2e94d1962d7fa5b5ee Mon Sep 17 00:00:00 2001 From: Samuel Hym <samuel.hym@univ-lille.fr> Date: Mon, 30 May 2022 19:21:55 +0200 Subject: [PATCH] CI: Use local debian mirror instead of cache. Use the local debian mirror instead of the global one Only install the required packages, not all the recommended ones Use a short expiring date for artifacts, in cases of quick succession of CI builds, only the most recent is to be kept --- .ci/apt-get-and-cache.sh | 30 ------------------------------ .ci/apt-get.sh | 7 +++++++ .ci/sources.list | 2 ++ .gitlab-ci.yml | 7 ++----- 4 files changed, 11 insertions(+), 35 deletions(-) delete mode 100755 .ci/apt-get-and-cache.sh create mode 100755 .ci/apt-get.sh create mode 100644 .ci/sources.list diff --git a/.ci/apt-get-and-cache.sh b/.ci/apt-get-and-cache.sh deleted file mode 100755 index be41da9..0000000 --- a/.ci/apt-get-and-cache.sh +++ /dev/null @@ -1,30 +0,0 @@ -#!/bin/bash - -# "apt update ; apt install", with caching of the downloaded packages -# and current state, to minimise load on debian mirrors without having -# to build a new docker image - -CACHE=.ci/debian-cache.tar.gz - -if [ -z "$1" ]; then - printf 'Usage: %s <package>...\n' "$0" - exit 1 -fi - -if ls -sh $CACHE; then - sudo tar xvaf $CACHE -C /var -else - printf 'No debian cache to extract\n' -fi - -# Remove the configuration that disable apt cache -sudo rm /etc/apt/apt.conf.d/docker-clean - -sudo apt update -y -q -# first only download the packages, so that they end up in the cache -sudo DEBIAN_FRONTEND=noninteractive apt install -yqd "$@" -sudo tar caf $CACHE -C /var lib/apt cache/apt -ls -sh $CACHE - -# now really install the packages -sudo DEBIAN_FRONTEND=noninteractive apt install -yq --no-download "$@" diff --git a/.ci/apt-get.sh b/.ci/apt-get.sh new file mode 100755 index 0000000..79d9b4a --- /dev/null +++ b/.ci/apt-get.sh @@ -0,0 +1,7 @@ +#!/bin/bash + +# "apt update ; apt install", but from the local mirror + +sudo cp .ci/sources.list /etc/apt/sources.list +sudo apt update -yq +sudo DEBIAN_FRONTEND=noninteractive apt install -yq --no-install-recommends "$@" diff --git a/.ci/sources.list b/.ci/sources.list new file mode 100644 index 0000000..34836ad --- /dev/null +++ b/.ci/sources.list @@ -0,0 +1,2 @@ +deb http://debian.polytech-lille.fr/debian buster main +deb http://debian.polytech-lille.fr/debian buster-updates main diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index b7669ba..d0fce1b 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -3,16 +3,13 @@ image: "coqorg/coq:latest" build: stage: build script: - - .ci/apt-get-and-cache.sh ghc cabal-install libghc-language-c-dev libghc-wl-pprint-text-dev libghc-optparse-applicative-dev libghc-data-default-dev libghc-aeson-dev + - .ci/apt-get.sh ghc cabal-install libghc-language-c-dev libghc-wl-pprint-text-dev libghc-optparse-applicative-dev libghc-data-default-dev libghc-aeson-dev - cabal build - cp dist/build/digger/digger digger - cache: - paths: - - .ci/*-cache.tar.gz - when: 'always' artifacts: paths: - digger + expire_in: 1 hour test: stage: test -- GitLab