Skip to content

Soupstraw CI testing #326

Soupstraw CI testing

Soupstraw CI testing #326

Workflow file for this run

name: Cuddle CI
run-name: ${{ github.actor }} CI testing
on:
push:
branches: [ "master" ]
pull_request:
branches: [ "**"]
# Cancel running actions when a new action on the same PR is started
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
jobs:
build:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
ghc: ["9.6.7", "9.8.4", "9.10.2", "9.12.2"]
os: [ubuntu-latest]
steps:
- uses: actions/checkout@v3
- name: Install Haskell
uses: input-output-hk/setup-haskell@v1
id: setup-haskell
with:
ghc-version: ${{ matrix.ghc }}
cabal-version: latest
- name: Cabal update
run: cabal update
- name: Cabal Configure
run: cabal configure --enable-tests --write-ghc-environment-files=always
- uses: actions/cache@v3
if: matrix.os != 'macos-latest'
name: Cache cabal store
with:
path: |
${{ steps.setup-haskell.outputs.cabal-store }}
dist-newstyle
# cache is invalidated upon a change to cabal.project (and/or cabal.project.local), a bump to
# CABAL_CACHE_VERSION or after a week of inactivity
key: cache-${{ runner.os }}-${{ matrix.ghc }}-${{ env.CABAL_CACHE_VERSION }}-${{ hashFiles('cabal.project*') }}
# Restoring attempts are from current branch then master
restore-keys: |
cache-${{ runner.os }}-${{ matrix.ghc }}-${{ env.CABAL_CACHE_VERSION }}-${{ hashFiles('cabal.project*') }}
- name: Install dependencies
run: cabal build all --only-dependencies
- name: Build
run: cabal build all
- name: Run tests
run: |
cabal test all
fourmolu:
runs-on: ubuntu-latest
defaults:
run:
shell: bash
strategy:
fail-fast: false
steps:
- uses: actions/checkout@v4
- name: Install fourmolu
run: |
FOURMOLU_VERSION="0.17.0.0"
mkdir -p "$HOME/.local/bin"
curl -sL "https://github.com/fourmolu/fourmolu/releases/download/v${FOURMOLU_VERSION}/fourmolu-${FOURMOLU_VERSION}-linux-x86_64" -o "$HOME/.local/bin/fourmolu"
chmod a+x "$HOME/.local/bin/fourmolu"
echo "$HOME/.local/bin" >> $GITHUB_PATH
- name: Run fourmolu
run: ./scripts/fourmolize.sh
test-with-stack:
name: Stack
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest]
resolver: [lts-22, lts-23, lts-24, nightly]
include:
- resolver: lts-22
ghc: "9.6.7"
- resolver: lts-23
ghc: "9.8.4"
- resolver: lts-24
ghc: "9.10.2"
- resolver: nightly
ghc: "9.12.2"
env:
STACK_ARGS: '--resolver ${{ matrix.resolver }} --system-ghc'
cache-version: v0 # bump up this version to invalidate currently stored cache
steps:
- uses: actions/checkout@v4
- uses: haskell-actions/setup@v2
id: setup-haskell-cabal
name: Setup Haskell
with:
ghc-version: ${{ matrix.ghc }}
enable-stack: true
stack-version: 'latest'
cabal-version: 'latest'
- name: Cache
id: cache
uses: actions/cache@v4
with:
path: |
${{ steps.setup-haskell-cabal.outputs.stack-root }}
.stack-work
key: ${{ runner.os }}-${{ matrix.resolver }}-${{ env.cache-version }}
restore-keys: |
${{ runner.os }}-${{ matrix.resolver }}-${{ env.cache-version }}
- name: Build
run: |
set -ex
stack $STACK_ARGS test --no-run-tests --haddock --no-haddock-deps
- name: Test
env:
COVERALLS_REPO_TOKEN: ${{ secrets.COVERALLS_REPO_TOKEN }}
run: |
set -ex
if [ "${{ matrix.os }}.${{ matrix.resolver }}" == "ubuntu-latest.lts-22" ] && [ -n "${COVERALLS_REPO_TOKEN}" ]; then
stack $STACK_ARGS test --coverage
stack $STACK_ARGS hpc report --all
curl -L https://github.com/rubik/stack-hpc-coveralls/releases/download/v0.0.7.0/shc-Linux-X64.tar.bz2 | tar xj shc
./shc --repo-token="$COVERALLS_REPO_TOKEN" --partial-coverage --fetch-coverage combined custom
else
stack $STACK_ARGS test
fi