Skip to content

Add release CI #4

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

Draft
wants to merge 6 commits into
base: master
Choose a base branch
from
Draft
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
25 changes: 25 additions & 0 deletions .github/scripts/brew.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
#!/bin/sh

set -eux

if [ -e "$HOME/.brew" ] ; then
(
cd "$HOME/.brew"
git fetch --depth 1
git reset --hard origin/master
)
else
git clone --depth=1 https://github.com/Homebrew/brew "$HOME/.brew"
fi
export PATH="$HOME/.brew/bin:$HOME/.brew/sbin:$PATH"

mkdir -p "$GITHUB_WORKSPACE/.brew_cache"
export HOMEBREW_CACHE="$GITHUB_WORKSPACE/.brew_cache"
mkdir -p "$GITHUB_WORKSPACE/.brew_logs"
export HOMEBREW_LOGS="$GITHUB_WORKSPACE/.brew_logs"
mkdir -p /private/tmp/.brew_tmp
export HOMEBREW_TEMP=/private/tmp/.brew_tmp

#brew update
brew install ${1+"$@"}

63 changes: 63 additions & 0 deletions .github/scripts/build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
#!/bin/bash

set -eux

uname -a
uname -p
uname
pwd
env

if [ "${RUNNER_OS}" = Windows ] ; then
ext=".exe"
else
ext=""
fi

# build
ghcup --no-verbose install ghc --set --install-targets "install_bin install_lib update_package_db" "${GHC_VERSION}"
sed -i.bak -e '/DELETE MARKER FOR CI/,/END DELETE/d' cabal.project # see comment in cabal.project
cabal update
cabal user-config diff
cabal user-config init -f
"ghc-${GHC_VERSION}" --info
"ghc" --info

# https://github.com/haskell/cabal/issues/7313#issuecomment-811851884
if [ "$(getconf LONG_BIT)" == "32" ] || [ "${DISTRO}" == "CentOS" ] ; then
echo 'constraints: lukko -ofd-locking' >> cabal.release.project.local
fi

# shellcheck disable=SC2206
args=(
-w "ghc-$GHC_VERSION"
--disable-profiling
--enable-executable-stripping
--project-file=cabal.release.project
${ADD_CABAL_ARGS}
)

cabal v2-build "${args[@]}" cabal-install

mkdir -p "out"
# shellcheck disable=SC2154
cp "$(cabal list-bin "${args[@]}" cabal-install:exe:cabal)" "out/cabal$ext"
cp dist-newstyle/cache/plan.json "out/plan.json"
cd "out/"

# create tarball/zip
TARBALL_PREFIX="cabal-install-$("./cabal" --numeric-version)"
case "${TARBALL_EXT}" in
zip)
zip "${TARBALL_PREFIX}-${ARTIFACT}.${TARBALL_EXT}" "cabal${ext}" plan.json
;;
tar.xz)
tar caf "${TARBALL_PREFIX}-${ARTIFACT}.${TARBALL_EXT}" "cabal${ext}" plan.json
;;
*)
fail "Unknown TARBALL_EXT: ${TARBALL_EXT}"
;;
esac

rm "cabal${ext}" plan.json

34 changes: 34 additions & 0 deletions .github/scripts/test.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
#!/bin/bash

set -eux

env
pwd
ls -lah

cd out
case "${TARBALL_EXT}" in
zip)
unzip ./cabal-install-*-"${ARTIFACT}.${TARBALL_EXT}"
;;
tar.xz)
tar xf ./cabal-install-*-"${ARTIFACT}.${TARBALL_EXT}"
;;
*)
fail "Unknown TARBALL_EXT: ${TARBALL_EXT}"
;;
esac
cd ..

ghcup --no-verbose install ghc --set --install-targets "install_bin install_lib update_package_db" "${GHC_VERSION}"

cabal update

# TODO: we want to avoid building here... we should just
# be using the previously built 'cabal-tests' binary
cabal run ${ADD_CABAL_ARGS} cabal-testsuite:cabal-tests -- \
--with-cabal "$(pwd)/out/cabal" \
--intree-cabal-lib "$(pwd)" \
--test-tmp "$(pwd)/testdb" \
-j "$(nproc)"

Loading
Loading