Skip to content

Haskell-CI

Haskell-CI #356

Workflow file for this run

name: Haskell-CI
permissions:
contents: read
on:
push:
branches:
- 'master'
pull_request:
branches:
- 'master'
schedule:
- cron: 0 0 * * *
workflow_dispatch:
inputs:
nightly:
description: Run with the same settings as a nightly build
type: boolean
default: false
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
jobs:
test-with-cabal:
name: Haskell-CI - Linux - ${{ matrix.ghc-version }}
strategy:
matrix:
ghc-version: [latest, 9.12, "9.10", 9.8, 9.6]
os: [ubuntu-latest]
fail-fast: false
runs-on: ${{ matrix.os }}
steps:
- name: Set NIGHTLY environment variable if the job was triggered by the scheduler
if: "${{ github.event_name == 'schedule'
|| contains(github.event.pull_request.title, 'nightly')
|| contains(github.event.pull_request.title, 'NIGHTLY')
|| github.event_name == 'workflow_dispatch' && github.event.inputs.nightly }}"
run: |
echo "NIGHTLY=true" >> $GITHUB_ENV
- uses: actions/checkout@v4
- uses: haskell-actions/setup@v2
with:
ghc-version: ${{matrix.ghc-version}}
- uses: actions/cache/restore@v4
with:
key: ${{ matrix.os }}-${{ matrix.ghc-version }}-${{ github.sha }}
path: ~/.cabal/store
restore-keys: ${{ matrix.os }}-${{ matrix.ghc-version }}-
- run: cabal build all
- run: cabal test all
- run: cabal haddock all
- uses: actions/cache/save@v4
with:
key: ${{ matrix.os }}-${{ matrix.ghc-version }}-${{ github.sha }}
path: ~/.cabal/store
test-with-stack:
name: Stack
runs-on: ubuntu-latest
steps:
- name: Set NIGHTLY environment variable if the job was triggered by the scheduler
if: "${{ github.event_name == 'schedule'
|| contains(github.event.pull_request.title, 'nightly')
|| contains(github.event.pull_request.title, 'NIGHTLY')
|| github.event_name == 'workflow_dispatch' && github.event.inputs.nightly }}"
run: |
echo "NIGHTLY=true" >> $GITHUB_ENV
- uses: actions/checkout@v4
- uses: haskell-actions/setup@v2
id: setup-haskell-stack
name: Setup Haskell
with:
enable-stack: true
stack-version: latest
ghc-version: 9.6.7
- name: Cache
id: cache
uses: actions/cache@v4
with:
path: |
${{ steps.setup-haskell-stack.outputs.stack-root }}
.stack-work
key: ${{ runner.os }}-stack-${{ github.sha }}
restore-keys: ${{ runner.os }}-stack
- name: Test
run: stack test --coverage --flag constrained-generators:dev
- uses: actions/cache/save@v4
with:
path: |
${{ steps.setup-haskell-stack.outputs.stack-root }}
.stack-work
key: ${{ runner.os }}-stack-${{ github.sha }}
- name: Upload coverage report
env:
COVERALLS_REPO_TOKEN: ${{ secrets.COVERALLS_REPO_TOKEN }}
run: |
[ -n "${COVERALLS_REPO_TOKEN}" ]
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 all