Skip to content

Commit

Permalink
GitLab CI: Use Stackage Docker image (#2805)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
DigitalBrains1 authored Dec 5, 2024
1 parent 47b8fa7 commit 8a827e1
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 21 deletions.
2 changes: 1 addition & 1 deletion .ci/docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
4 changes: 2 additions & 2 deletions .ci/docker/build-and-publish-docker-image.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
10 changes: 6 additions & 4 deletions .ci/gitlab/common.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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:
#
Expand Down
11 changes: 0 additions & 11 deletions .ci/stack_build.sh

This file was deleted.

21 changes: 18 additions & 3 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand All @@ -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
Expand Down

0 comments on commit 8a827e1

Please sign in to comment.