Enable Dijkstra Twiddling tests, relax some decoders in PV12 #23605
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Haskell CI | |
| # If it's a scheduled (for us: nightly) build, set the name of this run to a static value, so we can identify it easier. | |
| # Otherwise, replicate the default run name: either the PR title if it exists, or the commit message otherwise. | |
| run-name: | | |
| ${{github.event_name == 'schedule' && 'Haskell CI - NIGHTLY' | |
| || github.event.pull_request.title == '' && github.event.head_commit.message | |
| || github.event.pull_request.title}} | |
| on: | |
| push: | |
| branches: [ "master", "release/**" ] | |
| pull_request: | |
| branches: [ "**" ] | |
| schedule: | |
| # "Nightly" builds: Every day at 06:00 UTC | |
| - cron: '0 6 * * *' | |
| # for running the workflow manually - useful for branches without PRs, for which jobs don't get ran automatically | |
| workflow_dispatch: | |
| inputs: | |
| nightly: | |
| description: Run with the same settings as a nightly build | |
| type: boolean | |
| default: false | |
| permissions: | |
| contents: read | |
| # Cancel running workflows when a new workflow on the same PR or branch is started, | |
| # but put scheduled workflows into their own group | |
| concurrency: | |
| group: ${{ | |
| format('{0}-{1}{2}', | |
| github.workflow, | |
| github.event.pull_request.number || github.ref, | |
| github.event_name == 'schedule' && '-scheduled' || '')}} | |
| cancel-in-progress: true | |
| defaults: | |
| run: | |
| shell: bash | |
| env: | |
| # Modify this value to "invalidate" the cabal cache. | |
| CABAL_CACHE_VERSION: "2024-09-23" | |
| # current ref from: 27.02.2022 | |
| SECP256K1_REF: ac83be33d0956faf6b7f61a60ab524ef7d6a473a | |
| SECP_CACHE_VERSION: "2022-12-30" | |
| jobs: | |
| build: | |
| strategy: | |
| matrix: | |
| ghc: ["9.6.7", "9.8.4", "9.10.3", "9.12.4", "9.14.1"] | |
| os: [ubuntu-latest] | |
| fail-fast: false | |
| runs-on: ${{ matrix.os }} | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - name: Free up disk space | |
| run: | | |
| # Remove software and language runtimes we're not using | |
| sudo rm -rf \ | |
| /opt/google/chrome \ | |
| /opt/microsoft/msedge \ | |
| /opt/microsoft/powershell \ | |
| /opt/pipx \ | |
| /usr/lib/mono \ | |
| /usr/local/julia* \ | |
| /usr/local/lib/android \ | |
| /usr/local/lib/node_modules \ | |
| /usr/local/share/chromium \ | |
| /usr/local/share/powershell \ | |
| /usr/share/dotnet \ | |
| /usr/share/swift | |
| df -h / | |
| - name: Install system dependencies | |
| uses: input-output-hk/actions/base@latest | |
| with: | |
| use-sodium-vrf: false # default is true | |
| - name: Install cleret | |
| # Tag should match the one that's used in flake.nix | |
| uses: input-output-hk/cardano-ledger-release-tool/actions/install-cleret@0.5.0.0 | |
| - name: Install Haskell | |
| id: install-haskell | |
| uses: input-output-hk/actions/haskell@latest | |
| with: | |
| ghc-version: ${{ matrix.ghc }} | |
| cabal-version: 3.16 | |
| - name: Configure to use libsodium | |
| run: | | |
| cat >> cabal.project.local <<EOF | |
| package cardano-crypto-praos | |
| flags: -external-libsodium-vrf | |
| EOF | |
| # Use this to debug "run canceled" build failures | |
| - name: Configure to limit the ghc heap size | |
| if: false | |
| run: | | |
| cat >> cabal.project.local <<EOF | |
| with-compiler: $PWD/scripts/ghc-limited | |
| with-hc-pkg: ghc-pkg | |
| EOF | |
| echo "GHC_HEAP_LIMIT=12" >> $GITHUB_ENV | |
| - name: Cabal update | |
| run: cabal update | |
| # We create a dependencies.txt file that can be used to index the cabal | |
| # store cache. | |
| # | |
| # We do not use plan.json directly because adding a dependency to our | |
| # Cabal files which was already present somewhere else would result in a | |
| # diferent plan, even though the set of dependencies is the same. | |
| - name: Record dependencies to be used as cache keys | |
| id: record-deps | |
| run: | | |
| cabal build all --enable-tests --dry-run --minimize-conflict-set | |
| cat dist-newstyle/cache/plan.json \ | |
| | jq '.["install-plan"][].id' \ | |
| | sort \ | |
| | uniq \ | |
| | tee dependencies.txt | |
| - name: Restore cache | |
| uses: actions/cache/restore@v5 | |
| id: restore-cabal-cache | |
| env: | |
| cache-name: cache-cabal-build | |
| with: | |
| path: | | |
| ${{ steps.install-haskell.outputs.cabal-store }} | |
| # A new cache is created upon a change to the cabal build plan, | |
| # cabal.project (and/or cabal.project.local), or a bump to | |
| # CABAL_CACHE_VERSION. | |
| key: ${{ env.cache-name }}-${{ runner.os }}-${{ matrix.ghc }}-${{ env.CABAL_CACHE_VERSION }}-${{ hashFiles('dependencies.txt') }}-${{ hashFiles('cabal.project*') }} | |
| # Restoring attempts are from current branch then master. The key above | |
| # is by default already a restore-key. | |
| restore-keys: | | |
| ${{ env.cache-name }}-${{ runner.os }}-${{ matrix.ghc }}-${{ env.CABAL_CACHE_VERSION }}-${{ hashFiles('dependencies.txt') }} | |
| ${{ env.cache-name }}-${{ runner.os }}-${{ matrix.ghc }}-${{ env.CABAL_CACHE_VERSION }}- | |
| - name: Check workflow test matrix | |
| run: cabal build all --dry-run -v0 && cleret workflow check-test-matrix | |
| - name: Build dependencies | |
| id: build-dependencies | |
| run: cabal build all --only-dependencies | |
| # Save the cache of built dependencies early, so that it is available for | |
| # the next GHA run if the Build step fails. | |
| - name: Save cache | |
| uses: actions/cache/save@v5 | |
| id: save-cabal-cache | |
| # Note: cache-hit will be set to true only when cache hit occurs for the | |
| # exact key match. For a partial key match via restore-keys or a cache | |
| # miss, it will be set to false. | |
| if: steps.build-dependencies.outcome == 'success' && steps.restore-cabal-cache.outputs.cache-hit != 'true' | |
| with: | |
| path: ${{ steps.install-haskell.outputs.cabal-store }} | |
| key: ${{ steps.restore-cabal-cache.outputs.cache-primary-key }} | |
| # `doctest` needs to be present before building, to avoid `cabal repl` seeing a configuration | |
| # change when `scripts/doctest.sh` runs it | |
| - name: Install doctest | |
| id: install-doctest | |
| if: matrix.ghc == '9.6.7' | |
| run: | | |
| if [[ -z "$(type -t doctest)" ]] | |
| then | |
| cabal install doctest --ignore-project --overwrite-policy=always | |
| cabal path --installdir >> $GITHUB_PATH | |
| fi | |
| - name: Build | |
| run: cabal build all | |
| # Archive plan.json and local binaries | |
| - name: Create state archive | |
| if: matrix.ghc == '9.6.7' | |
| run: | | |
| cleret cabal relativize-plan | |
| cleret cabal list-bins -i test -i exe | | |
| xargs tar -caf state.tzst dist-newstyle/cache/plan.json | |
| - name: Upload state archive | |
| if: matrix.ghc == '9.6.7' | |
| uses: actions/upload-artifact@v7 | |
| with: | |
| name: state-${{ matrix.ghc }}-${{ matrix.os }} | |
| path: state.tzst | |
| overwrite: true | |
| retention-days: 1 | |
| - name: Run doctests | |
| if: ${{ steps.install-doctest.outcome == 'success' }} | |
| run: scripts/doctest.sh | |
| test: | |
| needs: build | |
| strategy: | |
| matrix: | |
| package: | |
| - byron-spec-chain | |
| - byron-spec-ledger | |
| - cardano-crypto-wrapper | |
| - cardano-data | |
| - cardano-ledger-allegra | |
| - cardano-ledger-alonzo | |
| - cardano-ledger-alonzo-test | |
| - cardano-ledger-api | |
| - cardano-ledger-babbage | |
| - cardano-ledger-binary | |
| - cardano-ledger-byron | |
| - cardano-ledger-canonical-state | |
| - cardano-ledger-conformance | |
| - cardano-ledger-conway | |
| - cardano-ledger-core | |
| - cardano-ledger-dijkstra | |
| - cardano-ledger-mary | |
| - cardano-ledger-shelley | |
| - cardano-ledger-shelley-ma-test | |
| - cardano-ledger-shelley-test | |
| - cardano-ledger-test | |
| - cardano-protocol-tpraos | |
| - non-integral | |
| - small-steps | |
| - vector-map | |
| ghc: ["9.6.7"] | |
| os: [ubuntu-latest] | |
| fail-fast: false | |
| runs-on: ${{ matrix.os }} | |
| name: ${{ matrix.package }}-${{ matrix.ghc }}-${{ matrix.os }} | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - name: Install system dependencies | |
| uses: input-output-hk/actions/base@latest | |
| with: | |
| use-sodium-vrf: false # default is true | |
| - name: Install cleret | |
| # Tag should match the one that's used in flake.nix | |
| uses: input-output-hk/cardano-ledger-release-tool/actions/install-cleret@0.5.0.0 | |
| - name: Download Mainnet Mirror | |
| if: matrix.package == 'cardano-ledger-byron' | |
| run: | | |
| REF=a31ac75 | |
| { | |
| curl -L https://github.com/input-output-hk/cardano-mainnet-mirror/tarball/$REF -o mainnet-mirror.tgz | |
| tar -xzf mainnet-mirror.tgz | |
| mv input-output-hk-cardano-mainnet-mirror-$REF/epochs . | |
| } || | |
| { | |
| git clone https://github.com/input-output-hk/cardano-mainnet-mirror | |
| cd cardano-mainnet-mirror | |
| git checkout $REF | |
| mv epochs .. | |
| cd .. | |
| } | |
| echo CARDANO_MAINNET_MIRROR=$PWD/epochs >> $GITHUB_ENV | |
| - name: Set NIGHTLY environment variable if the job was triggered by the scheduler | |
| if: "${{ github.event_name == 'schedule' | |
| || contains(github.event.pull_request.title, 'nightly') | |
| || github.event_name == 'workflow_dispatch' && inputs.nightly }}" | |
| run: | | |
| echo "NIGHTLY=true" >> $GITHUB_ENV | |
| - name: Download state archive | |
| uses: actions/download-artifact@v8 | |
| with: | |
| name: state-${{ matrix.ghc }}-${{ matrix.os }} | |
| - name: Unarchive state | |
| run: tar -xf state.tzst && rm state.tzst | |
| - name: Run tests | |
| run: cleret cabal test '${{ matrix.package }}' | |
| - name: Record test failures | |
| if: failure() | |
| run: cleret failures extract -v -o failures.json | |
| - name: Upload test failures artifact | |
| if: failure() | |
| uses: actions/upload-artifact@v7 | |
| with: | |
| name: failures-${{ matrix.package }}-${{ matrix.ghc }}-${{ matrix.os }} | |
| path: failures.json | |
| test-summary: | |
| name: Summarize test failures | |
| runs-on: ubuntu-latest | |
| needs: test | |
| if: failure() && needs.test.result == 'failure' | |
| steps: | |
| - name: Install cleret | |
| # Tag should match the one that's used in flake.nix | |
| uses: input-output-hk/cardano-ledger-release-tool/actions/install-cleret@0.5.0.0 | |
| - name: Download test failures artifacts | |
| uses: actions/download-artifact@v8 | |
| with: | |
| pattern: failures-* | |
| path: failures | |
| - name: Generate summary | |
| run: cleret failures render $(find failures -name failures.json) -o "$GITHUB_STEP_SUMMARY" | |
| complete: | |
| name: Tests completed | |
| runs-on: ubuntu-latest | |
| needs: test | |
| if: always() | |
| steps: | |
| - run: | | |
| case ${{ needs.test.result }} in | |
| success) | |
| echo 'All tests completed successfully' | |
| true;; | |
| failure) | |
| echo 'Some tests failed' | |
| false;; | |
| *) | |
| echo 'Tests were ${{ needs.test.result }}' | |
| false;; | |
| esac | |
| codegen: | |
| needs: build | |
| runs-on: ubuntu-latest | |
| env: | |
| ghc-version: "9.6.7" | |
| os: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - name: Install system dependencies | |
| uses: input-output-hk/actions/base@latest | |
| with: | |
| use-sodium-vrf: false # default is true | |
| - name: Install cleret | |
| # Tag should match the one that's used in flake.nix | |
| uses: input-output-hk/cardano-ledger-release-tool/actions/install-cleret@0.5.0.0 | |
| - name: Download state archive | |
| uses: actions/download-artifact@v8 | |
| with: | |
| name: state-${{ env.ghc-version }}-${{ env.os }} | |
| - name: Unarchive state | |
| run: tar -xf state.tzst && rm state.tzst | |
| - name: Generate CDDL files | |
| run: | | |
| # Run all the `generate-cddl` executables in the project | |
| cleret cabal run generate-cddl | |
| git diff --exit-code | |
| - name: Generate Plutus examples | |
| run: | | |
| # Run all the `plutus-preprocessor` executables in the project | |
| cleret cabal run plutus-preprocessor | |
| git diff --exit-code | |
| fourmolu: | |
| runs-on: ubuntu-latest | |
| strategy: | |
| fail-fast: false | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - name: Install fourmolu | |
| uses: ./.github/actions/install-binary | |
| with: | |
| repo: fourmolu/fourmolu | |
| release: v0.17.0.0 # Should match `fourmoluVersion` in flake.nix | |
| pattern: '*-linux-x86_64' | |
| name: fourmolu | |
| - name: Run fourmolu | |
| run: ./scripts/fourmolize.sh | |
| shellcheck: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - name: Install shellcheck | |
| uses: ./.github/actions/install-binary | |
| with: | |
| repo: koalaman/shellcheck | |
| release: v0.10.0 | |
| pattern: '*.linux.x86_64.tar.xz' | |
| - name: Run shellcheck | |
| run: scripts/shellcheck.sh | |
| nix-formatter: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - name: Install nix formatter | |
| uses: ./.github/actions/install-binary | |
| with: | |
| repo: NixOS/nixfmt | |
| release: v0.6.0 # Should match `nixfmtVersion` in flake.nix | |
| name: 'nixfmt' | |
| - name: Run nix formatter | |
| run: scripts/nix-format.sh | |
| cabal-format: | |
| runs-on: ubuntu-latest | |
| strategy: | |
| fail-fast: false | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - uses: tfausak/cabal-gild-setup-action@v2 | |
| with: | |
| version: 1.5.0.1 # Should match `cabalGildVersion` in flake.nix | |
| - name: Format all cabal files | |
| run: ./scripts/cabal-format.sh check | |
| gen-hie: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Set up installation directory | |
| run: | | |
| BINDIR=$HOME/.local/bin | |
| echo "bindir=$BINDIR" >> "$GITHUB_ENV" | |
| echo "$BINDIR" >> "$GITHUB_PATH" | |
| - name: Cache implicit-hie executable (gen-hie) | |
| id: cache-gen-hie | |
| uses: actions/cache@v5 | |
| with: | |
| path: ${{ env.bindir }}/gen-hie | |
| key: ${{ runner.os }}-cache-gen-hie | |
| - name: Install Haskell | |
| if: steps.cache-gen-hie.outputs.cache-hit != 'true' | |
| id: install-haskell | |
| uses: input-output-hk/actions/haskell@latest | |
| with: | |
| ghc-version: 9.10.1 | |
| cabal-version: 3.16 | |
| - name: Install gen-hie | |
| if: steps.cache-gen-hie.outputs.cache-hit != 'true' | |
| run: | | |
| cabal update | |
| cabal install implicit-hie \ | |
| --installdir=${{ env.bindir }} --install-method=copy --overwrite-policy=always | |
| - uses: actions/checkout@v6 | |
| - name: Regenerate hie.yaml and confirm that it is in sync | |
| run: ./scripts/gen-hie.sh | |
| branch-history: | |
| name: Check branch history | |
| runs-on: ubuntu-latest | |
| if: ${{ github.base_ref != '' && github.ref != '' }} # Only true for PRs | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - name: Ensure the branch doesn't contain any merges | |
| run: | | |
| PR_TARGET=${{ github.base_ref }} | |
| PR_MERGE=${{ github.ref }} | |
| PR_HEAD=${PR_MERGE%/merge}/head | |
| git fetch origin -n --refmap= +$PR_TARGET:pr-target +$PR_HEAD:pr-head | |
| if git log --merges --oneline --decorate pr-target..pr-head | grep .; then | |
| echo 'Branch must not contain merges' | |
| false | |
| fi | |
| notify-nightly-failure: | |
| name: Send a slack notification on \#ledger-internal if the nightly build failed | |
| runs-on: ubuntu-latest | |
| needs: | |
| - test | |
| if: always() && github.event_name == 'schedule' && needs.test.result == 'failure' | |
| steps: | |
| - name: Send slack notification | |
| id: slack | |
| uses: slackapi/slack-github-action@v3.0.3 | |
| with: | |
| webhook: ${{ secrets.SLACK_WEBHOOK_URL }} | |
| webhook-type: incoming-webhook | |
| payload: | | |
| { | |
| "blocks": [ | |
| { | |
| "type": "section", | |
| "text": { | |
| "type": "mrkdwn", | |
| "text": "Nightly Github Actions build failed: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}" | |
| } | |
| } | |
| ] | |
| } | |
| SRP-validity: | |
| name: Check if formal-ledger-specifications SRP is valid | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - name: Check formal-ledger-specifications SRP commit hash | |
| run: | | |
| TAG=$(sed -ne \ | |
| '/ *location: *https:\/\/github.com\/IntersectMBO\/formal-ledger-specifications.git/,/tag:/ p' \ | |
| cabal.project \ | |
| | sed -ne 's/^ *tag: *//p') | |
| if [ -z "$TAG" ]; then | |
| echo "Error: IntersectMBO/formal-ledger-specifications SRP tag not found." | |
| exit 1 | |
| fi | |
| git fetch https://github.com/intersectmbo/formal-ledger-specifications.git master-artifacts | |
| git show -s "$TAG" || { \ | |
| echo "Commit $TAG was not found on the master-artifacts branch of formal-ledger-specifications." | |
| exit 1 | |
| } | |
| undefined-check: | |
| name: Check that there are no additions of `undefined`s in the PR diff | |
| runs-on: ubuntu-latest | |
| if: ${{ github.base_ref != '' && github.ref != '' }} # Only true for PRs | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - name: Check for `undefined`s in the diffs | |
| run: | | |
| PR_TARGET=${{ github.base_ref }} | |
| git fetch origin -n --refmap= +$PR_TARGET:pr-target | |
| if git diff -U0 pr-target '*.hs' | | |
| awk ' | |
| /^\+\+\+/ { sub(/^b\//, "", $2); FILE = $2; } | |
| /^\+.*undefined/ { printf "%s: %s\n", FILE, $0; FOUND=1; } | |
| END { exit !FOUND; } | |
| '; then | |
| echo 'The diff must not contain any `undefined` values' | |
| false | |
| fi | |
| changelog-lint: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - name: Install cleret | |
| # Tag should match the one that's used in flake.nix | |
| uses: input-output-hk/cardano-ledger-release-tool/actions/install-cleret@0.5.0.0 | |
| - name: Run linter | |
| run: scripts/format-changelogs.sh || (git diff; false) | |
| - name: Check if changelogs need a bump | |
| if: ${{ !startsWith(github.base_ref, 'release/') && !startsWith(github.ref, 'refs/heads/release/') }} | |
| run: scripts/bump-changelogs.sh || (git diff; false) |