40
40
LD_LIBRARY_PATH : ${{ (matrix.os != 'windows-latest' && '/usr/local/lib') || '' }}
41
41
42
42
steps :
43
- - name : Setup tmate session
44
- if : ${{ failure() }}
45
- uses : mxschmitt/action-tmate@v3
46
- with :
47
- limit-access-to-actor : true
48
-
49
43
- name : " WIN: Install System Dependencies via pacman (msys2)"
50
44
if : runner.os == 'Windows'
51
45
run : |
@@ -61,15 +55,15 @@ jobs:
61
55
automake `
62
56
libtool `
63
57
make
64
-
58
+
65
59
# this seems to break something. It _must_ come after the pacman setup
66
60
# above. It appears as if PATHEXT is set _after_ ghcup install ghc/cabal, and
67
61
# as such we'd need pacman.exe instead.
68
62
- name : Setup Haskell
69
- run : |
63
+ run : |
70
64
# Use GHCUP to manage ghc/cabal
71
65
ghcup install ghc --set ${{ matrix.ghc }}
72
- ghcup install cabal --set 3.6.2 .0
66
+ ghcup install cabal --set 3.8.1 .0
73
67
74
68
ghc --version
75
69
cabal --version
@@ -96,19 +90,28 @@ jobs:
96
90
-a ("extra-lib-dirs: {0}, C:/msys64/mingw64/lib" -f $ghcMingwDir) `
97
91
-f init
98
92
99
- - name : " OUTPUT Record cabal-store (Linux)"
100
- id : lin-setup-haskell
101
- if : runner.os != 'Windows'
102
- run : echo "cabal-store=/home/runner/.cabal/store" >> $GITHUB_OUTPUT
103
-
104
- - name : " OUTPUT Record cabal-store (Windows)"
105
- id : win-setup-haskell
106
- if : runner.os == 'Windows'
93
+ # Unify the computation of the cabal store directory to a single step. This makes referencing the cabal
94
+ # store in later steps easier.
95
+ #
96
+ # We know on cabal store is located in the following locations by OS:
97
+ #
98
+ # Linux: /home/runner/.cabal/store
99
+ # MacOS: /Users/runner/.cabal/store
100
+ # Windows: C:\cabal\store
101
+ #
102
+ # However, we compute these as best be can from information cabal provides in case this changes in the future.
103
+ - name : " Setup cabal-store"
104
+ id : cabal-store
107
105
shell : bash
108
- run : echo "cabal-store=C:\\cabal\\store" >> $GITHUB_OUTPUT
106
+ run : |
107
+ cabal help user-config
108
+ cabal_config_file="$(cabal help user-config | grep -A 1 'You can edit the cabal configuration file to set defaults' | tail -n 1 | xargs)"
109
109
110
- - name : Set cache version
111
- run : echo "CACHE_VERSION=grFfw7r" >> $GITHUB_ENV
110
+ if [[ '${{ runner.os }}' != 'Windows' ]]; then
111
+ echo "cabal-store=$(dirname "$cabal_config_file")/store" | tee -a "$GITHUB_OUTPUT"
112
+ else
113
+ echo "cabal-store=C:\\cabal\\store" | tee -a "$GITHUB_OUTPUT"
114
+ fi
112
115
113
116
- uses : actions/checkout@v2
114
117
@@ -180,36 +183,65 @@ jobs:
180
183
echo "# cabal.project.local"
181
184
cat cabal.project.local
182
185
183
- - name : Record dependencies
184
- id : record-deps
186
+ - name : List all pkg-config packages
185
187
run : |
186
- cabal build all --dry-run
187
- cat dist-newstyle/cache/plan.json | jq -r '."install-plan"[].id' | sort | uniq > dependencies.txt
188
+ # The tests call out to msys2 commands. We generally do not want to mix toolchains, so
189
+ # we are very deliberate about only adding msys64 to the path where absolutely necessary.
190
+ ${{ (runner.os == 'Windows' && '$env:PATH=("C:\msys64\mingw64\bin;{0}" -f $env:PATH)') || '' }}
191
+ pkg-config --list-all
188
192
189
- - name : " OUTPUT Record weeknum"
190
- shell : bash
191
- run : echo "weeknum=$(/usr/bin/date -u "+%W")" >> $GITHUB_OUTPUT
193
+ - name : Build dry run
194
+ run : |
195
+ # The tests call out to msys2 commands. We generally do not want to mix toolchains, so
196
+ # we are very deliberate about only adding msys64 to the path where absolutely necessary.
197
+ ${{ (runner.os == 'Windows' && '$env:PATH=("C:\msys64\mingw64\bin;{0}" -f $env:PATH)') || '' }}
198
+ cabal build all --dry-run
192
199
193
- - name : Cache Cabal store
194
- uses : actions/cache@v2
200
+ # For users who fork cardano-node and want to define a writable cache, then can set up their own
201
+ # S3 bucket then define in their forked repository settings the following secrets:
202
+ #
203
+ # AWS_ACCESS_KEY_ID
204
+ # AWS_SECRET_ACCESS_KEY
205
+ # BINARY_CACHE_URI
206
+ # BINARY_CACHE_REGION
207
+ - name : Cabal cache over S3
208
+ uses : action-works/cabal-cache-s3@v1
209
+ env :
210
+ AWS_ACCESS_KEY_ID : ${{ secrets.AWS_ACCESS_KEY_ID }}
211
+ AWS_SECRET_ACCESS_KEY : ${{ secrets.AWS_SECRET_ACCESS_KEY }}
195
212
with :
196
- path : ${{ runner.os == 'Windows' && steps.win-setup-haskell.outputs.cabal-store || steps.lin-setup-haskell.outputs.cabal-store }}
197
- key : cache-${{ env.CACHE_VERSION }}-${{ runner.os }}-${{ matrix.ghc }}-${{ hashFiles('dependencies.txt') }}-${{ hashFiles('date.txt') }}
198
- restore-keys : |
199
- cache-${{ env.CACHE_VERSION }}-${{ runner.os }}-${{ matrix.ghc }}-${{ hashFiles('dependencies.txt') }}
200
- cache-${{ env.CACHE_VERSION }}-${{ runner.os }}-${{ matrix.ghc }}
201
-
202
- - uses : actions/cache@v2
203
- name : " Cache `dist-newstyle`"
213
+ region : ${{ secrets.BINARY_CACHE_REGION }}
214
+ dist-dir : dist-newstyle
215
+ store-path : ${{ steps.cabal-store.outputs.cabal-store }}
216
+ threads : 16
217
+ archive-uri : ${{ secrets.BINARY_CACHE_URI }}
218
+ skip : " ${{ secrets.BINARY_CACHE_URI == '' }}"
219
+
220
+ # It's important to ensure that people who fork this repository can not only successfully build in
221
+ # CI by default, but also have meaning cabal store caching.
222
+ #
223
+ # Because syncing with S3 requires credentials, we cannot rely on S3 for this. For this reason a
224
+ # https fallback is used. The https server mirrors the content of the S3 bucket. The https cabal
225
+ # store archive is read-only for security reasons.
226
+ #
227
+ # Users who fork this repository who want to have a writable cabal store archive are encouraged
228
+ # to set up their own S3 bucket.
229
+ - name : Cabal cache over HTTPS
230
+ uses : action-works/cabal-cache-s3@v1
204
231
with :
205
- path : |
206
- dist-newstyle
207
- !dist-newstyle/**/.git
208
- key : cache-dist-${{ env.CACHE_VERSION }}-${{ runner.os }}-${{ matrix.ghc }}-${{ steps.record-deps.outputs.weeknum }}
209
- restore-keys : cache-dist-${{ env.CACHE_VERSION }}-${{ runner.os }}-${{ matrix.ghc }}
232
+ dist-dir : dist-newstyle
233
+ store-path : ${{ steps.cabal-store.outputs.cabal-store }}
234
+ threads : 16
235
+ archive-uri : https://iohk.cache.haskellworks.io
236
+ skip : " ${{ secrets.BINARY_CACHE_URI != '' }}"
237
+ enable-save : false
210
238
211
239
- name : Build
212
- run : cabal build cardano-node cardano-cli cardano-node-chairman cardano-submit-api
240
+ run : |
241
+ # The tests call out to msys2 commands. We generally do not want to mix toolchains, so
242
+ # we are very deliberate about only adding msys64 to the path where absolutely necessary.
243
+ ${{ (runner.os == 'Windows' && '$env:PATH=("C:\msys64\mingw64\bin;{0}" -f $env:PATH)') || '' }}
244
+ cabal build cardano-node cardano-cli cardano-node-chairman cardano-submit-api
213
245
214
246
- name : Run tests (all)
215
247
if : github.event.inputs.tests == 'all'
@@ -288,6 +320,8 @@ jobs:
288
320
# - name: Setup tmate session
289
321
# if: ${{ failure() }}
290
322
# uses: mxschmitt/action-tmate@v3
323
+ # with:
324
+ # limit-access-to-actor: true
291
325
292
326
release :
293
327
needs : [build]
0 commit comments