Skip to content

Commit 874d500

Browse files
committed
CI: {caching,test,bench}: mk cache aware of package dep versions
1. CI caches 3rd patry dependency binaries. 2. That is why we do not want to trigger on all `.cabal` changes. We want to cache only when changes in `.cabal` descriptions lead to changes in versions of deps used, or in their compilation flags. `freeze` files: For example the bits of the resulting `.freeze` file: active-repositories: hackage.haskell.org:merge constraints: any.Boolean ==0.2.4, ... any.HsYAML ==0.2.1.0, HsYAML -exe, any.HsYAML-aeson ==0.2.0.1, HsYAML-aeson -exe, any.JuicyPixels ==3.3.6, JuicyPixels -mmap, any.MemoTrie ==0.6.10, MemoTrie -examples, ... any.QuickCheck ==2.14.2, QuickCheck -old-random +templatehaskell, aeson -bytestring-builder -cffi -developer -fast, ... any.aeson-pretty ==0.8.9, aeson-pretty -lib-only, bifunctors +semigroups +tagged, any.blaze-textual ==0.2.2.1, blaze-textual -developer -integer-simple +native, ... any.brittany ==0.13.1.2, brittany -brittany-dev-lib -brittany-test-perf, ... any.clock ==0.8.2, clock -llvm, any.cmdargs ==0.10.21, cmdargs +quotation -testprog, ... any.comonad ==5.0.8, comonad +containers +distributive +indexed-traversable, ... any.hashtables ==1.2.4.2, hashtables -bounds-checking -debug -detailed-profiling -portable -sse42 +unsafe-tricks, haskell-language-server -alternatenumberformat +brittany +callhierarchy +class +eval +floskell +fourmolu +haddockcomments +hlint -ignore-plugins-ghc-bounds +importlens +modulename +ormolu -pedantic +pragmas +qualifyimportednames +refineimports -rename +retrie +splice +stylishhaskell +tactic, ... any.hlint ==3.2.7, hlint -ghc-lib +gpl -hsyaml +threaded, hls-eval-plugin -pedantic, hls-graph -embed-files -pedantic -stm-stats, hls-hlint-plugin -ghc-lib -hlint33 -pedantic, ... any.integer-logarithms ==1.0.3.1, integer-logarithms -check-bounds +integer-gmp, ... any.lens ==5.0.1, lens -benchmark-uniplate -dump-splices +inlining -j +test-hunit +test-properties +test-templates +trustworthy, ... any.scientific ==0.3.7.0, scientific -bytestring-builder -integer-simple, any.semigroupoids ==5.3.6, semigroupoids +comonad +containers +contravariant +distributive +tagged +unordered-containers, any.semigroups ==0.19.2, semigroups +binary +bytestring -bytestring-builder +containers +deepseq +hashable +tagged +template-haskell +text +transformers +unordered-containers, ... any.transformers-compat ==0.6.6, transformers-compat -five +five-three -four +generic-deriving +mtl -three -two, ... any.vector ==0.12.3.1, vector +boundschecks -internalchecks -unsafechecks -wall, any.vector-algorithms ==0.8.0.4, vector-algorithms +bench +boundschecks -internalchecks -llvm +properties -unsafechecks, ... index-state: hackage.haskell.org 2021-11-29T12:28:17Z ``` You got the idea. `freeze` collects stuff for dependencies. I also checked - it solves & collects all package configuration across all subprojects in one file.
1 parent e642dd1 commit 874d500

File tree

3 files changed

+26
-7
lines changed

3 files changed

+26
-7
lines changed

.github/workflows/bench.yml

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,10 @@ jobs:
7474
INDEX_STATE1=$(echo "$INDEX_STATE_ENTRY" | cut -d' ' -f2 | tr ':' '-')
7575
echo "INDEX_STATE=$INDEX_STATE1" >> $GITHUB_ENV
7676
77+
- name: Form the package list ('cabal.project.freeze')
78+
run: |
79+
cabal v2-freeze
80+
7781
- name: Hackage sources cache
7882
uses: actions/cache@v2
7983
env:
@@ -84,13 +88,15 @@ jobs:
8488
restore-keys: ${{ env.cache-name }}-
8589

8690
- name: Compiled deps cache
91+
id: compiled-deps
8792
uses: actions/cache@v2
8893
env:
8994
cache-name: compiled-deps
9095
with:
9196
path: ${{ steps.HaskEnvSetup.outputs.cabal-store }}
92-
key: ${{ env.cache-name }}-${{ runner.os }}-${{ matrix.ghc }}-${{ env.INDEX_STATE }}-${{ hashFiles('cabal.project') }}
97+
key: ${{ env.cache-name }}-${{ runner.os }}-${{ matrix.ghc }}-${{ env.INDEX_STATE }}-${{ hashFiles('cabal.project') }}-${{ hashFiles('cabal.project.freeze') }}
9398
restore-keys: |
99+
${{ env.cache-name }}-${{ runner.os }}-${{ matrix.ghc }}-${{ env.INDEX_STATE }}-${{ hashFiles('cabal.project') }}
94100
${{ env.cache-name }}-${{ runner.os }}-${{ matrix.ghc }}-${{ env.INDEX_STATE }}-
95101
${{ env.cache-name }}-${{ runner.os }}-${{ matrix.ghc }}-
96102
${{ env.cache-name }}-${{ runner.os }}-

.github/workflows/caching.yml

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,10 @@ jobs:
125125
INDEX_STATE1=$(echo "$INDEX_STATE_ENTRY" | cut -d' ' -f2 | tr ':' '-')
126126
echo "INDEX_STATE=$INDEX_STATE1" >> $GITHUB_ENV
127127
128+
- name: Form the package list ('cabal.project.freeze')
129+
run: |
130+
cabal v2-freeze
131+
128132
# 2021-12-02: NOTE: Cabal Hackage source tree storage does not depend on OS or GHC really,
129133
# but can depend on `base`.
130134
# But this caching is happens only inside `master` for `master` purposes of compiling the deps
@@ -135,9 +139,11 @@ jobs:
135139
env:
136140
cache-name: hackage-sources
137141
with:
138-
path: ${{ env.CABAL_PKGS_DIR }}
139-
key: ${{ env.cache-name }}-${{ env.INDEX_STATE }}
140-
restore-keys: ${{ env.cache-name }}-
142+
path: ${{ env.CABAL_PKGS_DIR }}
143+
key: ${{ env.cache-name }}-${{ env.INDEX_STATE }}-${{ hashFiles('cabal.project.freeze') }}
144+
restore-keys: |
145+
${{ env.cache-name }}-${{ env.INDEX_STATE }}-
146+
${{ env.cache-name }}-
141147
142148
- name: Compiled deps cache
143149
id: compiled-deps
@@ -146,8 +152,9 @@ jobs:
146152
cache-name: compiled-deps
147153
with:
148154
path: ${{ steps.HaskEnvSetup.outputs.cabal-store }}
149-
key: ${{ env.cache-name }}-${{ runner.os }}-${{ matrix.ghc }}-${{ env.INDEX_STATE }}-${{ hashFiles('cabal.project') }}
155+
key: ${{ env.cache-name }}-${{ runner.os }}-${{ matrix.ghc }}-${{ env.INDEX_STATE }}-${{ hashFiles('cabal.project') }}-${{ hashFiles('cabal.project.freeze') }}
150156
restore-keys: |
157+
${{ env.cache-name }}-${{ runner.os }}-${{ matrix.ghc }}-${{ env.INDEX_STATE }}-${{ hashFiles('cabal.project') }}
151158
${{ env.cache-name }}-${{ runner.os }}-${{ matrix.ghc }}-${{ env.INDEX_STATE }}-
152159
${{ env.cache-name }}-${{ runner.os }}-${{ matrix.ghc }}-
153160
${{ env.cache-name }}-${{ runner.os }}-

.github/workflows/test.yml

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,10 @@ jobs:
123123
INDEX_STATE1=$(echo "$INDEX_STATE_ENTRY" | cut -d' ' -f2 | tr ':' '-')
124124
echo "INDEX_STATE=$INDEX_STATE1" >> $GITHUB_ENV
125125
126+
- name: Form the package list ('cabal.project.freeze')
127+
run: |
128+
cabal v2-freeze
129+
126130
- name: Hackage sources cache
127131
uses: actions/cache@v2
128132
env:
@@ -133,14 +137,16 @@ jobs:
133137
restore-keys: ${{ env.cache-name }}-
134138

135139
- name: Compiled deps cache
140+
id: compiled-deps
136141
uses: actions/cache@v2
137142
env:
138143
cache-name: compiled-deps
139144
with:
140145
path: ${{ steps.HaskEnvSetup.outputs.cabal-store }}
141-
key: ${{ env.cache-name }}-${{ runner.os }}-${{ matrix.ghc }}-${{ env.INDEX_STATE }}-${{ hashFiles('cabal.project') }}
146+
key: ${{ env.cache-name }}-${{ runner.os }}-${{ matrix.ghc }}-${{ env.INDEX_STATE }}-${{ hashFiles('cabal.project') }}-${{ hashFiles('cabal.project.freeze') }}
142147
restore-keys: |
143-
${{ env.cache-name }}-${{ runner.os }}-${{ matrix.ghc }}-${{ env.INDEX_STATE }}-
148+
${{ env.cache-name }}-${{ runner.os }}-${{ matrix.ghc }}-${{ env.INDEX_STATE }}-${{ hashFiles('cabal.project.freeze') }}
149+
${{ env.cache-name }}-${{ runner.os }}-${{ matrix.ghc }}-${{ env.INDEX_STATE }}-${{ hashFiles('cabal.project') }}
144150
${{ env.cache-name }}-${{ runner.os }}-${{ matrix.ghc }}-
145151
${{ env.cache-name }}-${{ runner.os }}-
146152

0 commit comments

Comments
 (0)