Skip to content

Commit

Permalink
Fix a wrong assumption about how caching works
Browse files Browse the repository at this point in the history
* According to Github documentation cache action will already
automatically look into `master` branch cache, however it will never
look into caches for other branches. So, previous logic was a bit faulty
* Enable trigger on pushes to master, this way we can have a build after
each PR is merged.
  • Loading branch information
lehins committed Jan 12, 2023
1 parent e6aef0c commit 5f267c4
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/haskell.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
name: Haskell CI

on:
push:
branches: [ "master" ]
pull_request:
branches: [ "**" ]

Expand Down Expand Up @@ -83,11 +85,9 @@ jobs:
dist-newstyle
# cache is invalidated upon a change to cabal.project (and/or cabal.project.local), a bump to
# CABAL_CACHE_VERSION or after a week of inactivity
key: cache-${{ runner.os }}-${{ matrix.ghc }}-${{ env.CABAL_CACHE_VERSION }}-${{ hashFiles('cabal.project*') }}-${{ github.head_ref }}
# Restoring attempts are from current branch, master or any other branch
key: cache-${{ runner.os }}-${{ matrix.ghc }}-${{ env.CABAL_CACHE_VERSION }}-${{ hashFiles('cabal.project*') }}
# Restoring attempts are from current branch then master
restore-keys: |
cache-${{ runner.os }}-${{ matrix.ghc }}-${{ env.CABAL_CACHE_VERSION }}-${{ hashFiles('cabal.project*') }}-${{ github.head_ref }}
cache-${{ runner.os }}-${{ matrix.ghc }}-${{ env.CABAL_CACHE_VERSION }}-${{ hashFiles('cabal.project*') }}-master
cache-${{ runner.os }}-${{ matrix.ghc }}-${{ env.CABAL_CACHE_VERSION }}-${{ hashFiles('cabal.project*') }}
- name: Install dependencies
Expand Down

0 comments on commit 5f267c4

Please sign in to comment.