Skip to content

Haskell CI

Haskell CI #181

Workflow file for this run

name: Haskell CI
on:
workflow_dispatch:
pull_request:
types: [synchronize, opened, reopened]
push:
branches: [main]
schedule:
# additionally run once per week (At 00:00 on Sunday) to maintain cache
- cron: '0 0 * * 0'
jobs:
stack:
name: stack / ghc ${{ matrix.ghc }}
runs-on: ubuntu-latest
# Service containers to run with `runner-job`
services:
# Label used to access the service container
postgres:
# Docker Hub image
image: postgres
# Provide the password for postgres
env:
POSTGRES_PASSWORD: admin
# Set health checks to wait until postgres has started
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
ports:
# Maps tcp port 5432 on service container to the host port 5431
- 5431:5432
strategy:
matrix:
stack: ["latest"]
ghc: ["9.2", "9.4", "9.6", "9.8"]
steps:
- uses: actions/checkout@v3
- uses: haskell-actions/setup@v2
name: Setup Haskell Stack
with:
ghc-version: ${{ matrix.ghc }}
stack-version: ${{ matrix.stack }}
cabal-version: '3.6'
- uses: actions/cache@v3
name: Cache ~/.stack
with:
path: ~/.stack
key: ${{ runner.os }}-${{ matrix.ghc }}-stack
- name: Install dependencies
run: |
stack build --system-ghc --test --bench --no-run-tests --no-run-benchmarks --only-dependencies
- name: Build
run: |
stack build --system-ghc --test --bench --no-run-tests --no-run-benchmarks
- name: Test
run: |
stack test --system-ghc --coverage
- name: Install & run hpc-CodeCov
run: |
stack install hpc-codecov
hpc-codecov stack:all -o codecov.json
- name: Upload coverage reports to Codecov
uses: codecov/codecov-action@v3
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}