Skip to content

Commit

Permalink
second try: haskell.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
smoge authored Nov 17, 2024
1 parent 7595e68 commit 29bd347
Showing 1 changed file with 27 additions and 16 deletions.
43 changes: 27 additions & 16 deletions .github/workflows/haskell.yml
Original file line number Diff line number Diff line change
@@ -1,14 +1,11 @@
name: Haskell Stack CI

on:
push:
branches: [ "main", "feature/**", "refactor/**" ]
pull_request:
branches: [ "main" ]

permissions:
contents: read

jobs:
build:
runs-on: ubuntu-latest
Expand All @@ -17,7 +14,6 @@ jobs:
matrix:
os: [ubuntu-latest]
fail-fast: false

steps:
- uses: actions/checkout@v4

Expand All @@ -29,20 +25,39 @@ jobs:
stack-version: 'latest'
stack-no-global: true

- name: Cache Stack files
# Split caching into separate steps for better control
- name: Cache Stack work files
uses: actions/cache@v3
with:
path: |
~/.stack
.stack-work
# Add any other project-specific cache directories
key: ${{ runner.os }}-stack-${{ hashFiles('stack.yaml', 'package.yaml', 'stack.yaml.lock') }}
path: .stack-work
key: ${{ runner.os }}-stack-work-${{ hashFiles('stack.yaml', 'package.yaml', 'stack.yaml.lock') }}
restore-keys: |
${{ runner.os }}-stack-
${{ runner.os }}-stack-work-
- name: Cache Stack global package db
uses: actions/cache@v3
with:
path: ~/.stack/programs
key: ${{ runner.os }}-stack-programs-${{ hashFiles('stack.yaml') }}
restore-keys: |
${{ runner.os }}-stack-programs-
- name: Cache Stack pantry files
uses: actions/cache@v3
with:
path: ~/.stack/pantry
key: ${{ runner.os }}-stack-pantry-${{ hashFiles('stack.yaml') }}
restore-keys: |
${{ runner.os }}-stack-pantry-
- name: Prepare Stack
run: |
stack --version
stack update
- name: Install dependencies
run: |
stack setup --resolver lts-21.25
stack setup
stack build --only-dependencies --test --bench --no-run-benchmarks
- name: Build
Expand All @@ -54,19 +69,16 @@ jobs:
run: |
stack test --coverage
stack hpc report . # Generate coverage report
- name: Install and run HLint
run: |
stack install hlint
stack exec -- hlint .
- name: Check formatting
run: |
stack install ormolu
stack exec -- ormolu --mode check $(find . -name '*.hs')
- name: Build documentation
run: |
Expand All @@ -88,7 +100,6 @@ jobs:
.stack-work/dist/**/hpc/
.stack-work/dist/**/doc/
# Add warning comment on PR if tests fail
- name: Comment on PR
if: github.event_name == 'pull_request' && failure()
Expand Down

0 comments on commit 29bd347

Please sign in to comment.