Skip to content

Andreas make-build changes #17

Andreas make-build changes

Andreas make-build changes #17

name: CI mostly cabal-install
# Trigger the workflow on push or pull request, but only for the master branch
on:
pull_request:
types:
- opened
- synchronize
push:
branches:
- master
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"
- id: cache-ghc
name: Restore bootstrap compiler
uses: actions/cache/restore@v4
with:
key: ${{ matrix.os }}-ghc-${{ matrix.ghc }}
path: ${{ github.workspace }}/ghc-${{ matrix.ghc }}
- if: steps.cache-ghc.outputs.cache-hit != 'true'
uses: haskell/ghcup-setup@v1
- if: steps.cache-ghc.outputs.cache-hit != 'true'
run: |
GHC_PATH=${{ github.workspace }}/ghc-${{ matrix.ghc }}
ghcup install ghc ${{ matrix.ghc }} --isolate "$GHC_PATH"
ghcup install cabal latest --isolate "$GHC_PATH/bin"
echo "$GHC_PATH/bin" >> $GITHUB_PATH
- 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 and source packages
uses: actions/cache/restore@v4
with:
key: hackage-${{ github.run_id }}
restore-keys: hackage-
path: ${{ steps.cabal-paths.outputs.remote-repo-cache }}
- name: Restore cabal store
uses: actions/cache/restore@v4
with:
key: store-${{ matrix.os }}-${{ matrix.ghc }}-${{ github.run_id }}
restore-keys: store-${{ matrix.os }}-${{ matrix.ghc }}-
path: ${{ steps.cabal-paths.outputs.store }}
- name: Restore build artifacts
uses: actions/cache/restore@v4
with:
key: build-${{ matrix.os }}-${{ matrix.ghc }}-${{ github.run_id }}
restore-keys: build-${{ matrix.os }}-${{ matrix.ghc }}-
path: _build _stage0 _stage1
- name: Update Hackage index
run: cabal update
- name: Install mise
run: ./bin/mise install
- name: Build stage1
run: ./bin/mise run stage1
- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: stage1
path: _stage1
- name: Save build artifacts
uses: actions/cache/save@v4
if: always()
with:
key: build-${{ matrix.os }}-${{ matrix.ghc }}-${{ github.run_id }}
path: _build _stage0 _stage1
- name: Save cabal store
uses: actions/cache/save@v4
if: always()
with:
key: store-${{ matrix.os }}-${{ matrix.ghc }}-${{ github.run_id }}
path: ${{ steps.cabal-paths.outputs.store }}
- name: Save Hackage index and source packages
uses: actions/cache/save@v4
if: always()
with:
key: hackage-${{ github.run_id }}
path: ${{ steps.cabal-paths.outputs.remote-repo-cache }}
- name: Restore bootstrap compiler
uses: actions/cache/save@v4
if: steps.cache-ghc.outputs.cache-hit != 'true'
with:
key: ${{ matrix.os }}-ghc-${{ matrix.ghc }}
path: ${{ github.workspace }}/ghc-${{ matrix.ghc }}