From 8a827e1e232b795a92da584c3e9cd51a46315680 Mon Sep 17 00:00:00 2001 From: Peter Lebbing Date: Thu, 5 Dec 2024 19:27:31 +0100 Subject: [PATCH] GitLab CI: Use Stackage Docker image (#2805) It no longer uses our own Docker CI image, and doesn't run `.ci/setup.sh`. Further housekeeping: 1. Extract `CLASH_DOCKER_TAG` and `CACHE_BUST_TOKEN` from `image`, `CACHE_FALLBACK_KEY` and `cache.key` tokens/vars, so there is a single place to change them, as otherwise I would have added another place to keep the bust token synchronized. 2. Add Docker images for GHC 9.10.1 to builder script. 3. An overlapping `apt-get install` in building the Docker images has been removed; every `build-$tool` image starts from the `builder` image, so it will already have what is in `DEPS_COMMON` installed, adding it to `DEPS_$tool` is redundant and a no-op. This means DEPS_VERILATOR doesn't need zlib1g-dev. The other dependencies have been sorted alphabetically. There are still no-ops (such as zlib1g-dev implying zlib1g already), but no outright overlap. 4. All GHC's have been bumped to their latest minor; same for the base Ubuntu Docker image. --- .ci/docker/Dockerfile | 2 +- .ci/docker/build-and-publish-docker-image.sh | 4 ++-- .ci/gitlab/common.yml | 10 ++++++---- .ci/stack_build.sh | 11 ---------- .gitlab-ci.yml | 21 +++++++++++++++++--- 5 files changed, 27 insertions(+), 21 deletions(-) delete mode 100755 .ci/stack_build.sh diff --git a/.ci/docker/Dockerfile b/.ci/docker/Dockerfile index 5d6aab556a..0e27f30e25 100644 --- a/.ci/docker/Dockerfile +++ b/.ci/docker/Dockerfile @@ -95,7 +95,7 @@ RUN git clone https://github.com/cliffordwolf/SymbiYosys.git SymbiYosys \ FROM builder AS build-verilator -ARG DEPS_VERILATOR="perl python3 make autoconf g++ flex bison ccache libgoogle-perftools-dev numactl perl-doc libfl2 libfl-dev zlib1g zlib1g-dev help2man" +ARG DEPS_VERILATOR="ccache help2man libfl-dev libfl2 libgoogle-perftools-dev make numactl perl perl-doc python3 zlib1g" RUN apt-get install -y --no-install-recommends $DEPS_VERILATOR ARG verilator_version="v5.020" diff --git a/.ci/docker/build-and-publish-docker-image.sh b/.ci/docker/build-and-publish-docker-image.sh index f4f9e834c9..c447185c6f 100755 --- a/.ci/docker/build-and-publish-docker-image.sh +++ b/.ci/docker/build-and-publish-docker-image.sh @@ -14,8 +14,8 @@ elif [[ "$1" != "" ]]; then exit 1 fi -UBUNTU_VERSION=jammy-20240125 -GHC_VERSIONS=( "9.8.2" "9.6.4" "9.4.8" "9.2.8" "9.0.2" "8.10.7") +UBUNTU_VERSION=jammy-20240808 +GHC_VERSIONS=("9.10.1" "9.8.2" "9.6.6" "9.4.8" "9.2.8" "9.0.2" "8.10.7") CABAL_VERSION="3.12.1.0" # We want to use docker buildkit so that our layers are built in parallel. This diff --git a/.ci/gitlab/common.yml b/.ci/gitlab/common.yml index 50cd16ab5b..8808ae70de 100644 --- a/.ci/gitlab/common.yml +++ b/.ci/gitlab/common.yml @@ -8,17 +8,19 @@ default: - stuck_or_timeout_failure .common: - image: ghcr.io/clash-lang/clash-ci:$GHC_VERSION-20240721 + image: ghcr.io/clash-lang/clash-ci:$GHC_VERSION-$CLASH_DOCKER_TAG timeout: 10 minutes stage: build variables: + CLASH_DOCKER_TAG: 20240905 + CACHE_BUST_TOKEN: 3 # Note that we copy+paste the image name into CACHE_FALLBACK_KEY. If we don't, # $GHC_VERSION gets inserted at verbatim, instead of resolving to some ghc version. - CACHE_FALLBACK_KEY: $CI_JOB_NAME-master-ghcr.io/clash-lang/clash-ci:$GHC_VERSION-20240721-3-3-non_protected + CACHE_FALLBACK_KEY: $CI_JOB_NAME-master-ghcr.io/clash-lang/clash-ci:$GHC_VERSION-$CLASH_DOCKER_TAG-$CACHE_BUST_TOKEN-3-non_protected GIT_SUBMODULE_STRATEGY: recursive TERM: xterm-color cache: - key: $CI_JOB_NAME-$CI_COMMIT_REF_SLUG-$CI_JOB_IMAGE-3 + key: $CI_JOB_NAME-$CI_COMMIT_REF_SLUG-$CI_JOB_IMAGE-$CACHE_BUST_TOKEN when: always paths: - cache.tar.zst @@ -31,7 +33,7 @@ default: - .ci/setup.sh after_script: - export THREADS=$(./.ci/effective_cpus.sh) - - tar -cf - $(ls -d /root/.cabal /root/.stack || true) | zstd -T${THREADS} -3 > cache.tar.zst + - tar -cf - /root/.cabal | zstd -T$THREADS -3 > cache.tar.zst # We run tests on local machines if: # diff --git a/.ci/stack_build.sh b/.ci/stack_build.sh deleted file mode 100755 index c000662544..0000000000 --- a/.ci/stack_build.sh +++ /dev/null @@ -1,11 +0,0 @@ -#!/bin/bash -set -xeo pipefail - -apt update -apt install wget -y -wget -q https://get.haskellstack.org/ -O stack_install.sh -sh stack_install.sh -# Note: the --pedantic switch adds -Wall -Werror to the options passed to GHC. -# Options specified in stack.yaml (like -Wcompat) are still passed; it is -# cumulative. Future versions of Stack might add behavior to --pedantic. -stack build -j${THREADS} --pedantic diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index f9cdbdd42b..d47e4a39f1 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -40,7 +40,7 @@ tests: - GHC_VERSION: 9.8.2 RUN_TESTS: "always" - - GHC_VERSION: 9.6.4 + - GHC_VERSION: 9.6.6 RUN_TESTS: "always" - GHC_VERSION: [9.4.8, 9.2.8] @@ -56,12 +56,27 @@ tests: stack-build: extends: .common-local + image: fpco/stack-build:lts-22.33 needs: [] stage: test variables: - GHC_VERSION: 8.10.7 + CACHE_FALLBACK_KEY: $CI_JOB_NAME-master-$CI_JOB_IMAGE-$CACHE_BUST_TOKEN-3-non_protected + before_script: + - apt-get update + - apt-get install -y zstd + - export THREADS=$(./.ci/effective_cpus.sh) + - export + - tar -xf cache.tar.zst -C / || true + # Print stack.yaml for debugging + - cat stack.yaml script: - - .ci/stack_build.sh + # Note: the --pedantic switch adds -Wall -Werror to the options passed to + # GHC. Options specified in stack.yaml (like -Wcompat) are still passed; it + # is cumulative. Future versions of Stack might add behavior to --pedantic. + - stack build -j$THREADS --pedantic + after_script: + - export THREADS=$(./.ci/effective_cpus.sh) + - tar -cf - /root/.stack | zstd -T$THREADS -3 > cache.tar.zst nix-build: image: nixos/nix:2.10.1