Skip to content

Commit

Permalink
github: fix cabal cache
Browse files Browse the repository at this point in the history
* replace deprecated haskell/actions/setup with haskell-actions/setup
* enable documentation on initial config to avoid re-building
* split up cache into: gchup, cabal store, dist-newstyle with different
  hashes for each
* fix conflict with bv-sized by installing parameterized-utils from the
  repo and then removing it from the project. This is needed because
  bv-sized is pulled from hackage but depends on parameterized-utils, which
  (for unknown reasons) causes it to rebuild when the cabal cache is restored.
  • Loading branch information
danmatichuk committed Mar 5, 2024
1 parent cc300fc commit 34c0a76
Show file tree
Hide file tree
Showing 2 changed files with 71 additions and 36 deletions.
70 changes: 52 additions & 18 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ jobs:
LANGUAGE: en_US:en
LC_ALL: en_US.UTF-8
TZ: America/Los_Angeles
CACHE_VERSION: 4
CACHE_VERSION: 5

strategy:
fail-fast: false
Expand Down Expand Up @@ -97,28 +97,25 @@ jobs:
- name: Installing the freeze file
run: mv cabal.GHC-${{ matrix.ghc }}.freeze cabal.project.freeze

- uses: actions/cache@v2
name: Cache cabal store
- uses: actions/cache/restore@v4
name: Restore GHCup
id: cache-ghcup
with:
path: |
~/.cabal/store
~/.cabal/packages
~/.ghcup
dist-newstyle
# Our key is the freeze file and also the (constructed)
# cabal.project. This captures the normal package dependencies *and* the
# submodule hashes (without capturing anything undesirable)
key: ${{ env.CACHE_VERSION }}-pate-${{ runner.os }}-${{ matrix.ghc }}-${{ hashFiles('cabal.project.freeze', 'cabal.project') }}
restore-keys: |
${{ env.CACHE_VERSION }}-pate-${{ runner.os }}-${{ matrix.ghc }}-
path: ~/.ghcup
key: ${{ env.CACHE_VERSION }}-pate-ghcup-${{ runner.os }}-${{ matrix.ghc }}

- uses: haskell/actions/setup@v1
- uses: haskell-actions/setup@v2
id: setup-haskell-cabal
name: Setup Haskell
with:
ghc-version: ${{ matrix.ghc }}
cabal-version: ${{ matrix.cabal }}

- uses: actions/cache/save@v4
name: Save GHCup
with:
path: ~/.ghcup
key: ${{ steps.cache-ghcup.outputs.cache-primary-key }}

- name: System Dependencies
run: |
Expand All @@ -140,11 +137,48 @@ jobs:
cd tests
make extras
- name: Build pate
- uses: actions/cache/restore@v4
name: Restore Cabal Cache
id: cache-cabal-pate
with:
path: ${{ steps.setup-haskell-cabal.outputs.cabal-store }}
key: ${{ env.CACHE_VERSION }}-pate-cabal-${{ runner.os }}-${{ matrix.ghc }}-${{ hashFiles('cabal.project.freeze', 'cabal.project') }}
restore-keys: |
${{ env.CACHE_VERSION }}-pate-cabal-${{ runner.os }}-${{ matrix.ghc }}-
- uses: actions/cache/restore@v4
name: Restore Build Cache
id: cache-build-pate
with:
path: dist-newstyle
key: ${{ env.CACHE_VERSION }}-pate-build-${{ runner.os }}-${{ matrix.ghc }}-${{ hashFiles('cabal.project.freeze', 'cabal.project', '.gitmodules') }}
restore-keys: |
${{ env.CACHE_VERSION }}-pate-build-${{ runner.os }}-${{ matrix.ghc }}-
- name: Configure and build Pate dependencies
# installs parameterized-utils and then drops it from the project to resolve issue with bv-sized
run: |
cabal configure pkg:pate --write-ghc-environment-files=always --enable-tests -j --allow-newer=base
cabal configure pkg:pate --write-ghc-environment-files=always --enable-tests -j --allow-newer=base --enable-documentation -f unsafe-operations
cabal install parameterized-utils --lib
cabal freeze
sed -i -e "/parameterized-utils/d" cabal.project
cabal build pkg:pate --only-dependencies
cabal build pkg:pate
# Note that these keys still use the old hashes for cabal.project and cabal.project.freeze
- uses: actions/cache/save@v4
name: Save Cabal Cache
with:
path: ${{ steps.setup-haskell-cabal.outputs.cabal-store }}
key: ${{ steps.cache-cabal-pate.outputs.cache-primary-key }}

- uses: actions/cache/save@v4
name: Save Build Cache
with:
path: dist-newstyle
key: ${{ steps.cache-build-pate.outputs.cache-primary-key }}

- name: Build Pate
run: cabal build pkg:pate

- name: Install Solvers
run: .github/ci.sh install_system_deps
Expand Down
37 changes: 19 additions & 18 deletions cabal.GHC-9.6.2.freeze
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ constraints: any.BoundedChan ==1.0.3.0,
any.adjunctions ==4.4.2,
any.aeson ==2.1.2.1,
aeson -cffi +ordered-keymap,
any.alex ==3.4.0.1,
any.alex ==3.5.1.0,
any.ansi-terminal ==1.0,
ansi-terminal -example,
any.ansi-terminal-types ==0.11.5,
Expand All @@ -29,7 +29,7 @@ constraints: any.BoundedChan ==1.0.3.0,
async -bench,
any.attoparsec ==0.14.4,
attoparsec -developer,
any.barbies ==2.0.5.0,
any.barbies ==2.1.1.0,
any.base ==4.18.0.0,
any.base-compat ==0.13.1,
any.base-compat-batteries ==0.13.1,
Expand All @@ -44,7 +44,7 @@ constraints: any.BoundedChan ==1.0.3.0,
any.blaze-builder ==0.4.2.3,
any.blaze-textual ==0.2.3.1,
blaze-textual -developer -integer-simple +native,
any.boomerang ==1.4.9,
any.boomerang ==1.4.9.1,
any.bv-sized ==1.0.5,
any.bytestring ==0.11.4.0,
any.bytestring-builder ==0.10.8.2.0,
Expand Down Expand Up @@ -79,8 +79,8 @@ constraints: any.BoundedChan ==1.0.3.0,
demangler -debug,
any.deriving-compat ==0.6.5,
deriving-compat +base-4-9 +new-functor-classes +template-haskell-2-11,
any.direct-sqlite ==2.3.28,
direct-sqlite +fulltextsearch +haveusleep +json1 -systemlib +urifilenames,
any.direct-sqlite ==2.3.29,
direct-sqlite +dbstat +fulltextsearch +haveusleep +json1 -mathfunctions -systemlib +urifilenames,
any.directory ==1.3.8.1,
dismantle-arm-xml -asl-lite,
any.distributive ==0.6.2.1,
Expand Down Expand Up @@ -148,8 +148,8 @@ constraints: any.BoundedChan ==1.0.3.0,
any.json ==0.11,
json +generic -mapdict +parsec +pretty +split-base,
any.kan-extensions ==5.2.5,
any.kvitable ==1.0.2.1,
any.language-c ==0.9.2,
any.kvitable ==1.0.3.0,
any.language-c ==0.9.3,
language-c -allwarnings +iecfpextension +usebytestrings,
any.lens ==5.2.3,
lens -benchmark-uniplate -dump-splices +inlining -j +test-hunit +test-properties +test-templates +trustworthy,
Expand Down Expand Up @@ -188,6 +188,7 @@ constraints: any.BoundedChan ==1.0.3.0,
any.parsec ==3.1.16.1,
any.parser-combinators ==1.3.0,
parser-combinators -dev,
pate +unsafe-operations,
any.pretty ==1.1.3.6,
any.pretty-hex ==1.1,
any.pretty-show ==1.10,
Expand All @@ -199,7 +200,7 @@ constraints: any.BoundedChan ==1.0.3.0,
any.process ==1.6.17.0,
any.profunctors ==5.6.2,
any.quickcheck-io ==0.2.0,
any.random ==1.2.1.1,
any.random ==1.2.1.2,
any.readable ==0.3.1,
any.reflection ==2.1.7,
reflection -slow +template-haskell,
Expand All @@ -213,7 +214,7 @@ constraints: any.BoundedChan ==1.0.3.0,
any.s-cargot ==0.1.6.0,
s-cargot -build-example,
any.s-cargot-letbind ==0.2.4.0,
any.safe ==0.3.19,
any.safe ==0.3.21,
any.safe-exceptions ==0.1.7.4,
any.sayable ==1.2.4.0,
any.scientific ==0.3.7.0,
Expand All @@ -233,10 +234,10 @@ constraints: any.BoundedChan ==1.0.3.0,
snap-core -debug +network-uri -portable,
any.snap-server ==1.1.2.1,
snap-server -build-pong -build-testserver -debug -openssl -portable,
any.split ==0.2.4,
any.split ==0.2.5,
any.splitmix ==0.1.0.5,
splitmix -optimised-mixer,
any.sqlite-simple ==0.4.18.2,
any.sqlite-simple ==0.4.19.0,
any.stm ==2.5.1.0,
any.streaming-commons ==0.2.2.6,
streaming-commons -use-bytestring-builder,
Expand Down Expand Up @@ -271,7 +272,7 @@ constraints: any.BoundedChan ==1.0.3.0,
any.th-reify-many ==0.1.10,
any.th-utilities ==0.2.5.0,
any.these ==1.2,
any.threepenny-gui ==0.9.4.0,
any.threepenny-gui ==0.9.4.1,
threepenny-gui -buildexamples -rebug,
any.time ==1.12.2,
any.time-compat ==1.9.6.1,
Expand All @@ -286,11 +287,11 @@ constraints: any.BoundedChan ==1.0.3.0,
any.type-equality ==1,
any.unbounded-delays ==0.1.1.1,
any.unix ==2.8.1.0,
any.unix-compat ==0.7,
any.unix-compat ==0.7.1,
unix-compat -old-time,
any.unliftio ==0.2.25.0,
any.unliftio-core ==0.2.1.0,
any.unordered-containers ==0.2.19.1,
any.unordered-containers ==0.2.20,
unordered-containers -debug,
any.utf8-string ==1.0.2,
any.uuid-types ==1.0.5.1,
Expand All @@ -299,11 +300,11 @@ constraints: any.BoundedChan ==1.0.3.0,
vault +useghc,
any.vector ==0.12.3.1,
vector +boundschecks -internalchecks -unsafechecks -wall,
any.vector-sized ==1.5.0,
any.versions ==6.0.3,
any.vector-sized ==1.6.1,
any.versions ==6.0.5,
any.void ==0.7.3,
void -safe,
any.websockets ==0.12.7.3,
any.websockets ==0.13.0.0,
websockets -example,
any.websockets-snap ==0.10.3.1,
what4 -drealtestdisable -solvertests -stptestdisable,
Expand All @@ -314,4 +315,4 @@ constraints: any.BoundedChan ==1.0.3.0,
any.zlib ==0.6.3.0,
zlib -bundled-c-zlib -non-blocking-ffi -pkg-config,
any.zlib-bindings ==0.1.1.5
index-state: hackage.haskell.org 2023-12-01T17:26:51Z
index-state: hackage.haskell.org 2024-03-01T21:33:53Z

0 comments on commit 34c0a76

Please sign in to comment.