Skip to content

Commit

Permalink
Try something naive
Browse files Browse the repository at this point in the history
  • Loading branch information
tchoutri committed Jul 30, 2024
1 parent 836f1cd commit 31c77fd
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 5 deletions.
12 changes: 11 additions & 1 deletion .cirrus.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,15 @@ task:
freebsd_instance:
image_family: freebsd-14-0
install_script: pkg install -y ghc hs-cabal-install git autoconf bash
setup_script:
- ./.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
23 changes: 19 additions & 4 deletions .cirrus/ci.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,22 +2,37 @@

set -xEeuo pipefail

build_freebsd() {
setup_freebsd() {
export GHCUP_INSTALL_BASE_PREFIX="/opt/ghc/"
mkdir -p ~/.local/ghcup/bin/
mkdir -p /opt/ghcup/bin/
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

0 comments on commit 31c77fd

Please sign in to comment.