Skip to content

ci: reduce disk usage of the Plinth GHC build #100

ci: reduce disk usage of the Plinth GHC build

ci: reduce disk usage of the Plinth GHC build #100

Workflow file for this run

name: CI
on:
pull_request:
types: [opened, synchronize]
push:
branches: [master, ghc-9.6-plinth]
workflow_dispatch:
jobs:
cabal:
name: ${{ matrix.os }} / ghc ${{ matrix.ghc }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest]
ghc: ['9.6.7']
steps:
- name: Free disk space
uses: jlumbroso/free-disk-space@main
with:
# frees ~6 GB; runs before haskell-actions/setup, which repopulates
# the tool cache afterwards, so it is safe to reclaim here.
tool-cache: true
# all of these default to true, but feel free to set to
# "false" if necessary for your workflow
android: true
dotnet: true
haskell: false
# left off: it is slow (~1-2 min) and the bulk of the build now lives
# on /mnt, so reclaiming large packages on / is not needed.
large-packages: false
docker-images: true
swap-storage: true
- uses: actions/checkout@v4
with:
submodules: false
# The runner's workspace disk (/) has ~21 GB free; the ephemeral disk at
# /mnt has ~70 GB. Build everything under _build on /mnt to avoid running
# out of space. Both plinth-build.sh and plinth-test.sh write under _build,
# so a single symlink redirects all build output. We also point TMPDIR at
# /mnt so GHC's (substantial) temp-file churn during compilation stays off
# the small / disk. TMPDIR is exported via GITHUB_ENV so later steps see it.
- name: Build on the large /mnt disk
run: |
sudo mkdir -p /mnt/_build /mnt/tmp
sudo chown "$USER" /mnt/_build /mnt/tmp
ln -s /mnt/_build "$GITHUB_WORKSPACE/_build"
echo "TMPDIR=/mnt/tmp" >> "$GITHUB_ENV"
- name: Setup SSH for submodules
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
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
- 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
# - name: Test uplc-ghc
# run: ./plinth-test.sh