name: Haskell CI on: pull_request: merge_group: jobs: build: runs-on: ${{ matrix.os }} defaults: run: shell: bash strategy: fail-fast: false matrix: ghc: ["8.10", "9.0", "9.2", "9.4", "9.6", "9.8", "9.10"] os: [ubuntu-latest] steps: - name: Install Haskell uses: haskell-actions/setup@v2 id: setup-haskell with: ghc-version: ${{ matrix.ghc }} cabal-version: 3.8.1.0 - name: Select build directory run: | if [ "$RUNNER_OS" == Windows ]; then CABAL_BUILDDIR="D:\\a\\_temp\\dist" else CABAL_BUILDDIR="dist-newstyle" fi echo "CABAL_BUILDDIR=$CABAL_BUILDDIR" echo "CABAL_BUILDDIR=$CABAL_BUILDDIR" >> $GITHUB_ENV - name: Set cache version run: echo "CACHE_VERSION=9w76Z3Q" >> $GITHUB_ENV - name: Set up temp directory env: RUNNER_TEMP: ${{ runner.temp }} run: | echo "TMPDIR=$RUNNER_TEMP" >> $GITHUB_ENV echo "TMP=$RUNNER_TEMP" >> $GITHUB_ENV - uses: actions/checkout@v4 - 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 - name: Cache `cabal store` uses: actions/cache@v4 with: path: ${{ steps.setup-haskell.outputs.cabal-store }} key: cabal-store-${{ env.CACHE_VERSION }}-${{ runner.os }}-${{ matrix.ghc }}-${{ hashFiles('dependencies.txt') }} restore-keys: cabal-store-${{ env.CACHE_VERSION }}-${{ runner.os }}-${{ matrix.ghc }} - name: Cache `dist-newstyle` uses: actions/cache@v4 with: path: | dist-newstyle !dist-newstyle/**/.git key: cache-dist-${{ env.CACHE_VERSION }}-${{ runner.os }}-${{ matrix.ghc }} - name: Use cabal.project.local run: | cat .github/workflows/cabal.project.local >> ./cabal.project.local cat ./cabal.project.local - name: Build dependencies run: cabal --builddir="$CABAL_BUILDDIR" build --only-dependencies all - name: Build projects [build] run: cabal --builddir="$CABAL_BUILDDIR" build all - name: free-category [test] run: cabal --builddir="$CABAL_BUILDDIR" run free-category:test-cats - name: free-category [benchmarks] run: cabal build free-category:benchmarks