Try in CI #64
This file contains 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 | |
# Trigger the workflow on push or pull request, but only for the master branch | |
on: | |
pull_request: | |
types: | |
- opened | |
- synchronize | |
push: | |
branches: | |
- master | |
- andrea/make-build | |
jobs: | |
cabal: | |
name: ${{ matrix.os }} / ghc ${{ matrix.ghc }} | |
runs-on: ${{ matrix.os }} | |
strategy: | |
fail-fast: false | |
matrix: | |
os: [ubuntu-latest] | |
ghc: ['9.8.4'] # bootstrapping compiler | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
submodules: "recursive" | |
- uses: haskell/ghcup-setup@v1 | |
- id: ghcup | |
run: | | |
ghcup config set cache true | |
echo "basedir=$(ghcup whereis basedir)" >> $GITHUB_OUTPUT | |
- id: ghcup-cache | |
name: Cache GHCup basedir | |
uses: actions/cache@v4 | |
with: | |
key: ghcup-basedir-${{ github.run_id }} | |
restore-keys: ghcup-basedir- | |
path: ${{ steps.ghcup.outputs.basedir }} | |
- run: | | |
ghcup install ghc --set ${{ matrix.ghc }} | |
ghcup install cabal --set | |
- id: cabal-paths | |
run: | | |
cabal user-config init | |
echo "store=$(cabal path --store-dir)" >> $GITHUB_OUTPUT | |
echo "remote-repo-cache=$(cabal path --remote-repo-cache)" >> $GITHUB_OUTPUT | |
- name: Restore Hackage index | |
uses: actions/cache/restore@v4 | |
with: | |
key: hackage-${{ github.run_id }} | |
restore-keys: hackage- | |
path: ${{ steps.cabal-paths.outputs.remote-repo-cache }} | |
- run: cabal update | |
- name: Restore build artifacts | |
uses: actions/cache/restore@v4 | |
with: | |
key: ${{ matrix.os }}-${{ matrix.ghc }}-${{ github.run_id }} | |
restore-keys: ${{ matrix.os }}-${{ matrix.ghc }}- | |
path: | | |
${{ steps.cabal-paths.outputs.store }} | |
dist-newstyle | |
- name: Build patched cabal | |
run: | | |
cabal build --project-dir libraries/Cabal cabal-install:exe:cabal | |
CABAL=$(cabal list-bin -v0 --project-dir libraries/Cabal cabal-install:exe:cabal) | |
echo "CABAL=${CABAL}" >> $GITHUB_ENV | |
- name: Build stage1 | |
run: ${CABAL} build --project-file cabal.project.stage0 ghc-bin:exe:ghc | |
- name: Save GHCup cache | |
uses: actions/cache/save@v4 | |
if: always() | |
with: | |
key: ghcup-${{ github.run_id }} | |
path: ${{ steps.ghcup.outputs.cachedir }} | |
- name: Save Hackage index | |
uses: actions/cache/save@v4 | |
if: always() | |
with: | |
key: hackage-${{ github.run_id }} | |
path: ${{ steps.cabal-paths.outputs.remote-repo-cache }} | |
- name: Save build artifacts | |
if: always() | |
uses: actions/cache/save@v4 | |
with: | |
key: ${{ matrix.os }}-${{ matrix.ghc }}-${{ github.run_id }} | |
path: | | |
${{ steps.cabal-paths.outputs.store }} | |
dist-newstyle |