Skip to content

Re #6250 Output summary reports to stdout, not stderr #2229

Re #6250 Output summary reports to stdout, not stderr

Re #6250 Output summary reports to stdout, not stderr #2229

Workflow file for this run

name: Unit tests
on:
pull_request:
push:
branches:
- master
- stable
- rc/**
workflow_dispatch:
# As of 21 August 2023, ubuntu-latest, windows-latest and macos-latest come
# with Stack 2.11.1 (2.9.3 on macos-latest) and GHC 9.6.2.
jobs:
pedantic:
name: Pedantic
runs-on: ubuntu-latest
steps:
- name: Clone project
uses: actions/checkout@v3
- name: Cache dependencies
uses: actions/cache@v3
with:
path: ~/.stack
key: ${{ runner.os }}-${{ hashFiles('stack.yaml') }}
restore-keys: |
${{ runner.os }}-
- name: Pedantic build
run: |
stack build --pedantic
- name: disable-git-info build
run: |
stack build --pedantic --flag stack:disable-git-info
unit-tests:
name: Unit tests
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:
- os: ubuntu-latest
extra-suffix: ""
stack-args: ""
- os: ubuntu-latest
extra-suffix: "alpine"
stack-args: "--docker --system-ghc --no-install-ghc --flag stack:static"
- os: windows-latest
extra-suffix: ""
stack-args: ""
- os: macos-latest
extra-suffix: ""
stack-args: ""
steps:
- name: Clone project
uses: actions/checkout@v3
- name: Cache dependencies on Unix-like OS
if: startsWith(runner.os, 'Linux') || startsWith(runner.os, 'macOS')
uses: actions/cache@v3
with:
path: ~/.stack
key: ${{ runner.os }}-${{ hashFiles('stack.yaml') }}-${{ matrix.extra-suffix }}
- name: Cache dependencies on Windows
if: startsWith(runner.os, 'Windows')
uses: actions/cache@v3
with:
path: |
~\AppData\Roaming\stack
~\AppData\Local\Programs\stack
key: ${{ runner.os }}-${{ hashFiles('stack.yaml') }}-${{ matrix.extra-suffix }}
- name: Run tests
shell: bash
run: |
set -ex
if [[ "${{ matrix.extra-suffix }}" == "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
stack test ${{ matrix.stack-args }} --haddock --no-haddock-deps --ghc-options="-Werror -O0" --copy-bins --local-bin-path bin
# Get output about whether the exe is dynamically linked
if [[ "${{ matrix.os }}" == "macos-latest" ]]
then
echo "Skipping ldd check on Mac"
elif [[ "${{ matrix.os }}" == "windows-latest" ]]
then
echo "Skipping ldd check on Windows"
elif [[ "${{ matrix.extra-suffix }}" == "alpine" ]]
then
# ldd returns exit code 1 if it's static, so failure is success
(ldd ./bin/stack && exit 1) || true
else
ldd ./bin/stack
fi
./bin/stack --version