Skip to content

Commit 930117c

Browse files
committed
Cache store-dir to speed up test run
1 parent aca10ce commit 930117c

File tree

3 files changed

+107
-19
lines changed

3 files changed

+107
-19
lines changed

.github/scripts/build.sh

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,11 +37,12 @@ args=(
3737
${ADD_CABAL_ARGS}
3838
)
3939

40-
cabal v2-build "${args[@]}" cabal-install
40+
cabal --store-dir=store update
41+
cabal --store-dir=store v2-build "${args[@]}" cabal-install
4142

4243
mkdir -p "out"
4344
# shellcheck disable=SC2154
44-
cp "$(cabal list-bin "${args[@]}" cabal-install:exe:cabal)" "out/cabal$ext"
45+
cp "$(cabal --store-dir=store list-bin "${args[@]}" cabal-install:exe:cabal)" "out/cabal$ext"
4546
cp dist-newstyle/cache/plan.json "out/plan.json"
4647
cd "out/"
4748

.github/scripts/test.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,11 @@ cd ..
2222

2323
ghcup --no-verbose install ghc --set --install-targets "install_bin install_lib update_package_db" "${GHC_VERSION}"
2424

25-
cabal update
25+
cabal --store-dir=store update
2626

2727
# TODO: we want to avoid building here... we should just
2828
# be using the previously built 'cabal-tests' binary
29-
cabal run ${ADD_CABAL_ARGS} cabal-testsuite:cabal-tests -- \
29+
cabal --store-dir=store run ${ADD_CABAL_ARGS} cabal-testsuite:cabal-tests -- \
3030
--with-cabal "$(pwd)/out/cabal" \
3131
--intree-cabal-lib "$(pwd)" \
3232
--test-tmp "$(pwd)/testdb" \

.github/workflows/release.yaml

Lines changed: 102 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -192,6 +192,16 @@ jobs:
192192
DISTRO: ${{ matrix.platform.DISTRO }}
193193
ADD_CABAL_ARGS: ${{ matrix.platform.ADD_CABAL_ARGS }}
194194

195+
- name: Cache test artifacts
196+
uses: actions/upload-artifact@v4
197+
with:
198+
if-no-files-found: error
199+
retention-days: 1
200+
name: test-artifacts-${{ matrix.platform.ARTIFACT }}
201+
path: |
202+
./store
203+
./dist-newstyle
204+
195205
- if: always()
196206
name: Upload artifact
197207
uses: actions/upload-artifact@v4
@@ -200,7 +210,7 @@ jobs:
200210
retention-days: 2
201211
name: artifacts-${{ matrix.platform.ARTIFACT }}
202212
path: |
203-
./out/*
213+
./out
204214
205215
build-linux-32bit:
206216
name: Build linux binaries (32bit)
@@ -221,6 +231,16 @@ jobs:
221231
with:
222232
args: sh -c "apk update && apk add groff bash binutils-gold curl gcc g++ gmp-dev libc-dev libffi-dev make musl-dev ncurses-dev perl tar xz autoconf automake bzip2 coreutils elfutils-dev findutils git jq bzip2-dev patch python3 sqlite sudo wget which zlib-dev patchelf zlib zlib-dev zlib-static && bash .github/scripts/build.sh"
223233

234+
- name: Cache test artifacts
235+
uses: actions/upload-artifact@v4
236+
with:
237+
if-no-files-found: error
238+
retention-days: 1
239+
name: test-artifacts-${{ env.ARTIFACT }}
240+
path: |
241+
./store
242+
./dist-newstyle
243+
224244
- if: always()
225245
name: Upload artifact
226246
uses: actions/upload-artifact@v4
@@ -229,7 +249,7 @@ jobs:
229249
retention-days: 2
230250
name: artifacts-${{ env.ARTIFACT }}
231251
path: |
232-
./out/*
252+
./out
233253
234254
build-arm:
235255
name: Build ARM binary
@@ -274,6 +294,16 @@ jobs:
274294
DISTRO: ${{ matrix.DISTRO }}
275295
ADD_CABAL_ARGS: "--enable-split-sections --enable-executable-static"
276296

297+
- name: Cache test artifacts
298+
uses: actions/upload-artifact@v4
299+
with:
300+
if-no-files-found: error
301+
retention-days: 1
302+
name: test-artifacts-${{ matrix.ARTIFACT }}
303+
path: |
304+
./store
305+
./dist-newstyle
306+
277307
- if: always()
278308
name: Upload artifact
279309
uses: actions/upload-artifact@v4
@@ -282,7 +312,7 @@ jobs:
282312
retention-days: 2
283313
name: artifacts-${{ matrix.ARTIFACT }}
284314
path: |
285-
./out/*
315+
./out
286316
287317
build-mac-x86_64:
288318
name: Build binary (Mac x86_64)
@@ -308,6 +338,16 @@ jobs:
308338
brew install coreutils tree
309339
bash .github/scripts/build.sh
310340
341+
- name: Cache test artifacts
342+
uses: actions/upload-artifact@v4
343+
with:
344+
if-no-files-found: error
345+
retention-days: 1
346+
name: test-artifacts-${{ env.ARTIFACT }}
347+
path: |
348+
./store
349+
./dist-newstyle
350+
311351
- if: always()
312352
name: Upload artifact
313353
uses: actions/upload-artifact@v4
@@ -316,7 +356,7 @@ jobs:
316356
retention-days: 2
317357
name: artifacts-${{ env.ARTIFACT }}
318358
path: |
319-
./out/*
359+
./out
320360
321361
build-mac-aarch64:
322362
name: Build binary (Mac aarch64)
@@ -344,6 +384,16 @@ jobs:
344384
brew install git coreutils autoconf automake tree
345385
bash .github/scripts/build.sh
346386
387+
- name: Cache test artifacts
388+
uses: actions/upload-artifact@v4
389+
with:
390+
if-no-files-found: error
391+
retention-days: 1
392+
name: test-artifacts-${{ env.ARTIFACT }}
393+
path: |
394+
./store
395+
./dist-newstyle
396+
347397
- if: always()
348398
name: Upload artifact
349399
uses: actions/upload-artifact@v4
@@ -352,7 +402,7 @@ jobs:
352402
retention-days: 2
353403
name: artifacts-${{ env.ARTIFACT }}
354404
path: |
355-
./out/*
405+
./out
356406
357407
build-win:
358408
name: Build binary (Win)
@@ -390,6 +440,16 @@ jobs:
390440
C:\msys64\usr\bin\bash -lc "bash .github/scripts/build.sh"
391441
shell: pwsh
392442

443+
- name: Cache test artifacts
444+
uses: actions/upload-artifact@v4
445+
with:
446+
if-no-files-found: error
447+
retention-days: 1
448+
name: test-artifacts-${{ env.ARTIFACT }}
449+
path: |
450+
./store
451+
./dist-newstyle
452+
393453
- if: always()
394454
name: Upload artifact
395455
uses: actions/upload-artifact@v4
@@ -398,7 +458,7 @@ jobs:
398458
retention-days: 2
399459
name: artifacts-${{ env.ARTIFACT }}
400460
path: |
401-
./out/*
461+
./out
402462
403463
build-freebsd-x86_64:
404464
name: Build FreeBSD x86_64
@@ -429,6 +489,16 @@ jobs:
429489
sudo adjkerntz -a
430490
bash .github/scripts/build.sh
431491
492+
- name: Cache test artifacts
493+
uses: actions/upload-artifact@v4
494+
with:
495+
if-no-files-found: error
496+
retention-days: 1
497+
name: test-artifacts-${{ env.ARTIFACT }}
498+
path: |
499+
./store
500+
./dist-newstyle
501+
432502
- if: always()
433503
name: Upload artifact
434504
uses: actions/upload-artifact@v4
@@ -437,7 +507,7 @@ jobs:
437507
retention-days: 2
438508
name: artifacts-${{ env.ARTIFACT }}
439509
path: |
440-
./out/*
510+
./out
441511
442512
test-linux:
443513
name: Test linux binaries
@@ -580,10 +650,13 @@ jobs:
580650
with:
581651
cabal: ${{ env.CABAL_VERSION }}
582652

653+
- uses: actions/download-artifact@v4
654+
with:
655+
name: test-artifacts-${{ matrix.platform.ARTIFACT }}
656+
583657
- uses: actions/download-artifact@v4
584658
with:
585659
name: artifacts-${{ matrix.platform.ARTIFACT }}
586-
path: ./out
587660

588661
- name: Run test
589662
run: |
@@ -641,10 +714,13 @@ jobs:
641714
- name: Checkout code
642715
uses: actions/checkout@v4
643716

717+
- uses: actions/download-artifact@v4
718+
with:
719+
name: test-artifacts-${{ matrix.ARTIFACT }}
720+
644721
- uses: actions/download-artifact@v4
645722
with:
646723
name: artifacts-${{ matrix.ARTIFACT }}
647-
path: ./out
648724

649725
- if: matrix.DISTRO == 'Debian'
650726
uses: docker://hasufell/arm64v8-debian-haskell:10
@@ -682,7 +758,10 @@ jobs:
682758
- uses: actions/download-artifact@v4
683759
with:
684760
name: artifacts-${{ env.ARTIFACT }}
685-
path: ./out
761+
762+
- uses: actions/download-artifact@v4
763+
with:
764+
name: test-artifacts-${{ env.ARTIFACT }}
686765

687766
- name: Install GHCup
688767
uses: haskell/ghcup-setup@v1
@@ -714,7 +793,10 @@ jobs:
714793
- uses: actions/download-artifact@v4
715794
with:
716795
name: artifacts-${{ env.ARTIFACT }}
717-
path: ./out
796+
797+
- uses: actions/download-artifact@v4
798+
with:
799+
name: test-artifacts-${{ env.ARTIFACT }}
718800

719801
- name: Install GHCup
720802
uses: haskell/ghcup-setup@v1
@@ -753,7 +835,10 @@ jobs:
753835
- uses: actions/download-artifact@v4
754836
with:
755837
name: artifacts-${{ env.ARTIFACT }}
756-
path: ./out
838+
839+
- uses: actions/download-artifact@v4
840+
with:
841+
name: test-artifacts-${{ env.ARTIFACT }}
757842

758843
- name: Install GHCup
759844
uses: haskell/ghcup-setup@v1
@@ -788,7 +873,10 @@ jobs:
788873
- uses: actions/download-artifact@v4
789874
with:
790875
name: artifacts-${{ env.ARTIFACT }}
791-
path: ./out
876+
877+
- uses: actions/download-artifact@v4
878+
with:
879+
name: test-artifacts-${{ env.ARTIFACT }}
792880

793881
- name: Install GHCup
794882
uses: haskell/ghcup-setup@v1
@@ -822,7 +910,7 @@ jobs:
822910
, "test-freebsd-x86_64"
823911
]
824912
runs-on: ubuntu-latest
825-
if: startsWith(github.ref, 'refs/tags/') || ${{ github.event_name == 'schedule' }}
913+
if: ${{ startsWith(github.ref, 'refs/tags/') || github.event_name == 'schedule' }}
826914
steps:
827915
- name: Get current date
828916
id: date
@@ -836,7 +924,6 @@ jobs:
836924
with:
837925
pattern: artifacts-*
838926
merge-multiple: true
839-
path: ./out
840927

841928
- name: Install requirements
842929
run: |

0 commit comments

Comments
 (0)