Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve the FreeBSD CI #20

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 12 additions & 1 deletion .cirrus.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
26 changes: 21 additions & 5 deletions .cirrus/ci.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Loading