-
Notifications
You must be signed in to change notification settings - Fork 697
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
12 changed files
with
774 additions
and
303 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
# release CI for FreeBSD | ||
compute_engine_instance: | ||
image_project: freebsd-org-cloud-dev | ||
image: family/freebsd-13-2 | ||
platform: freebsd | ||
disk: 100 # Gb | ||
|
||
build_task: | ||
timeout_in: 120m | ||
only_if: $CIRRUS_TAG != '' | ||
env: | ||
ADD_CABAL_ARGS: "--enable-split-sections" | ||
ARCH: 64 | ||
ARTIFACT: "x86_64-portbld-freebsd" | ||
CIRRUS_CLONE_SUBMODULES: true | ||
DISTRO: na | ||
GHC_VERSION: 9.2.4 | ||
GITHUB_WORKSPACE: ${CIRRUS_WORKING_DIR} | ||
RUNNER_OS: FreeBSD | ||
TARBALL_EXT: tar.xz | ||
TZ: Asia/Singapore | ||
install_script: | ||
- sed -i.bak -e 's/quarterly/latest/' /etc/pkg/FreeBSD.conf | ||
- pkg install -y ghc hs-cabal-install git bash misc/compat10x misc/compat11x misc/compat12x gmake llvm14 patchelf tree gmp libiconv | ||
script: | ||
- tzsetup Etc/GMT | ||
- adjkerntz -a | ||
- bash .github/scripts/build.sh | ||
binaries_artifacts: | ||
path: "out/*" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
#!/bin/sh | ||
|
||
set -eux | ||
|
||
. .github/scripts/env.sh | ||
|
||
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 $CI_PROJECT_DIR/.brew_cache | ||
export HOMEBREW_CACHE=$CI_PROJECT_DIR/.brew_cache | ||
mkdir -p $CI_PROJECT_DIR/.brew_logs | ||
export HOMEBREW_LOGS=$CI_PROJECT_DIR/.brew_logs | ||
mkdir -p /private/tmp/.brew_tmp | ||
export HOMEBREW_TEMP=/private/tmp/.brew_tmp | ||
|
||
#brew update | ||
brew install ${1+"$@"} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
#!/bin/bash | ||
|
||
set -eux | ||
|
||
. .github/scripts/env.sh | ||
. .github/scripts/common.sh | ||
|
||
uname -a | ||
uname -p | ||
uname | ||
pwd | ||
env | ||
|
||
# ensure ghcup | ||
install_ghcup | ||
|
||
# build | ||
ghcup install ghc "${GHC_VERSION}" | ||
ghcup set ghc "${GHC_VERSION}" | ||
sed -i.bak -e '/DELETE MARKER FOR CI/,/END DELETE/d' cabal.project # see comment in cabal.project | ||
ecabal update | ||
ecabal user-config diff | ||
ecabal 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.project.release.local | ||
fi | ||
|
||
args=( | ||
-w "ghc-$GHC_VERSION" | ||
--disable-profiling | ||
--enable-executable-stripping | ||
--project-file=cabal.project.release | ||
${ADD_CABAL_ARGS} | ||
) | ||
|
||
run cabal v2-build ${args[@]} cabal-install | ||
|
||
mkdir -p "$CI_PROJECT_DIR/out" | ||
cp "$(cabal list-bin ${args[@]} cabal-install:exe:cabal)" "$CI_PROJECT_DIR/out/cabal$ext" | ||
cp dist-newstyle/cache/plan.json "$CI_PROJECT_DIR/out/plan.json" | ||
cd "$CI_PROJECT_DIR/out/" | ||
|
||
# create tarball/zip | ||
TARBALL_PREFIX="cabal-install-$("$CI_PROJECT_DIR/out/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 plan.json | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,109 @@ | ||
#!/bin/bash | ||
|
||
. .github/scripts/env.sh | ||
|
||
# Colors | ||
RED="0;31" | ||
LT_BROWN="1;33" | ||
LT_BLUE="1;34" | ||
|
||
ecabal() { | ||
cabal "$@" | ||
} | ||
|
||
nonfatal() { | ||
"$@" || "$* failed" | ||
} | ||
|
||
sha_sum() { | ||
if [ "${RUNNER_OS}" = "FreeBSD" ] ; then | ||
sha256 "$@" | ||
else | ||
sha256sum "$@" | ||
fi | ||
} | ||
|
||
git_describe() { | ||
git config --global --get-all safe.directory | grep '^\*$' || git config --global --add safe.directory "*" | ||
git describe --always | ||
} | ||
|
||
install_ghcup() { | ||
# find "$GHCUP_INSTALL_BASE_PREFIX" | ||
mkdir -p "$GHCUP_BIN" | ||
mkdir -p "$GHCUP_BIN"/../cache | ||
|
||
if [ "${RUNNER_OS}" = "FreeBSD" ] ; then | ||
curl -o ghcup https://downloads.haskell.org/ghcup/tmp/x86_64-portbld-freebsd-ghcup-0.1.18.1 | ||
chmod +x ghcup | ||
mv ghcup "$HOME/.local/bin/ghcup" | ||
else | ||
curl --proto '=https' --tlsv1.2 -sSf https://get-ghcup.haskell.org | BOOTSTRAP_HASKELL_MINIMAL=1 sh | ||
source "$(dirname "${GHCUP_BIN}")/env" | ||
ghcup install cabal --set "${BOOTSTRAP_HASKELL_CABAL_VERSION}" | ||
fi | ||
} | ||
|
||
strip_binary() { | ||
( | ||
set -e | ||
local binary=$1 | ||
case "$(uname -s)" in | ||
"Darwin"|"darwin") | ||
;; | ||
MSYS_*|MINGW*) | ||
;; | ||
*) | ||
strip -s "${binary}" | ||
;; | ||
esac | ||
) | ||
} | ||
|
||
# GitLab Pipelines log section delimiters | ||
# https://gitlab.com/gitlab-org/gitlab-foss/issues/14664 | ||
start_section() { | ||
name="$1" | ||
echo -e "section_start:$(date +%s):$name\015\033[0K" | ||
} | ||
|
||
end_section() { | ||
name="$1" | ||
echo -e "section_end:$(date +%s):$name\015\033[0K" | ||
} | ||
|
||
echo_color() { | ||
local color="$1" | ||
local msg="$2" | ||
echo -e "\033[${color}m${msg}\033[0m" | ||
} | ||
|
||
error() { echo_color "${RED}" "$1"; } | ||
warn() { echo_color "${LT_BROWN}" "$1"; } | ||
info() { echo_color "${LT_BLUE}" "$1"; } | ||
|
||
fail() { error "error: $1"; exit 1; } | ||
|
||
run() { | ||
info "Running $*..." | ||
"$@" || ( error "$* failed"; return 1; ) | ||
} | ||
|
||
emake() { | ||
if command -v gmake >/dev/null 2>&1 ; then | ||
gmake "$@" | ||
else | ||
make "$@" | ||
fi | ||
} | ||
|
||
mktempdir() { | ||
case "$(uname -s)" in | ||
"Darwin"|"darwin") | ||
mktemp -d -t cabal_ci.XXXXXXX | ||
;; | ||
*) | ||
mktemp -d | ||
;; | ||
esac | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
#!/bin/bash | ||
|
||
mkdir -p "$HOME"/.local/bin | ||
|
||
if [ "${RUNNER_OS}" = "Windows" ] ; then | ||
ext=".exe" | ||
else | ||
ext='' | ||
fi | ||
|
||
export PATH="$HOME/.local/bin:$PATH" | ||
|
||
export BOOTSTRAP_HASKELL_NONINTERACTIVE=1 | ||
export BOOTSTRAP_HASKELL_CABAL_VERSION="${CABAL_VER:-3.8.1.0}" | ||
export BOOTSTRAP_HASKELL_ADJUST_CABAL_CONFIG=no | ||
export BOOTSTRAP_HASKELL_INSTALL_NO_STACK=yes | ||
export BOOTSTRAP_HASKELL_ADJUST_BASHRC=1 | ||
|
||
if [ "${RUNNER_OS}" = "Windows" ] ; then | ||
# on windows use pwd to get unix style path | ||
CI_PROJECT_DIR="$(pwd)" | ||
export CI_PROJECT_DIR | ||
export GHCUP_INSTALL_BASE_PREFIX="/c" | ||
export GHCUP_BIN="$GHCUP_INSTALL_BASE_PREFIX/ghcup/bin" | ||
export PATH="$GHCUP_BIN:$PATH" | ||
export CABAL_DIR="C:\\Users\\runneradmin\\AppData\\Roaming\\cabal" | ||
else | ||
export CI_PROJECT_DIR="${GITHUB_WORKSPACE}" | ||
export GHCUP_INSTALL_BASE_PREFIX="$CI_PROJECT_DIR" | ||
export GHCUP_BIN="$GHCUP_INSTALL_BASE_PREFIX/.ghcup/bin" | ||
export PATH="$GHCUP_BIN:$PATH" | ||
export CABAL_DIR="$CI_PROJECT_DIR/cabal" | ||
export CABAL_CACHE="$CI_PROJECT_DIR/cabal-cache" | ||
fi | ||
|
||
export DEBIAN_FRONTEND=noninteractive | ||
export TZ=Asia/Singapore |
Oops, something went wrong.