Integration tests #24
Workflow file for this run
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
name: Integration tests | |
on: | |
push: | |
tags: | |
- '**' | |
workflow_dispatch: | |
# As of 1 February 2024, ubuntu-latest, windows-latest and macos-latest come | |
# with Stack 2.13.1 and GHC 9.8.1. windows-latest comes with NSIS 3.08, for | |
# which the default value of the 'Unicode' installer attribute is 'true'. | |
# However, that is not the 'large strings' build of NSIS and creates installers | |
# that corrupt the PATH environment variable if the default string length of | |
# 1024 characters is exceeded. | |
jobs: | |
integration-tests: | |
name: Integration tests | |
runs-on: ${{ matrix.os }} | |
strategy: | |
fail-fast: false | |
matrix: | |
include: | |
- os: ubuntu-latest | |
release-args: "--alpine" | |
cache-bust: "2024-01-20" | |
- os: windows-latest | |
release-args: "" | |
cache-bust: "2024-01-20" | |
- os: macos-13 | |
release-args: "" | |
cache-bust: "2024-01-20" | |
# macos-14 provides macOS/AArch64 (M1) | |
- os: macos-latest | |
release-args: "" | |
cache-bust: "2024-02-02" | |
steps: | |
- name: Clone project | |
uses: actions/checkout@v4 | |
- name: Cache dependencies on Unix-like OS | |
if: startsWith(runner.os, 'Linux') || startsWith(runner.os, 'macOS') | |
uses: actions/cache@v4 | |
with: | |
path: ~/.stack | |
key: ${{ runner.os }}-${{ runner.arch }}-${{ hashFiles('stack.yaml') }}-${{ matrix.cache-bust }} | |
- name: Cache dependencies on Windows | |
if: startsWith(runner.os, 'Windows') | |
uses: actions/cache@v4 | |
with: | |
path: | | |
~\AppData\Roaming\stack | |
~\AppData\Local\Programs\stack | |
key: ${{ runner.os }}-${{ runner.arch }}-${{ hashFiles('stack.yaml') }}-${{ matrix.cache-bust }} | |
- name: Install deps and run checks | |
shell: bash | |
run: | | |
set -ex | |
if [[ "${{ matrix.os }}" == "macos-13" || "${{ matrix.os }}" == "macos-latest" ]] | |
then | |
# macos-13 and macos-latest do not include Haskell tools as at 2024-05-06. | |
curl -sSL https://get.haskellstack.org/ | sh | |
fi | |
if [[ "${{ matrix.os }}" == "ubuntu-latest" ]] | |
then | |
# Set up Nix for Stack's tests that require it. | |
# | |
# Install Nix via the single-user installation... | |
# | |
# Retry installing Nix due to nondeterministic error: | |
# Fatal error: glibc detected an invalid stdio handle | |
# See: | |
# https://github.com/nh2/static-haskell-nix/pull/27#issuecomment-502652181 | |
# https://github.com/NixOS/nix/issues/2733 | |
(for i in {1..5}; do bash <(curl -sSL https://nixos.org/nix/install) --no-daemon && exit 0; done; exit 1) | |
# Enter the Nix environment... | |
. ~/.nix-profile/etc/profile.d/nix.sh | |
# Add a channel named 'nixpkgs' to the list of subscribed channels... | |
nix-channel --add https://nixos.org/channels/nixos-23.05 nixpkgs | |
# Download the Nix expressions for all subscribed channels... | |
# | |
# As at 2023-08-21, nixos-23.05 provides GHC 9.2.8. | |
nix-channel --update | |
# The NIX_PATH environment variable sets a list of directories used to | |
# look up the location of Nix expressions using paths enclosed in | |
# angle brackets (e.g. <nixpkgs>). nix.sh no longer sets the NIX_PATH. | |
# If NIX_PATH is not set, Nix will fall back to | |
# $HOME/.nix-defexpr/channels, but only in impure and unrestricted | |
# evaluation mode. See https://github.com/NixOS/nixpkgs/issues/149791. | |
# Set NIX_PATH... | |
export NIX_PATH=${NIX_PATH:+$NIX_PATH:}$HOME/.nix-defexpr/channels | |
fi | |
if [[ "${{ matrix.release-args }}" == "--alpine" ]] | |
then | |
mkdir -p ~/.stack | |
touch ~/.stack/config.yaml | |
cat > ~/.stack/config.yaml <<EOF | |
extra-include-dirs: | |
- /usr/include | |
extra-lib-dirs: | |
- /lib | |
- /usr/lib | |
EOF | |
fi | |
# Updates NSIS 3.08 to a 'large strings' build of the same tool. See | |
# https://nsis.sourceforge.io/Special_Builds. | |
if [[ "${{ matrix.os }}" == "windows-latest" ]] | |
then | |
# wget is not available but the Stack-supplied MSYS2 will provide it | |
stack exec -- wget -O nsis-3.08-strlen_8192.zip https://downloads.sourceforge.net/nsis/NSIS%203/3.08/nsis-3.08-strlen_8192.zip | |
7z x -aoa -o"/c/Program Files (x86)/NSIS" nsis-3.08-strlen_8192.zip | |
# Clean up | |
rm nsis-3.08-strlen_8192.zip | |
makensis -VERSION && echo | |
# Should include defined symbol NSIS_MAX_STRLEN=8192 | |
makensis -HDRINFO | |
fi | |
# In case GHCup hooks have been created, remove them | |
if [ -d $(stack path --stack-root)/hooks ] | |
then | |
rm -Rf $(stack path --stack-root)/hooks | |
fi | |
# Report the file system disk space usage before checks, for | |
# information. | |
df -h | |
# Do this in the same step as installing deps to get relevant env var modifications | |
stack etc/scripts/release.hs check ${{ matrix.release-args }} | |
# Report the file system disk space usage after checks, for information. | |
df -h | |
set +ex | |
- name: Build bindist | |
shell: bash | |
run: | | |
stack etc/scripts/release.hs build ${{ matrix.release-args }} | |
- name: Upload bindist | |
uses: actions/upload-artifact@v4 | |
with: | |
name: ${{ runner.os }}-${{ runner.arch }} | |
path: _release/stack-* | |
linux-arm64: | |
name: Linux ARM64 | |
runs-on: [self-hosted, Linux, ARM64, maerwald] | |
steps: | |
- name: git config | |
run: | | |
git config --global --get-all safe.directory | grep '^\*$' || git config --global --add safe.directory "*" | |
shell: bash | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
with: | |
submodules: 'true' | |
- name: Run build (aarch64 linux) | |
run: | | |
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 STACK_ROOT="${GITHUB_WORKSPACE}"/.stack | |
curl --proto '=https' --tlsv1.2 -sSf https://get-ghcup.haskell.org | BOOTSTRAP_HASKELL_NONINTERACTIVE=1 BOOTSTRAP_HASKELL_ADJUST_CABAL_CONFIG=yes sh | |
ghcup run --install --stack=recommended -- stack --allow-different-user etc/scripts/release.hs build --allow-dirty --alpine --stack-args --docker-stack-exe=image | |
- name: Upload bindist | |
uses: actions/upload-artifact@v4 | |
with: | |
name: Linux-ARM64 | |
path: _release/stack-* | |
freebsd-x64: | |
name: FreeBSD X64 | |
runs-on: [self-hosted, FreeBSD, X64] | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
with: | |
submodules: 'true' | |
- name: Run build | |
run: | | |
sed -i.bak -e 's/quarterly/latest/' /etc/pkg/FreeBSD.conf | |
pkg install -y ghc gcc curl git bash misc/compat10x misc/compat11x misc/compat12x gmake libiconv devel/stack | |
tzsetup Etc/GMT | |
adjkerntz -a | |
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 STACK_ROOT="${GITHUB_WORKSPACE}"/.stack | |
curl --proto '=https' --tlsv1.2 -sSf https://get-ghcup.haskell.org | BOOTSTRAP_HASKELL_NONINTERACTIVE=1 BOOTSTRAP_HASKELL_ADJUST_CABAL_CONFIG=yes sh | |
stack etc/scripts/release.hs build --allow-dirty | |
- name: Upload bindist | |
uses: actions/upload-artifact@v4 | |
with: | |
name: FreeBSD-X64 | |
path: _release/stack-* | |
github-release: | |
name: Create GitHub release | |
permissions: | |
contents: write | |
needs: | |
- integration-tests | |
- linux-arm64 | |
runs-on: ubuntu-latest | |
if: startsWith(github.ref, 'refs/tags/') | |
steps: | |
- name: Download Linux/x86_64 artifact | |
uses: actions/download-artifact@v4 | |
with: | |
name: Linux-X64 | |
path: _release | |
- name: Download macOS/x86_64 artifact | |
uses: actions/download-artifact@v4 | |
with: | |
name: macOS-X64 | |
path: _release | |
- name: Download macOS/AArch64 artifact | |
uses: actions/download-artifact@v4 | |
with: | |
name: macOS-ARM64 | |
path: _release | |
- name: Download Windows/x86_64 artifact | |
uses: actions/download-artifact@v4 | |
with: | |
name: Windows-X64 | |
path: _release | |
- name: Download Linux/AArch64 artifact | |
uses: actions/download-artifact@v4 | |
with: | |
name: Linux-ARM64 | |
path: _release | |
- name: Download FreeBSD/X64 artifact | |
uses: actions/download-artifact@v4 | |
with: | |
name: FreeBSD-X64 | |
path: _release | |
- name: Hash and sign assets | |
shell: bash | |
run: | | |
set -e | |
cd _release | |
for asset in *; do | |
shasum -a 256 "$asset" >"$asset.sha256" | |
done | |
- name: Create GitHub release (final) | |
id: github_release_final | |
uses: ncipollo/[email protected] | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
body: | | |
See https://haskellstack.org/ for installation and upgrade instructions. | |
**Changes since v[INSERT PREVIOUS VERSION]:** | |
[INSERT CHANGELOG] | |
**Thanks to all our contributors for this release:** | |
[INSERT CONTRIBUTORS] | |
draft: true | |
prerelease: false | |
- name: Upload assets to GitHub release (final) | |
if: "!startsWith(github.ref, 'refs/tags/rc/')" | |
uses: xresloader/upload-to-github-release@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
file: "_release/*" | |
draft: true | |
prerelease: false | |
overwrite: true | |
release_id: ${{ steps.github_release_final.outputs.id }} |