Run plinth-test in its own CI job consuming a bindist #112
Workflow file for this run
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: CI | |
| on: | |
| pull_request: | |
| types: [opened, synchronize] | |
| push: | |
| branches: [master, ghc-9.6-plinth] | |
| workflow_dispatch: | |
| jobs: | |
| plinth-build-linux: | |
| name: plinth-build / ${{ matrix.os }} / ghc ${{ matrix.ghc }} | |
| runs-on: ${{ matrix.os }} | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| os: [ubuntu-latest] | |
| ghc: ['9.6.7'] | |
| steps: | |
| # checkout first: the local composite action (.github/actions/prepare) must | |
| # be on disk before the runner can resolve it. | |
| - uses: actions/checkout@v4 | |
| with: | |
| submodules: false | |
| - uses: ./.github/actions/prepare | |
| with: | |
| ghc-version: ${{ matrix.ghc }} | |
| submodule-ssh-key: ${{ secrets.SUBMODULE_SSH_KEY }} | |
| # BINDIST=1 produces the fixed-up uplc-ghc bindist (+ .tar.xz archive) while | |
| # keeping the lean dev flavour. The plinth-test job consumes that archive. | |
| - name: Build uplc-ghc bindist | |
| run: BINDIST=1 ./plinth-build.sh | |
| - name: Upload uplc-ghc bindist | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| # key by platform + GHC so multiple build matrix legs (or another job) | |
| # never collide on the artifact name within a single run. See the | |
| # matching download in the plinth-test job, which shares this matrix. | |
| name: plinth-bindist-${{ matrix.os }}-${{ matrix.ghc }} | |
| path: _build/bindist/*.tar.xz | |
| retention-days: 1 | |
| # the archive is already xz-compressed; don't re-zip it | |
| compression-level: 0 | |
| # plinth-test runs in its own job for a separate status check and timeout | |
| # budget. It depends on `plinth-build-linux` (it can't run in parallel: it | |
| # needs the built compiler), downloading the bindist archive instead of | |
| # rebuilding GHC. Its matrix mirrors the build so the artifact-name key | |
| # matches per leg. | |
| plinth-test-linux: | |
| name: plinth-test / ${{ matrix.os }} / ghc ${{ matrix.ghc }} | |
| needs: plinth-build-linux | |
| runs-on: ${{ matrix.os }} | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| os: [ubuntu-latest] | |
| ghc: ['9.6.7'] | |
| steps: | |
| # checkout first: the local composite action (.github/actions/prepare) must | |
| # be on disk before the runner can resolve it. The prepare action also | |
| # fetches submodules, which the test needs: plinth/test/cabal.project pulls | |
| # plutus-tx/plutus-core/plutus-ledger-api from the plutus submodule. | |
| - uses: actions/checkout@v4 | |
| with: | |
| submodules: false | |
| - uses: ./.github/actions/prepare | |
| with: | |
| ghc-version: ${{ matrix.ghc }} | |
| submodule-ssh-key: ${{ secrets.SUBMODULE_SSH_KEY }} | |
| - name: Download uplc-ghc bindist | |
| uses: actions/download-artifact@v4 | |
| with: | |
| # matches the plinth-build upload name; both jobs share the same matrix. | |
| name: plinth-bindist-${{ matrix.os }}-${{ matrix.ghc }} | |
| path: _build/artifact | |
| # Install the bindist with the usual configure + make install; the bindist's | |
| # wrappers/ dir (added by the BINDIST fixup) makes this produce bin/uplc-ghc. | |
| # Each step is guarded so a missing artifact or failed install fails loudly | |
| # here, not with a confusing error deep in the test. | |
| - name: Install uplc-ghc bindist | |
| run: | | |
| shopt -s nullglob | |
| archives=(_build/artifact/*.tar.xz) | |
| if [ ${#archives[@]} -ne 1 ]; then | |
| echo "error: expected exactly one bindist archive, found: ${archives[*]:-none}" | |
| exit 1 | |
| fi | |
| mkdir -p _build/bindist | |
| echo "extracting ${archives[0]}" | |
| tar --xz -xf "${archives[0]}" -C _build/bindist | |
| bindirs=(_build/bindist/ghc-*) | |
| if [ ${#bindirs[@]} -ne 1 ]; then | |
| echo "error: expected one extracted bindist dir, found: ${bindirs[*]:-none}" | |
| exit 1 | |
| fi | |
| ( cd "${bindirs[0]}" && ./configure --prefix="$GITHUB_WORKSPACE/_build/install" && make install ) | |
| uplc="$GITHUB_WORKSPACE/_build/install/bin/uplc-ghc" | |
| if [ ! -x "$uplc" ]; then | |
| echo "error: $uplc missing or not executable after make install" | |
| ls -l "$GITHUB_WORKSPACE/_build/install/bin" || true | |
| exit 1 | |
| fi | |
| rm -rf _build/artifact | |
| - name: Test uplc-ghc | |
| run: GHC="$GITHUB_WORKSPACE/_build/install/bin/uplc-ghc" ./plinth-test.sh | |
| plinth-build-windows: | |
| name: plinth-build / windows-latest / ghc ${{ matrix.ghc }} | |
| runs-on: windows-latest | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| ghc: ['9.6.7'] | |
| defaults: | |
| run: | |
| shell: msys2 {0} | |
| steps: | |
| # Git on Windows defaults to not creating symlinks; the submodules and | |
| # bindist rely on them, so enable symlink support before checkout. | |
| - name: Configure git for Windows | |
| shell: bash | |
| run: git config --global core.symlinks true | |
| - uses: actions/checkout@v4 | |
| with: | |
| submodules: false | |
| # The pre-MSYS2 steps run in the default Git-for-Windows bash because the | |
| # MSYS2 environment is not set up yet. | |
| - name: Setup SSH for submodules | |
| shell: bash | |
| run: | | |
| mkdir -p ~/.ssh | |
| echo "${{ secrets.SUBMODULE_SSH_KEY }}" > ~/.ssh/id_rsa | |
| chmod 600 ~/.ssh/id_rsa | |
| ssh-keyscan github.com >> ~/.ssh/known_hosts | |
| - name: Init and update submodules | |
| shell: bash | |
| run: | | |
| git submodule sync | |
| # Shallow (single-commit) submodule clones: the build never needs | |
| # submodule history, and these 29 submodules (notably plutus) carry a | |
| # lot of it. --jobs fetches them in parallel. GitHub allows fetching | |
| # the pinned SHA directly, so depth 1 works even when it isn't a | |
| # branch tip. | |
| git submodule update --init --recursive --depth 1 --jobs 4 | |
| # MINGW64 toolchain + the autotools/python/sphinx needed by the build. | |
| # path-type: inherit keeps the Windows PATH (incl. the GHC/cabal installed | |
| # below) visible inside the MSYS2 shell. | |
| - name: Setup MSYS2 | |
| uses: msys2/setup-msys2@v2 | |
| with: | |
| msystem: MINGW64 | |
| path-type: inherit | |
| update: false | |
| install: >- | |
| autoconf automake make tar xz patch curl | |
| mingw-w64-x86_64-python mingw-w64-x86_64-python-sphinx | |
| - uses: haskell-actions/setup@v2 | |
| id: setup | |
| name: Setup Haskell tools | |
| with: | |
| ghc-version: ${{ matrix.ghc }} | |
| cabal-version: "latest" | |
| cabal-update: true | |
| - name: Build uplc-ghc | |
| run: ./plinth-build.sh |