Merge pull request #124 from commercialhaskell/CI-macOS #220
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: Tests | |
on: | |
pull_request: | |
push: | |
branches: | |
- master | |
workflow_dispatch: | |
# As of 4 February 2024, ubuntu-latest, windows-latest and macos-latest come | |
# with Stack 2.13.1. However, macos-14 does not come with Haskell tools. | |
jobs: | |
build: | |
name: CI | |
runs-on: ${{ matrix.os }} | |
strategy: | |
fail-fast: false | |
matrix: | |
os: | |
- ubuntu-latest | |
resolver: | |
- stack-ghc-9.4.8.yaml | |
- stack-ghc-9.6.4.yaml | |
- stack-ghc-9.8.1.yaml | |
include: | |
- os: macos-latest | |
resolver: stack-ghc-9.8.1.yaml | |
# macos-14 provides macOS/AArch64 (M1) | |
- os: macos-14 | |
resolver: stack-ghc-9.8.1.yaml | |
- os: windows-latest | |
resolver: stack-ghc-9.8.1.yaml | |
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 }}-${{ matrix.resolver }} | |
- 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 }}-${{ matrix.resolver }} | |
- name: Build and run tests | |
shell: bash | |
run: | | |
set -ex | |
if [[ "${{ matrix.os }}" == "macos-14" ]] | |
then | |
# macos-14 does not include Haskell tools as at 2024-02-04. | |
curl -sSL https://get.haskellstack.org/ | sh | |
fi | |
stack --resolver ${{ matrix.resolver }} test --bench --no-run-benchmarks --haddock --no-haddock-deps | |
test-pretty-exceptions: | |
name: Test build of test-pretty-exceptions | |
runs-on: ${{ matrix.os }} | |
strategy: | |
fail-fast: false | |
matrix: | |
os: | |
- ubuntu-latest | |
- windows-latest | |
resolver: | |
- stack-ghc-9.8.1.yaml | |
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 }}-${{ matrix.resolver }}-pretty | |
- 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 }}-${{ matrix.resolver }}-pretty | |
- name: Build test-pretty-exceptions | |
shell: bash | |
run: | | |
set -ex | |
stack --resolver ${{ matrix.resolver }} build --flag pantry:test-pretty-exceptions |