Skip to content

Commit 9fe56f1

Browse files
hasufellwz1000
andauthored
Migrate release CI to github (#3406)
* Migrate to github CI * Parallelize GHC builds * Avoid building local packages twice * Prepare for building 9.2.6 * Fix build on darwin M1 9.0.2 * Drop build of windows 9.2.6 due to https://gitlab.haskell.org/ghc/ghc/-/issues/22961 * Drop 9.0.2 for darwin M1 * Fix build on windows by disabling ghc-check pkg ABI check * Use git-archive to create src tarball in upload * Build releases for 9.2.7 * Build src archive in github action * Build on unknown-linux too * Try to build GHC-9.4.4 for unknown linux on Fedora33 * Make sure hls-wrapper binary comes from GHC-8.10.7 --------- Co-authored-by: wz1000 <zubin.duggal@gmail.com>
1 parent 191bda6 commit 9fe56f1

20 files changed

+1729
-915
lines changed

.cirrus.yml

+109
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,109 @@
1+
# release CI for FreeBSD
2+
compute_engine_instance:
3+
image_project: freebsd-org-cloud-dev
4+
image: family/freebsd-13-1
5+
platform: freebsd
6+
disk: 100 # Gb
7+
8+
build_task:
9+
timeout_in: 120m
10+
only_if: $CIRRUS_TAG != ''
11+
env:
12+
AWS_ACCESS_KEY_ID: ENCRYPTED[dc5896620ebc12e98e6bbe96f72c5a2fe3785f439b7b2346797355f8d329a4bfd8ef6e58086bfc014be0d914424101cd]
13+
AWS_SECRET_ACCESS_KEY: ENCRYPTED[6501cd594aca08c6c67cc679dd6f6d30db0cd44a81cceddebf32bb3d0a37f9af19cd71ddb7169d3f7b284a7829969f9e]
14+
S3_HOST: ENCRYPTED[d3fef1b5850e85d80dd1684370b53183df2218f2d36509108a2703371afd9ebd3f9596ad4de52487c15ea29baed606b7]
15+
TARBALL_EXT: "tar.xz"
16+
ARCH: 64
17+
ARTIFACT: "x86_64-freebsd"
18+
DISTRO: "na"
19+
RUNNER_OS: "FreeBSD"
20+
ADD_CABAL_ARGS: "--enable-split-sections"
21+
GITHUB_WORKSPACE: ${CIRRUS_WORKING_DIR}
22+
CABAL_CACHE_NONFATAL: "yes"
23+
matrix:
24+
- name: build-ghc-8.10.7
25+
env:
26+
GHC_VERSION: 8.10.7
27+
- name: build-ghc-9.0.2
28+
env:
29+
GHC_VERSION: 9.0.2
30+
- name: build-ghc-9.2.5
31+
env:
32+
GHC_VERSION: 9.2.5
33+
- name: build-ghc-9.2.7
34+
env:
35+
GHC_VERSION: 9.2.7
36+
install_script: pkg install -y hs-cabal-install git bash misc/compat10x misc/compat11x misc/compat12x gmake patchelf tree
37+
script:
38+
- tzsetup Etc/GMT
39+
- adjkerntz -a
40+
- bash .github/scripts/build.sh
41+
- tar caf out.tar.xz out/ store/
42+
binaries_artifacts:
43+
path: "out.tar.xz"
44+
45+
46+
bindist_task:
47+
name: bindist
48+
depends_on:
49+
- build-ghc-8.10.7
50+
- build-ghc-9.0.2
51+
- build-ghc-9.2.5
52+
- build-ghc-9.2.7
53+
timeout_in: 120m
54+
only_if: $CIRRUS_TAG != ''
55+
env:
56+
TARBALL_EXT: "tar.xz"
57+
ARCH: 64
58+
ARTIFACT: "x86_64-freebsd"
59+
DISTRO: "na"
60+
RUNNER_OS: "FreeBSD"
61+
GITHUB_WORKSPACE: ${CIRRUS_WORKING_DIR}
62+
install_script: pkg install -y hs-cabal-install git bash misc/compat10x misc/compat11x misc/compat12x gmake patchelf tree unzip
63+
script:
64+
- tzsetup Etc/GMT
65+
- adjkerntz -a
66+
67+
- curl -o binaries-8.10.7.tar.xz -L https://api.cirrus-ci.com/v1/artifact/build/${CIRRUS_BUILD_ID}/build-ghc-8.10.7/binaries/out.tar.xz
68+
- tar xvf binaries-8.10.7.tar.xz
69+
- rm -f binaries-8.10.7.tar.xz
70+
71+
- curl -o binaries-9.0.2.tar.xz -L https://api.cirrus-ci.com/v1/artifact/build/${CIRRUS_BUILD_ID}/build-ghc-9.0.2/binaries/out.tar.xz
72+
- tar xvf binaries-9.0.2.tar.xz
73+
- rm -f binaries-9.0.2.tar.xz
74+
75+
- curl -o binaries-9.2.5.tar.xz -L https://api.cirrus-ci.com/v1/artifact/build/${CIRRUS_BUILD_ID}/build-ghc-9.2.5/binaries/out.tar.xz
76+
- tar xvf binaries-9.2.5.tar.xz
77+
- rm -f binaries-9.2.5.tar.xz
78+
79+
- curl -o binaries-9.2.7.tar.xz -L https://api.cirrus-ci.com/v1/artifact/build/${CIRRUS_BUILD_ID}/build-ghc-9.2.7/binaries/out.tar.xz
80+
- tar xvf binaries-9.2.7.tar.xz
81+
- rm -f binaries-9.2.7.tar.xz
82+
83+
- bash .github/scripts/bindist.sh
84+
bindist_artifacts:
85+
path: "./out/*.tar.xz"
86+
87+
test_task:
88+
name: test
89+
depends_on:
90+
- bindist
91+
timeout_in: 120m
92+
only_if: $CIRRUS_TAG != ''
93+
env:
94+
TARBALL_EXT: "tar.xz"
95+
ARCH: 64
96+
ARTIFACT: "x86_64-freebsd"
97+
DISTRO: "na"
98+
RUNNER_OS: "FreeBSD"
99+
GITHUB_WORKSPACE: ${CIRRUS_WORKING_DIR}
100+
install_script: pkg install -y hs-cabal-install git bash misc/compat10x misc/compat11x misc/compat12x gmake patchelf tree unzip
101+
script:
102+
- tzsetup Etc/GMT
103+
- adjkerntz -a
104+
105+
- curl -O -L https://api.cirrus-ci.com/v1/artifact/build/${CIRRUS_BUILD_ID}/bindist/bindist.zip
106+
- unzip bindist.zip
107+
108+
- bash .github/scripts/test.sh
109+

.github/scripts/bindist.sh

+34
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
#!/bin/bash
2+
3+
set -eux
4+
5+
. .github/scripts/env.sh
6+
. .github/scripts/common.sh
7+
8+
# ensure ghcup
9+
if ! command -v ghcup ; then
10+
install_ghcup
11+
fi
12+
13+
# create tarball/zip
14+
case "${TARBALL_EXT}" in
15+
zip)
16+
HLS_VERSION="$(grep '^version:' haskell-language-server.cabal | awk '{ print $2 }')"
17+
(
18+
cd "$CI_PROJECT_DIR/out/${ARTIFACT}"
19+
zip "$CI_PROJECT_DIR/out/haskell-language-server-${HLS_VERSION}-${ARTIFACT}.zip" haskell-language-server-*
20+
)
21+
;;
22+
tar.xz)
23+
# we need to control the order, so the hls wrapper binary is installed
24+
# from the oldest version in the list
25+
: "${GHCS:="$(cd "$CI_PROJECT_DIR/out/${ARTIFACT}" && rm -f ./*.json && for ghc in * ; do printf "%s\n" "$ghc" ; done | sort -r | tr '\n' ' ')"}"
26+
emake --version
27+
emake GHCUP=ghcup ARTIFACT="${ARTIFACT}" GHCS="${GHCS}" bindist
28+
emake GHCUP=ghcup ARTIFACT="${ARTIFACT}" bindist-tar
29+
emake GHCUP=ghcup GHCS="${GHCS}" clean-ghcs
30+
;;
31+
*)
32+
fail "Unknown TARBALL_EXT: ${TARBALL_EXT}"
33+
;;
34+
esac

.github/scripts/brew.sh

+27
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
#!/bin/sh
2+
3+
set -eux
4+
5+
. .github/scripts/env.sh
6+
7+
if [ -e "$HOME/.brew" ] ; then
8+
(
9+
cd "$HOME/.brew"
10+
git fetch --depth 1
11+
git reset --hard origin/master
12+
)
13+
else
14+
git clone --depth=1 https://github.com/Homebrew/brew "$HOME/.brew"
15+
fi
16+
export PATH="$HOME/.brew/bin:$HOME/.brew/sbin:$PATH"
17+
18+
mkdir -p $CI_PROJECT_DIR/.brew_cache
19+
export HOMEBREW_CACHE=$CI_PROJECT_DIR/.brew_cache
20+
mkdir -p $CI_PROJECT_DIR/.brew_logs
21+
export HOMEBREW_LOGS=$CI_PROJECT_DIR/.brew_logs
22+
mkdir -p /private/tmp/.brew_tmp
23+
export HOMEBREW_TEMP=/private/tmp/.brew_tmp
24+
25+
#brew update
26+
brew install ${1+"$@"}
27+

.github/scripts/build.sh

+61
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
#!/bin/bash
2+
3+
set -eux
4+
5+
. .github/scripts/env.sh
6+
. .github/scripts/common.sh
7+
8+
uname -a
9+
uname -p
10+
uname
11+
pwd
12+
env
13+
14+
# ensure ghcup
15+
if ! command -v ghcup ; then
16+
install_ghcup
17+
fi
18+
19+
# ensure cabal-cache
20+
download_cabal_cache "$HOME/.local/bin/cabal-cache"
21+
22+
23+
# build
24+
ecabal update
25+
ghcup install ghc "${GHC_VERSION}"
26+
ghcup set ghc "${GHC_VERSION}"
27+
"ghc-${GHC_VERSION}" --info
28+
"ghc" --info
29+
30+
mkdir -p "$CI_PROJECT_DIR/out/${ARTIFACT}"
31+
mkdir -p "$CI_PROJECT_DIR/out/plan.json"
32+
33+
case "$(uname)" in
34+
MSYS_*|MINGW*)
35+
args=( -O2 -w "ghc-$GHC_VERSION" --project-file cabal.project --disable-profiling --disable-tests --enable-executable-stripping ${ADD_CABAL_ARGS})
36+
37+
# Shorten binary names
38+
# due to MAX_PATH issues on windows
39+
sed -i.bak -e 's/haskell-language-server/hls/g' \
40+
-e 's/haskell_language_server/hls/g' \
41+
haskell-language-server.cabal cabal.project
42+
sed -i.bak -e 's/Paths_haskell_language_server/Paths_hls/g' \
43+
src/**/*.hs exe/*.hs
44+
45+
# shellcheck disable=SC2068
46+
build_with_cache ${args[@]} exe:hls exe:hls-wrapper
47+
cp dist-newstyle/cache/plan.json "$CI_PROJECT_DIR/out/plan.json/${ARTIFACT}-ghc-${GHC_VERSION}-plan.json"
48+
49+
# shellcheck disable=SC2068
50+
cp "$(cabal list-bin -v0 ${args[@]} exe:hls)" "$CI_PROJECT_DIR/out/${ARTIFACT}/haskell-language-server-${GHC_VERSION}${ext}"
51+
# shellcheck disable=SC2068
52+
cp "$(cabal list-bin -v0 ${args[@]} exe:hls-wrapper)" "$CI_PROJECT_DIR/out/${ARTIFACT}/haskell-language-server-wrapper${ext}"
53+
;;
54+
*)
55+
sed -i.bak -e '/DELETE MARKER FOR CI/,/END DELETE/d' cabal.project # see comment in cabal.project
56+
emake --version
57+
emake GHCUP=ghcup CABAL_CACHE_BIN=cabal-cache.sh S3_HOST="${S3_HOST}" S3_KEY="${ARTIFACT}" GHC_VERSION="${GHC_VERSION}" hls-ghc
58+
;;
59+
esac
60+
61+

.github/scripts/cabal-cache.sh

+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
#!/usr/bin/env bash
2+
3+
case "$(uname -s)" in
4+
MSYS_*|MINGW*)
5+
ext=".exe"
6+
;;
7+
*)
8+
ext=""
9+
;;
10+
esac
11+
12+
if [ "${CABAL_CACHE_DISABLE}" = "yes" ] ; then
13+
echo "cabal-cache disabled (CABAL_CACHE_DISABLE set)"
14+
elif [ "${CABAL_CACHE_NONFATAL}" = "yes" ] ; then
15+
time "cabal-cache${ext}" "$@" || echo "cabal-cache failed (CABAL_CACHE_NONFATAL set)"
16+
else
17+
time "cabal-cache${ext}" "$@"
18+
exit $?
19+
fi
20+

0 commit comments

Comments
 (0)