-
Notifications
You must be signed in to change notification settings - Fork 42
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add a CI that demonstrates the installation procedure for the ICU library for use with stack. Squashed commits: * Add stack CI * Win: install pkg-config via stack * Temporarily switch off other CIs * Temporarily reduce stack CI to Windows * Also update keyring * Delete the -y option to pacman * Try pkgconf * Clean up stack.yml * Try latest ICU * stack CI: activate ubuntu and macOS * stack CI: demonstrate ICU_VERSION variable setting * Revert "Temporarily switch off other CIs"
- Loading branch information
1 parent
8b79bd5
commit e76746a
Showing
1 changed file
with
100 additions
and
0 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,100 @@ | ||
# This workflow uses 'stack' as installed on the github runner. | ||
# GHC is installed via stack. | ||
|
||
name: Stack build | ||
|
||
on: | ||
push: | ||
branches: | ||
- master | ||
pull_request: | ||
branches: | ||
- master | ||
|
||
defaults: | ||
run: | ||
shell: bash | ||
|
||
jobs: | ||
stack: | ||
name: ${{ matrix.os }} Stack ${{ matrix.plan.resolver }} / ${{ matrix.plan.ghc }} | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
os: [macOS-latest,ubuntu-latest,windows-latest] | ||
plan: | ||
- resolver: 'nightly' | ||
- resolver: 'lts' | ||
|
||
runs-on: ${{ matrix.os }} | ||
env: | ||
STACK: stack --no-terminal --resolver ${{ matrix.plan.resolver }} | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- name: Configure | ||
run: | | ||
$STACK init | ||
- name: Install GHC via stack | ||
run: | | ||
$STACK ghc -- --version | ||
- name: Haskell versions | ||
run: | | ||
STACK_VERSION=$(${STACK} --numeric-version) | ||
echo "STACK_VERSION=${STACK_VERSION}" >> "${GITHUB_ENV}" | ||
GHC_VERSION=$(${STACK} ghc -- --numeric-version) | ||
echo "GHC_VERSION=${GHC_VERSION}" >> "${GITHUB_ENV}" | ||
## This causes troubles on Windows (spaces in env variable)? | ||
# STACK_ROOT=$(${STACK} path --stack-root) | ||
# echo "STACK_ROOT=${STACK_ROOT}" >> "${GITHUB_ENV}" | ||
|
||
- name: Set up for the ICU library (macOS) | ||
if: ${{ runner.os == 'macOS' }} | ||
run: | | ||
ICU4C=$(brew --prefix)/opt/icu4c | ||
echo "PKG_CONFIG_PATH=${ICU4C}/lib/pkgconfig" >> "${GITHUB_ENV}" | ||
- name: Install the ICU library (Windows) | ||
# We also install pkgconf, which superseds pkg-config. | ||
if: ${{ runner.os == 'Windows' }} | ||
run: | | ||
$STACK exec -- pacman --noconfirm -S msys2-keyring | ||
$STACK exec -- pacman --noconfirm -S mingw-w64-x86_64-pkgconf | ||
$STACK exec -- pacman --noconfirm -S mingw-w64-x86_64-icu | ||
## Alternatively, in the last line, install a specific version of ICU, like 71: | ||
# $STACK exec -- bash -c "curl -LO ${ICU_URL} && pacman --noconfirm -U *.pkg.tar.zst" | ||
# env: | ||
# ICU_URL: "https://repo.msys2.org/mingw/mingw64/mingw-w64-x86_64-icu-71.1-1-any.pkg.tar.zst" | ||
|
||
- name: Determine the ICU version | ||
run: | | ||
ICU_VERSION=$($STACK exec -- pkg-config --modversion icu-i18n) | ||
echo "ICU version ${ICU_VERSION}" | ||
echo "ICU_VERSION=${ICU_VERSION}" >> "${GITHUB_ENV}" | ||
## Caching ~/.stack without --system-ghc is probably not a good idea: | ||
## - too fat | ||
## - should be sensibly restored before installing GHC via stack, | ||
## but then we don't know the GHC version; so at least 'lts' and 'nightly' would be brittle | ||
## | ||
# - uses: actions/cache@v3 | ||
# with: | ||
# path: ${{ env.STACK_ROOT }} | ||
# key: ${{ runner.os }}-stack-${{ env.STACK_VERSION }}-ghc-${{ env.GHC_VERSION }}-icu-${{ env.ICU_VER }}-resolver-${{ matrix.plan.resolver }}-sha-${{ github.sha }} | ||
# restore-keys: ${{ runner.os }}-stack-${{ env.STACK_VERSION }}-ghc-${{ env.GHC_VERSION }}-icu-${{ env.ICU_VER }}-resolver-${{ matrix.plan.resolver }}- | ||
|
||
- name: Install dependencies | ||
run: | | ||
$STACK test --only-dependencies | ||
- name: Build | ||
run: | | ||
$STACK build --haddock --no-haddock-deps | ||
- name: Test | ||
run: | | ||
$STACK -j 1 test --haddock --no-haddock-deps |