Skip to content

Refactor package structure #613

Refactor package structure

Refactor package structure #613

Workflow file for this run

name: Haskell CI
on:
pull_request:
merge_group:
jobs:
build:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
ghc: ["8.10", "9.2", "9.4", "9.6", "9.8", "9.10"]
os: [ubuntu-latest, macos-latest, windows-latest]
defaults:
run:
shell: 'bash'
steps:
- name: Set cache version
run: echo "CACHE_VERSION=pu4Aevoo_v1" >> $GITHUB_ENV
- name: "Setup Haskell"
uses: haskell-actions/setup@v2
id: setup-haskell
with:
ghc-version: ${{ matrix.ghc }}
cabal-version: "3.10.3.0"
- name: Install LLVM (macOS)
if: runner.os == 'macOS'
run: |
brew install llvm@13
echo "LLVM_CONFIG=$(brew --prefix llvm@13)/bin/llvm-config" >> $GITHUB_ENV
echo "$(brew --prefix llvm@13)/bin" >> $GITHUB_PATH
- name: Verify LLVM installation
if: runner.os == 'macOS'
run: |
llvm-config --version
opt --version
- name: Print environment variables
if: runner.os == 'macOS'
run: |
echo "PATH = $PATH"
echo "LLVM_CONFIG = $LLVM_CONFIG"
- uses: actions/checkout@v4
- name: "Configure cabal.project.local"
run: |
cat ./.github/workflows/cabal.project.local > ./cabal.project.local
cat ./cabal.project.local
- name: "Cabal update"
run: cabal update
- name: Record dependencies
id: record-deps
run: |
cabal build all --dry-run
cat dist-newstyle/cache/plan.json | jq -r '."install-plan"[].id' | sort | uniq > dependencies.txt
echo "weeknum=$(/bin/date -u "+%W")" >> $GITHUB_OUTPUT
- uses: actions/cache/restore@v4
name: "Restore cabal store"
with:
path: ${{ runner.os == 'Windows' && steps.win-setup-haskell.outputs.cabal-store || steps.setup-haskell.outputs.cabal-store }}
key: cache-dependencies-${{ env.CACHE_VERSION }}-${{ runner.os }}-${{ matrix.ghc }}-${{ hashFiles('dependencies.txt') }}
restore-keys: cache-dependencies-${{ env.CACHE_VERSION }}-${{ runner.os }}-${{ matrix.ghc }}
enableCrossOsArchive: true
- uses: actions/cache@v4
name: "Cache `dist-newstyle`"
with:
path: |
dist-newstyle
!dist-newstyle/**/.git
key: cache-dist-${{ env.CACHE_VERSION }}-${{ runner.os }}-${{ matrix.ghc }}-${{ steps.record-deps.outputs.weeknum }}
restore-keys: cache-dist-${{ env.CACHE_VERSION }}-${{ runner.os }}-${{ matrix.ghc }}
enableCrossOsArchive: true
- name: Build dependencies
run: |
cabal build --only-dependencies io-classes
cabal build --only-dependencies io-sim
cabal build --only-dependencies test-strict-mvar
- uses: actions/cache/save@v4
name: "Save cabal store"
with:
path: ${{ runner.os == 'Windows' && steps.win-setup-haskell.outputs.cabal-store || steps.setup-haskell.outputs.cabal-store }}
key: cache-dependencies-${{ env.CACHE_VERSION }}-${{ runner.os }}-${{ matrix.ghc }}-${{ hashFiles('dependencies.txt') }}
enableCrossOsArchive: true
- name: Build projects [build]
run: cabal build all
- name: Build documentation [haddock]
run: cabal haddock all
- name: io-sim [test]
run: cabal run io-sim:test
- name: io-classes:si-timers [test]
run: cabal run io-classes:test-si-timers
- name: test-strict-mvar [test]
run: cabal run test-strict-mvar