Skip to content

Commit c3c710c

Browse files
committed
Use CABAL_DIR for cache paths
1 parent ff770e0 commit c3c710c

File tree

4 files changed

+28
-30
lines changed

4 files changed

+28
-30
lines changed

.github/workflows/bench.yml

+7-2
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,11 @@ jobs:
4646

4747
- run: git fetch origin master # check the master branch for benchmarking
4848

49+
- name: Ensure CABAL_DIR environment variable is set
50+
run: |
51+
CABAL_DIR="${CABAL_DIR:-~/.cabal}"
52+
echo "CABAL_DIR=$CABAL_DIR" >> $GITHUB_ENV
53+
4954
- uses: haskell/actions/setup@v1
5055
id: HaskEnvSetup
5156
with:
@@ -79,7 +84,7 @@ jobs:
7984
env:
8085
cache-name: hackage-sources
8186
with:
82-
path: ${{ env.CABAL_PKGS_DIR }}
87+
path: ${{ env.CABAL_DIR }}/packages
8388
key: ${{ env.cache-name }}-${{ env.INDEX_STATE }}
8489
restore-keys: ${{ env.cache-name }}-
8590

@@ -88,7 +93,7 @@ jobs:
8893
env:
8994
cache-name: compiled-deps
9095
with:
91-
path: ${{ steps.HaskEnvSetup.outputs.cabal-store }}
96+
path: ${{ env.CABAL_DIR }}/store
9297
key: ${{ env.cache-name }}-${{ runner.os }}-${{ matrix.ghc }}-${{ env.INDEX_STATE }}-${{ hashFiles('cabal.project') }}
9398
restore-keys: |
9499
${{ env.cache-name }}-${{ runner.os }}-${{ matrix.ghc }}-${{ env.INDEX_STATE }}-

.github/workflows/caching.yml

+7-11
Original file line numberDiff line numberDiff line change
@@ -68,22 +68,18 @@ jobs:
6868
steps:
6969
- uses: actions/checkout@v2
7070

71+
- name: Ensure CABAL_DIR environment variable is set
72+
run: |
73+
CABAL_DIR="${CABAL_DIR:-~/.cabal}"
74+
echo "CABAL_DIR=$CABAL_DIR" >> $GITHUB_ENV
75+
7176
- uses: haskell/actions/setup@v1
7277
id: HaskEnvSetup
7378
with:
7479
ghc-version : ${{ matrix.ghc }}
7580
cabal-version: ${{ matrix.cabal }}
7681
enable-stack: false
7782

78-
- if: runner.os == 'Windows'
79-
name: (Windows) Platform config
80-
run: |
81-
echo "CABAL_PKGS_DIR=~\\AppData\\cabal\\packages" >> $GITHUB_ENV
82-
- if: ( runner.os == 'Linux' ) || ( runner.os == 'macOS' )
83-
name: (Linux,macOS) Platform config
84-
run: |
85-
echo "CABAL_PKGS_DIR=~/.cabal/packages" >> $GITHUB_ENV
86-
8783
# Needs to be before Cache Cabal so the cache can detect changes to the modified cabal.project file
8884
- if: matrix.ghc == '9.0.1'
8985
name: (GHC 9.0.1) Use modified `cabal.project`
@@ -125,7 +121,7 @@ jobs:
125121
env:
126122
cache-name: hackage-sources
127123
with:
128-
path: ${{ env.CABAL_PKGS_DIR }}
124+
path: ${{ env.CABAL_DIR }}/packages
129125
key: ${{ env.cache-name }}-${{ env.INDEX_STATE }}
130126
restore-keys: ${{ env.cache-name }}-
131127

@@ -134,7 +130,7 @@ jobs:
134130
env:
135131
cache-name: compiled-deps
136132
with:
137-
path: ${{ steps.HaskEnvSetup.outputs.cabal-store }}
133+
path: ${{ env.CABAL_DIR }}/store
138134
key: ${{ env.cache-name }}-${{ runner.os }}-${{ matrix.ghc }}-${{ env.INDEX_STATE }}-${{ hashFiles('cabal.project') }}
139135
restore-keys: |
140136
${{ env.cache-name }}-${{ runner.os }}-${{ matrix.ghc }}-${{ env.INDEX_STATE }}-

.github/workflows/hackage.yml

+7-6
Original file line numberDiff line numberDiff line change
@@ -48,17 +48,18 @@ jobs:
4848

4949
- uses: actions/checkout@v2
5050

51+
- name: Ensure CABAL_DIR environment variable is set
52+
run: |
53+
CABAL_DIR="${CABAL_DIR:-~/.cabal}"
54+
echo "CABAL_DIR=$CABAL_DIR" >> $GITHUB_ENV
55+
5156
- uses: haskell/actions/setup@v1
5257
id: HaskEnvSetup
5358
with:
5459
ghc-version : ${{ matrix.ghc }}
5560
cabal-version: ${{ matrix.cabal }}
5661
enable-stack: false
5762

58-
- name: Linux Platform config
59-
run: |
60-
echo "CABAL_PKGS_DIR=~/.cabal/packages" >> $GITHUB_ENV
61-
6263
- name: Retrieving `cabal.project` Hackage timestamp
6364
run: |
6465
# Form: index-state: 2021-11-29T08:11:08Z
@@ -72,7 +73,7 @@ jobs:
7273
env:
7374
cache-name: hackage-sources
7475
with:
75-
path: ${{ env.CABAL_PKGS_DIR }}
76+
path: ${{ env.CABAL_DIR }}/packages
7677
key: ${{ env.cache-name }}-${{ env.INDEX_STATE }}
7778
restore-keys: ${{ env.cache-name }}-
7879

@@ -81,7 +82,7 @@ jobs:
8182
env:
8283
cache-name: compiled-deps
8384
with:
84-
path: ${{ steps.HaskEnvSetup.outputs.cabal-store }}
85+
path: ${{ env.CABAL_DIR }}/store
8586
key: ${{ env.cache-name }}-${{ runner.os }}-${{ matrix.ghc }}-${{ env.INDEX_STATE }}-${{ hashFiles('cabal.project') }}
8687
restore-keys: |
8788
${{ env.cache-name }}-${{ runner.os }}-${{ matrix.ghc }}-${{ env.INDEX_STATE }}-

.github/workflows/test.yml

+7-11
Original file line numberDiff line numberDiff line change
@@ -75,22 +75,18 @@ jobs:
7575
steps:
7676
- uses: actions/checkout@v2
7777

78+
- name: Ensure CABAL_DIR environment variable is set
79+
run: |
80+
CABAL_DIR="${CABAL_DIR:-~/.cabal}"
81+
echo "CABAL_DIR=$CABAL_DIR" >> $GITHUB_ENV
82+
7883
- uses: haskell/actions/setup@v1
7984
id: HaskEnvSetup
8085
with:
8186
ghc-version : ${{ matrix.ghc }}
8287
cabal-version: ${{ matrix.cabal }}
8388
enable-stack: false
8489

85-
- if: runner.os == 'Windows'
86-
name: (Windows) Platform config
87-
run: |
88-
echo "CABAL_PKGS_DIR=~\\AppData\\cabal\\packages" >> $GITHUB_ENV
89-
- if: ( runner.os == 'Linux' ) || ( runner.os == 'macOS' )
90-
name: (Linux,macOS) Platform config
91-
run: |
92-
echo "CABAL_PKGS_DIR=~/.cabal/packages" >> $GITHUB_ENV
93-
9490
# Needs to be before Cache Cabal so the cache can detect changes to the modified cabal.project file
9591
- if: matrix.ghc == '9.0.1'
9692
name: (GHC 9.0.1) Use modified `cabal.project`
@@ -124,7 +120,7 @@ jobs:
124120
env:
125121
cache-name: hackage-sources
126122
with:
127-
path: ${{ env.CABAL_PKGS_DIR }}
123+
path: ${{ env.CABAL_DIR }}/packages
128124
key: ${{ env.cache-name }}-${{ env.INDEX_STATE }}
129125
restore-keys: ${{ env.cache-name }}-
130126

@@ -133,7 +129,7 @@ jobs:
133129
env:
134130
cache-name: compiled-deps
135131
with:
136-
path: ${{ steps.HaskEnvSetup.outputs.cabal-store }}
132+
path: ${{ env.CABAL_DIR }}/store
137133
key: ${{ env.cache-name }}-${{ runner.os }}-${{ matrix.ghc }}-${{ env.INDEX_STATE }}-${{ hashFiles('cabal.project') }}
138134
restore-keys: |
139135
${{ env.cache-name }}-${{ runner.os }}-${{ matrix.ghc }}-${{ env.INDEX_STATE }}-

0 commit comments

Comments
 (0)