-
-
Notifications
You must be signed in to change notification settings - Fork 367
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
19 changed files
with
1,059 additions
and
1,254 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,24 @@ | ||
freebsd_instance: | ||
image_family: freebsd-13-1 | ||
disk: 100 | ||
|
||
task: | ||
timeout_in: 120m | ||
env: | ||
AWS_ACCESS_KEY_ID: ENCRYPTED[ad041496e88a9588a0f53083f785b2c24ed86c2518cc9b2abfaae0864836a7a1f5795c27e27ea36b7e1ade2910d2a9d1] | ||
AWS_SECRET_ACCESS_KEY: ENCRYPTED[235c7b4f37059df072cfd59bface11c801195e1606c2bea7b1cc60f59bbd6b47a374a77e890e919cd3155db6dc395534] | ||
S3_HOST: ENCRYPTED[14d35aaef35056e40ce3a0d5c3f648ac0648588788f63c877b85ee602b937b9c08c3ecc56ef5bb0545fcc0a86ecbfff8] | ||
TARBALL_EXT: "tar.xz" | ||
ARCH: 64 | ||
ARTIFACT: "x86_64-freebsd" | ||
DISTRO: "na" | ||
RUNNER_OS: "FreeBSD" | ||
ADD_CABAL_ARGS: "--enable-split-sections" | ||
GITHUB_WORKSPACE: ${CIRRUS_WORKING_DIR} | ||
install_script: pkg install -y hs-cabal-install git bash misc/compat10x misc/compat11x misc/compat12x gmake patchelf | ||
script: | ||
- bash .github/scripts/build.sh | ||
- bash .github/scripts/test.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,86 @@ | ||
#!/bin/bash | ||
|
||
set -eux | ||
|
||
. .github/scripts/prereq.sh | ||
. .github/scripts/common.sh | ||
|
||
uname -a | ||
uname -p | ||
uname | ||
pwd | ||
env | ||
|
||
# ensure ghcup | ||
if ! command -v ghcup ; then | ||
install_ghcup | ||
fi | ||
|
||
# ensure cabal-cache | ||
if ! cabal-cache version ; then | ||
download_cabal_cache "$HOME/.local/bin/cabal-cache" | ||
fi | ||
|
||
|
||
# build | ||
ecabal update | ||
|
||
case "$(uname)" in | ||
MSYS_*|MINGW*) | ||
for ghc in $(cat bindist/ghcs-Msys) ; do | ||
GHC_VERSION="${ghc%,*}" | ||
args=( -O2 -w "ghc-$GHC_VERSION" --project-file cabal.project --disable-profiling --disable-tests --enable-executable-stripping ${ADD_CABAL_ARGS}) | ||
ghcup install ghc "${GHC_VERSION}" | ||
"ghc-${GHC_VERSION}" --info | ||
# Shorten binary names | ||
sed -i.bak -e 's/haskell-language-server/hls/g' \ | ||
-e 's/haskell_language_server/hls/g' \ | ||
haskell-language-server.cabal cabal.project | ||
sed -i.bak -e 's/Paths_haskell_language_server/Paths_hls/g' \ | ||
src/**/*.hs exe/*.hs | ||
|
||
|
||
# shellcheck disable=SC2068 | ||
build_with_cache ${args[@]} exe:hls exe:hls-wrapper | ||
|
||
mkdir -p "$CI_PROJECT_DIR/out" | ||
|
||
# shellcheck disable=SC2068 | ||
cp "$(cabal list-bin -v0 ${args[@]} exe:hls)" "$CI_PROJECT_DIR/out/haskell-language-server-${GHC_VERSION}"${ext} | ||
# shellcheck disable=SC2068 | ||
cp "$(cabal list-bin -v0 ${args[@]} exe:hls-wrapper)" "$CI_PROJECT_DIR/out/haskell-language-server-wrapper"${ext} | ||
ghcup rm ghc "${GHC_VERSION}" | ||
done | ||
;; | ||
*) | ||
sed -i.bak -e '/DELETE MARKER FOR CI/,/END DELETE/d' cabal.project # see comment in cabal.project | ||
emake --version | ||
emake GHCUP=ghcup CABAL_CACHE_BIN=cabal-cache S3_HOST="${S3_HOST}" S3_KEY="${ARTIFACT}" hls | ||
emake GHCUP=ghcup bindist | ||
rm -rf out/*.*.* | ||
;; | ||
esac | ||
|
||
cp dist-newstyle/cache/plan.json "$CI_PROJECT_DIR/out/plan.json" | ||
|
||
|
||
# create tarball/zip | ||
TARBALL_PREFIX="haskell-language-server" | ||
case "${TARBALL_EXT}" in | ||
zip) | ||
HLS_VERSION="$("$CI_PROJECT_DIR/out/haskell-language-server-8.10.7" --numeric-version)" | ||
cd "$CI_PROJECT_DIR/out/" | ||
zip "${TARBALL_PREFIX}-${HLS_VERSION}-${ARTIFACT}.zip" haskell-language-server-* | ||
find . -type f ! -name '*.zip' -delete | ||
;; | ||
tar.xz) | ||
emake --version | ||
HLS_VERSION="$(emake -s -C out/bindist/haskell-language-server-* version)" | ||
emake TARBALL="${TARBALL_PREFIX}-${HLS_VERSION}-${ARTIFACT}.tar.xz" bindist-tar | ||
rm -rf out/bindist | ||
;; | ||
*) | ||
fail "Unknown TARBALL_EXT: ${TARBALL_EXT}" | ||
;; | ||
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,233 @@ | ||
#!/bin/sh | ||
|
||
if [ "${RUNNER_OS}" = "Windows" ] ; then | ||
ext=".exe" | ||
else | ||
ext='' | ||
fi | ||
|
||
# Colors | ||
BLACK="0;30" | ||
GRAY="1;30" | ||
RED="0;31" | ||
LT_RED="1;31" | ||
BROWN="0;33" | ||
LT_BROWN="1;33" | ||
GREEN="0;32" | ||
LT_GREEN="1;32" | ||
BLUE="0;34" | ||
LT_BLUE="1;34" | ||
PURPLE="0;35" | ||
LT_PURPLE="1;35" | ||
CYAN="0;36" | ||
LT_CYAN="1;36" | ||
WHITE="1;37" | ||
LT_GRAY="0;37" | ||
|
||
ecabal() { | ||
cabal "$@" | ||
} | ||
|
||
sync_from() { | ||
if [ "${RUNNER_OS}" != "Windows" ] ; then | ||
cabal_store_path="$(dirname "$(cabal help user-config | tail -n 1 | xargs)")/store" | ||
fi | ||
|
||
cabal-cache sync-from-archive \ | ||
--host-name-override="${S3_HOST}" \ | ||
--host-port-override=443 \ | ||
--host-ssl-override=True \ | ||
--region us-west-2 \ | ||
$([ "${RUNNER_OS}" != "Windows" ] && echo --store-path="$cabal_store_path") \ | ||
--archive-uri "s3://haskell-language-server/${ARTIFACT}" | ||
} | ||
|
||
sync_to() { | ||
if [ "${RUNNER_OS}" != "Windows" ] ; then | ||
cabal_store_path="$(dirname "$(cabal help user-config | tail -n 1 | xargs)")/store" | ||
fi | ||
|
||
cabal-cache sync-to-archive \ | ||
--host-name-override="${S3_HOST}" \ | ||
--host-port-override=443 \ | ||
--host-ssl-override=True \ | ||
--region us-west-2 \ | ||
$([ "${RUNNER_OS}" != "Windows" ] && echo --store-path="$cabal_store_path") \ | ||
--archive-uri "s3://haskell-language-server/${ARTIFACT}" | ||
} | ||
|
||
raw_eghcup() { | ||
"$GHCUP_BIN/ghcup${ext}" -v -c "$@" | ||
} | ||
|
||
eghcup() { | ||
if [ "${OS}" = "Windows" ] ; then | ||
"$GHCUP_BIN/ghcup${ext}" -c -s "file:/$CI_PROJECT_DIR/data/metadata/ghcup-${JSON_VERSION}.yaml" "$@" | ||
else | ||
"$GHCUP_BIN/ghcup${ext}" -c -s "file://$CI_PROJECT_DIR/data/metadata/ghcup-${JSON_VERSION}.yaml" "$@" | ||
fi | ||
} | ||
|
||
sha_sum() { | ||
if [ "${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 | ||
} | ||
|
||
download_cabal_cache() { | ||
( | ||
set -e | ||
dest="$HOME/.local/bin/cabal-cache" | ||
url="" | ||
exe="" | ||
cd /tmp | ||
case "${RUNNER_OS}" in | ||
"Linux") | ||
case "${DISTRO}" in | ||
"Alpine") | ||
case "${ARCH}" in | ||
"32") url=https://downloads.haskell.org/~ghcup/unofficial-bindists/cabal-cache/1.0.5.1/i386-linux-alpine-cabal-cache-1.0.5.1 | ||
;; | ||
"64") url=https://downloads.haskell.org/~ghcup/unofficial-bindists/cabal-cache/1.0.5.1/x86_64-linux-alpine-static-cabal-cache-1.0.5.1 | ||
;; | ||
esac | ||
;; | ||
*) | ||
case "${ARCH}" in | ||
"64") url=https://downloads.haskell.org/~ghcup/unofficial-bindists/cabal-cache/1.0.5.1/x86_64-linux-alpine-static-cabal-cache-1.0.5.1 | ||
;; | ||
"ARM64") url=https://downloads.haskell.org/~ghcup/unofficial-bindists/cabal-cache/1.0.5.1/aarch64-linux-cabal-cache-1.0.5.1 | ||
;; | ||
"ARM") url=https://downloads.haskell.org/~ghcup/unofficial-bindists/cabal-cache/1.0.5.1/armv7-linux-cabal-cache-1.0.5.1 | ||
;; | ||
esac | ||
;; | ||
esac | ||
;; | ||
"FreeBSD") | ||
url=https://downloads.haskell.org/~ghcup/unofficial-bindists/cabal-cache/1.0.5.1/x86_64-freebsd-cabal-cache-1.0.5.1 | ||
;; | ||
"Windows") | ||
exe=".exe" | ||
url=https://downloads.haskell.org/~ghcup/unofficial-bindists/cabal-cache/1.0.5.1/x86_64-mingw64-cabal-cache-1.0.5.1.exe | ||
;; | ||
"macOS") | ||
case "${ARCH}" in | ||
"ARM64") url=https://downloads.haskell.org/~ghcup/unofficial-bindists/cabal-cache/1.0.5.1/aarch64-apple-darwin-cabal-cache-1.0.5.1 | ||
;; | ||
"64") url=https://downloads.haskell.org/~ghcup/unofficial-bindists/cabal-cache/1.0.5.1/x86_64-apple-darwin-cabal-cache-1.0.5.1 | ||
;; | ||
esac | ||
;; | ||
esac | ||
|
||
if [ -n "${url}" ] ; then | ||
case "${url##*.}" in | ||
"gz") | ||
curl -L -o - "${url}" | gunzip > cabal-cache${exe} | ||
;; | ||
*) | ||
curl -o cabal-cache${exe} -L "${url}" | ||
;; | ||
esac | ||
chmod +x cabal-cache${exe} | ||
cp "cabal-cache${exe}" "${dest}${exe}" | ||
fi | ||
) | ||
} | ||
|
||
build_with_cache() { | ||
ecabal configure "$@" | ||
ecabal build --dependencies-only "$@" --dry-run | ||
sync_from | ||
ecabal build --dependencies-only "$@" || sync_to | ||
sync_to | ||
ecabal build "$@" | ||
sync_to | ||
} | ||
|
||
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 | sh | ||
fi | ||
} | ||
|
||
strip_binary() { | ||
( | ||
set -e | ||
binary=$1 | ||
if [ "${RUNNER_OS}" = "macOS" ] ; then | ||
# don't strip on mac for now due to notarization | ||
# strip "${binary}" | ||
: | ||
else | ||
if [ "${RUNNER_OS}" != "Windows" ] ; then | ||
strip -s "${binary}" | ||
fi | ||
fi | ||
) | ||
} | ||
|
||
# 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 hls_ci.XXXXXXX | ||
;; | ||
*) | ||
mktemp -d | ||
;; | ||
esac | ||
} |
Oops, something went wrong.