diff --git a/.cirrus.yml b/.cirrus.yml index a9b5cad..0c0652d 100644 --- a/.cirrus.yml +++ b/.cirrus.yml @@ -3,5 +3,16 @@ task: freebsd_instance: image_family: freebsd-14-0 install_script: pkg install -y ghc hs-cabal-install git autoconf bash + setup_script: + - export PATH=$HOME/.local/ghcup/bin:/opt/ghcup/bin:$PATH + - ./.cirrus/ci.sh setup_freebsd + - ./.cirrus/ci.sh configure_freebsd + haskell_cache: + folder: ~/.cabal/store + fingerprint_script: + - export PLAN_HASH=$(sha256sum ./dist-newstyle/cache/plan.json | awk '{print $1}') + - echo "ghc-9.8.2-$PLAN_HASH" + script: - - ./.cirrus/ci.sh build_freebd + - ./.cirrus/ci.sh build_freebsd + - ./.cirrus/ci.sh test_freebsd diff --git a/.cirrus/ci.sh b/.cirrus/ci.sh index 18ba687..fee170f 100755 --- a/.cirrus/ci.sh +++ b/.cirrus/ci.sh @@ -2,22 +2,38 @@ set -xEeuo pipefail -build_freebsd() { +setup_freebsd() { export GHCUP_INSTALL_BASE_PREFIX="/opt/ghc/" - mkdir -p ~/.local/ghcup/bin/ + mkdir -p $HOME/.local/ghcup/bin/ + mkdir -p /opt/ghcup/bin/ + export PATH=$HOME/.local/ghcup/bin:/opt/ghcup/bin:$PATH curl -L https://downloads.haskell.org/~ghcup/x86_64-portbld-freebsd-ghcup --output /opt/ghcup/bin/ghcup chmod +x /opt/ghcup/bin/ghcup ghcup install ghc 9.8.2 ghcup set ghc 9.8.2 ghcup install cabal 3.12.1.0 + cabal update +} + +configure_freebsd() { + cabal freeze --project-file=cabal.release.project +} + +build_freebsd() { + cabal build --project-file=cabal.release.project all -j +} + +test_freebsd() { + cabal test --project-file=cabal.release.project all -j } help() { - echo "Run with \`build_freebsd\`" + echo "Run with setup_freebsd, configure_freebsd, build_freebsd or test_freebsd." } case ${1:-help} in help) help ;; - build_frebsd) build_freebsd ;; - + setup_freebsd) setup_freebsd ;; + build_freebsd) build_freebsd ;; + test_freebsd) test_freebsd ;; esac