Skip to content

Merge pull request #226 from haskell-actions/dependabot/github_action… #719

Merge pull request #226 from haskell-actions/dependabot/github_action…

Merge pull request #226 from haskell-actions/dependabot/github_action… #719

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@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0
- uses: haskell-actions/setup@dd344bc1cec854a369df8814ce17ef337d6e6170 # v2.7.6
with:
enable-stack: true
- name: Cache dependencies
uses: actions/cache@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 # v4.0.2
with:
path: ~/.stack
key: stack-${{ hashFiles('package.yaml', 'stack.yaml') }}
restore-keys: stack-
- name: Cache build artifacts
uses: actions/cache@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 # v4.0.2
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@50769540e7f4bd5e21e526ee35c689e35e0d6874 # v4.4.0
with:
name: coverage-report
path: ${{ steps.coverage.outputs.report }}