Skip to content

Commit e776914

Browse files
Soupstrawneilmayhew
andcommitted
Added a Github action for checking if CDDL is up-to-date
Co-authored-by: Neil Mayhew <neil.mayhew@iohk.io>
1 parent 352eb0b commit e776914

File tree

1 file changed

+89
-5
lines changed

1 file changed

+89
-5
lines changed

.github/workflows/haskell.yml

Lines changed: 89 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -91,15 +91,15 @@ jobs:
9191

9292
- name: Configure to use libsodium
9393
run: |
94-
cat >> cabal.project <<EOF
94+
cat >> cabal.project.local <<EOF
9595
package cardano-crypto-praos
9696
flags: -external-libsodium-vrf
9797
EOF
9898
9999
- name: Configure to limit the heap size for ghc 8
100100
if: startsWith(${{ matrix.ghc }}, 8)
101101
run: |
102-
cat >> cabal.project <<EOF
102+
cat >> cabal.project.local <<EOF
103103
with-compiler: $PWD/scripts/ghc-limited
104104
with-hc-pkg: ghc-pkg
105105
EOF
@@ -332,9 +332,6 @@ jobs:
332332
path: |
333333
${{ steps.install-haskell.outputs.cabal-store }}
334334
key: ${{ env.cache-name }}-${{ runner.os }}-${{ matrix.ghc }}-${{ env.CABAL_CACHE_VERSION }}-${{ hashFiles('dependencies.txt') }}-${{ hashFiles('cabal.project*') }}
335-
# The cache with this specific key should have been created by the build
336-
# job. If the cache is missing, something is terribly wrong! We fail the
337-
# test job, or otherwise we would start rebuilding all the dependencies.
338335
fail-on-cache-miss: true
339336

340337
- name: Run tests
@@ -390,6 +387,93 @@ jobs:
390387
- name: Run fourmolu
391388
run: ./scripts/fourmolize.sh
392389

390+
gen-cddl:
391+
needs: build
392+
393+
runs-on: ubuntu-latest
394+
395+
env:
396+
# Modify this value to "invalidate" the cabal cache.
397+
CABAL_CACHE_VERSION: "2024-09-23"
398+
399+
# current ref from: 27.02.2022
400+
SECP256K1_REF: ac83be33d0956faf6b7f61a60ab524ef7d6a473a
401+
402+
SECP_CACHE_VERSION: "2022-12-30"
403+
ghc-version: "9.10.1"
404+
os: ubuntu-latest
405+
406+
defaults:
407+
run:
408+
shell: bash
409+
410+
steps:
411+
- uses: actions/checkout@v4
412+
413+
- name: Free up disk space
414+
run: |
415+
# Remove software and language runtimes we're not using
416+
sudo rm -rf \
417+
"$AGENT_TOOLSDIRECTORY" \
418+
/opt/google/chrome \
419+
/opt/microsoft/msedge \
420+
/opt/microsoft/powershell \
421+
/opt/pipx \
422+
/usr/lib/mono \
423+
/usr/local/julia* \
424+
/usr/local/lib/android \
425+
/usr/local/lib/node_modules \
426+
/usr/local/share/chromium \
427+
/usr/local/share/powershell \
428+
/usr/share/dotnet \
429+
/usr/share/swift
430+
df -h /
431+
432+
- name: Install system dependencies
433+
uses: input-output-hk/actions/base@latest
434+
with:
435+
use-sodium-vrf: false # default is true
436+
437+
- name: Install Haskell
438+
id: install-haskell
439+
uses: input-output-hk/actions/haskell@latest
440+
with:
441+
ghc-version: ${{ env.ghc-version }}
442+
cabal-version: 3.14
443+
444+
# Retrieve working directory from build jobs
445+
- name: Download working directory archive
446+
uses: actions/download-artifact@v4
447+
with:
448+
name: state-${{ env.ghc-version }}-${{ env.os }}
449+
450+
- name: Unarchive working directory
451+
run: tar -xf state.tzst --use-compress-program unzstd && rm state.tzst
452+
453+
- name: Cabal update
454+
run: cabal update
455+
456+
# A dependencies.txt file should have been created by the build job, so we
457+
# check if it exists and is not empty.
458+
- name: Check dependencies to be used as cache keys
459+
id: check-deps
460+
run: |
461+
./scripts/file-not-null.sh dependencies.txt
462+
463+
- name: Restore cache
464+
uses: actions/cache/restore@v4
465+
id: restore-cabal-cache
466+
env:
467+
cache-name: cache-cabal-build
468+
with:
469+
path: |
470+
${{ steps.install-haskell.outputs.cabal-store }}
471+
key: ${{ env.cache-name }}-${{ runner.os }}-${{ env.ghc-version }}-${{ env.CABAL_CACHE_VERSION }}-${{ hashFiles('dependencies.txt') }}-${{ hashFiles('cabal.project*') }}
472+
fail-on-cache-miss: true
473+
474+
- name: Run gen-cddl
475+
run: ./scripts/gen-cddl.sh
476+
393477
cabal-format:
394478
runs-on: ubuntu-latest
395479

0 commit comments

Comments
 (0)