Skip to content

Merge branch 'main' into dependabot/github_actions/haskell/actions-2.4.4 #304

Merge branch 'main' into dependabot/github_actions/haskell/actions-2.4.4

Merge branch 'main' into dependabot/github_actions/haskell/actions-2.4.4 #304

Workflow file for this run

name: Build
permissions: read-all
on:
push:
workflow_call:
inputs:
coverage:
required: false
type: boolean
jobs:
build:
concurrency: build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3
- uses: haskell/actions/setup@fc675398fab930927d01e9c00eee89066aa2ca12 # v2.4.4
with:
enable-stack: true
- name: Cache dependencies
uses: actions/cache@88522ab9f39a2ea568f7027eddc7d8d8bc9d59c8 # v3.3.1
with:
path: ~/.stack
key: stack-${{ hashFiles('package.yaml', 'stack.yaml') }}
restore-keys: stack-
- name: Cache build artifacts
uses: actions/cache@88522ab9f39a2ea568f7027eddc7d8d8bc9d59c8 # v3.3.1
with:
path: .stack-work
key: build-${{ hashFiles('app/**', 'src/**', 'test/**') }}
restore-keys: build-
- name: Build and test
if: ${{ !inputs.coverage }}
run: stack build --test
- name: Coverage
id: coverage
if: ${{ inputs.coverage }}
run: |
stack build --test --coverage
echo "report=$(stack path --local-hpc-root)" >> $GITHUB_OUTPUT
- name: Upload coverage report
if: ${{ inputs.coverage }}
uses: actions/upload-artifact@0b7f8abb1508181956e8e162db84b466c27e18ce # v3.1.2
with:
name: coverage-report
path: ${{ steps.coverage.outputs.report }}