Skip to content

Merge pull request #127 from ludat/enable-macos #263

Merge pull request #127 from ludat/enable-macos

Merge pull request #127 from ludat/enable-macos #263

Workflow file for this run

name: macOS
# Trigger the workflow on push or pull request, but only for the master branch
on:
push:
branches:
- master
workflow_dispatch:
schedule:
- cron: '0 8 * * 3'
jobs:
stack:
name: ${{ matrix.os }} / ${{ matrix.snapshot }}
runs-on: ${{ matrix.os }}-latest
continue-on-error: ${{ matrix.snapshot == 'nightly' }}
strategy:
fail-fast: false
matrix:
os:
# - ubuntu
- macOS
# - windows
snapshot:
- 'lts-20.26'
- 'lts-21.25'
- 'lts-22.18'
- 'nightly'
steps:
- uses: actions/checkout@main
- uses: haskell-actions/setup@main
name: Setup Haskell Stack
id: setuphaskell
with:
enable-stack: true
stack-no-global: true
# There is some kind of linking problem when actually sharing cache files
# between builds so we disable cache (that's the reason why we don't build
# this along linux and windows, the builds is just too slow, and linux
# covers most of the cases for a unix-y OS)
- uses: actions/cache/restore@v4
name: Cache stack files
with:
path: ${{ steps.setuphaskell.outputs.stack-root }}
key: ${{ runner.os }}-${{ matrix.snapshot }}-stack2
- name: Setup stack.yaml
shell: bash
run: |
set -x
mv -vf "stack-ci.yaml" ./stack.yaml || true
mv -vf "stack-${{ matrix.snapshot }}.yaml" ./stack.yaml || true
mv -vf "stack-${{ matrix.snapshot }}-${{ matrix.os }}.yaml" ./stack.yaml || true
- name: Build and test
shell: bash
run: |
set -x
grep . stack.yaml
if grep SKIP stack.yaml; then
echo Skipped because that snapshot is broken
exit 0
fi
stack setup --resolver=${{ matrix.snapshot }}
echo "stack_root: ${{ steps.setuphaskell.outputs.stack-root }}"
stack --version
stack --resolver=${{ matrix.snapshot }} ghc -- --version
# we first build everything without running the tests (with unlimited parallelism)
stack build --resolver=${{ matrix.snapshot }} --ghc-options=-Werror --test --bench --no-run-tests
# once that's done we run the tests in a single threaded fashion to avoid
# https://github.com/commercialhaskell/stack/issues/5024#issuecomment-845001389
stack build --resolver=${{ matrix.snapshot }} --ghc-options=-Werror --test --bench -j 1
- uses: actions/cache/save@v4
if: always()
with:
path: ${{ steps.setuphaskell.outputs.stack-root }}
key: ${{ runner.os }}-${{ matrix.snapshot }}-stack2