Skip to content

Commit

Permalink
Update CI config
Browse files Browse the repository at this point in the history
  • Loading branch information
DigitalBrains1 committed Sep 6, 2024
1 parent 2948b1e commit c0ee7d7
Show file tree
Hide file tree
Showing 4 changed files with 58 additions and 30 deletions.
32 changes: 22 additions & 10 deletions .ci/gitlab/branch.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ tests-always:
CLASH_BRANCH: "$CLASH_BRANCH"
parallel:
matrix:
- GHC_VERSION: 9.6.4
- GHC_VERSION: 9.8.2

- GHC_VERSION: 9.0.2
WORKAROUND_GHC_MMAP_CRASH: "yes"
Expand All @@ -36,16 +36,28 @@ tests-release:
CLASH_BRANCH: "$CLASH_BRANCH"
parallel:
matrix:
- GHC_VERSION: [9.8.2, 9.4.8, 9.2.8]
- GHC_VERSION: [9.6.6, 9.4.8, 9.2.8]

#stack-build:
# extends: .common-local
# needs: []
# stage: test
# variables:
# GHC_VERSION: 8.10.7
# script:
# - .ci/stack_build.sh
stack-build:
extends: .common-local
image: fpco/stack-build:lts-22.33
needs: []
stage: test
variables:
CACHE_FALLBACK_KEY: $CI_JOB_NAME-master-$CI_JOB_IMAGE-1-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:
- 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
14 changes: 10 additions & 4 deletions .ci/gitlab/common.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,20 +8,26 @@ 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: 1
# 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-clash-$CLASH_BRANCH-main-ghcr.io/clash-lang/clash-ci:$GHC_VERSION-20240721-1-non_protected
CACHE_FALLBACK_KEY: $CI_JOB_NAME-clash-$CLASH_BRANCH-main-ghcr.io/clash-lang/clash-ci:$GHC_VERSION-$CLASH_DOCKER_TAG-$CACHE_BUST_TOKEN-non_protected
TERM: xterm-color
cache:
key: $CI_JOB_NAME-clash-$CLASH_BRANCH-$CI_COMMIT_REF_SLUG-$CI_JOB_IMAGE-1
key: $CI_JOB_NAME-clash-$CLASH_BRANCH-$CI_COMMIT_REF_SLUG-$CI_JOB_IMAGE-$CACHE_BUST_TOKEN
when: always
paths:
- cache.tar.zst
before_script:
# Check GitLab still sets -o pipefail. If they ever disable it, we would no
# longer directly notice errors in pipes in these YAML files.
- false | true && { echo "-o pipefail no longer active"; false ; }

- export THREADS=$(./.ci/effective_cpus.sh)
- export CABAL_JOBS=$(./.ci/effective_cpus.sh)
- export CABAL_DIR=$HOME/.cabal
Expand All @@ -30,7 +36,7 @@ default:
- .ci/setup.sh
after_script:
- export THREADS=$(./.ci/effective_cpus.sh)
- tar -cf - $(ls -d /root/.cabal /root/.stack) | 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
23 changes: 7 additions & 16 deletions .ci/gitlab/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,13 @@ stages:
- export THREADS=$(./.ci/effective_cpus.sh)
- export CABAL_JOBS=$(./.ci/effective_cpus.sh)
- export CABAL_DIR=$HOME/.cabal
# - export clash_lib_datadir=$(pwd)/clash-lib/
- export
- tar -xf dist.tar.zst -C /

# Not all packages in the cache get packed into dist.tar.zst, so we need to
# regenerate the package database.
- |
if [ -z ${GHC_ABI} ]; then
if [ -z $GHC_ABI ]; then
ghc-pkg recache --package-db=$HOME/.cabal/store/ghc-$GHC_VERSION/package.db;
else
ghc-pkg recache --package-db=$HOME/.cabal/store/ghc-$GHC_VERSION-$GHC_ABI/package.db;
Expand All @@ -41,7 +40,6 @@ stages:
- export THREADS=$(./.ci/effective_cpus.sh)
- export CABAL_JOBS=$(./.ci/effective_cpus.sh)
- export CABAL_DIR=$HOME/.cabal
# - export clash_lib_datadir=$(pwd)/clash-lib/
- export
- tar -xf cache.tar.zst -C / || true
- tar -xf dist.tar.zst -C /
Expand All @@ -50,13 +48,13 @@ stages:
# Not all package in cache get packed into dist.tar.zst, so we need to
# regenerate the package database
- |
if [ -z ${GHC_ABI} ]; then
if [ -z $GHC_ABI ]; then
ghc-pkg recache --package-db=$HOME/.cabal/store/ghc-$GHC_VERSION/package.db;
else
ghc-pkg recache --package-db=$HOME/.cabal/store/ghc-$GHC_VERSION-$GHC_ABI/package.db;
fi
after_script:
- tar -cf - /root/.cabal/packages | zstd -T${THREADS} -3 > cache.tar.zst
- tar -cf - /root/.cabal/packages | zstd -T$THREADS -3 > cache.tar.zst

# 'build' publishes its build files as an artifact. These build files are reused
# by the tests below.
Expand All @@ -72,31 +70,24 @@ build:
- .ci/build.sh

# Archive all build files (from .cabal and dist-newstyle)
- declare BUILD_DIST=$(.ci/get_build_dist.sh)
- tar -cf - $BUILD_DIST | zstd -T${THREADS} -15 > dist.tar.zst
- .ci/get_build_dist.sh | tar -cf - --anchored --exclude=$GIT_ROOT/dist-newstyle/src -T - | zstd -T$THREADS -15 > dist.tar.zst

# Tests run on shared runners:

cores:doctests:
extends:
- .test-nocache
- .master-rules
extends: .test-nocache
script:
- bin/clash-cores:doctests -j$THREADS

cores:unittests:
extends:
- .test-nocache
- .master-rules
extends: .test-nocache
script:
- bin/clash-cores:unittests -j$THREADS --hide-successes

# Tests run on local fast machines:

suite:cores:
extends:
- .test-cache-local
- .master-rules
extends: .test-cache-local
script:
- source /opt/tools/Xilinx/Vivado/2022.1/settings64.sh
- bin/clash-cores-test-suite:clash-cores-test-suite -j$THREADS --hide-successes
Expand Down
19 changes: 19 additions & 0 deletions stack.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
resolver: nightly-2024-09-04

ghc-options:
"$locals": -Wall -Wcompat

packages:
- .
- test-suite

extra-deps:
- # clash-testsuite
git: https://github.com/clash-lang/clash-compiler.git
commit: '3f5dc67c0e526e43a4dd88eb3902e39ed512c166' # v1.8.1
subdirs:
- tests
- # TODO: Remove this workaround. See:
#
# https://github.com/clash-lang/clash-compiler/pull/2665#issuecomment-1939044550
Cabal-3.10.3.0

0 comments on commit c0ee7d7

Please sign in to comment.