From fc71167f5105817ae67d40e704f8a4296d17511f Mon Sep 17 00:00:00 2001 From: Richard Marko Date: Sun, 12 Nov 2023 10:59:24 +0100 Subject: [PATCH] Update CI --- .github/workflows/ci.dhall | 18 ++------ .github/workflows/ci.sh | 10 +++-- .github/workflows/ci.yaml | 87 +++++++++++++++++++++----------------- 3 files changed, 59 insertions(+), 56 deletions(-) diff --git a/.github/workflows/ci.dhall b/.github/workflows/ci.dhall index f6d57ef..2b7a346 100644 --- a/.github/workflows/ci.dhall +++ b/.github/workflows/ci.dhall @@ -1,17 +1,7 @@ -let haskellCi = https://raw.githubusercontent.com/sorki/github-actions-dhall/pending/haskell-ci.dhall +let haskellCi = + https://raw.githubusercontent.com/sorki/github-actions-dhall/main/haskell-ci.dhall in haskellCi.generalCi - haskellCi.matrixSteps - ( Some - { ghc = - [ haskellCi.GHC.GHC947 - , haskellCi.GHC.GHC902 - , haskellCi.GHC.GHC8107 - ] - , cabal = [ haskellCi.Cabal.Cabal310 ] - } - ) - // { on = [ haskellCi.Event.push - , haskellCi.Event.pull_request ] - } + (haskellCi.withHlint haskellCi.defaultCabalSteps) + (haskellCi.DhallMatrix::{=} with ghc = haskellCi.defaultGHC3) : haskellCi.CI.Type diff --git a/.github/workflows/ci.sh b/.github/workflows/ci.sh index 03fa862..3371b96 100755 --- a/.github/workflows/ci.sh +++ b/.github/workflows/ci.sh @@ -1,10 +1,12 @@ #!/usr/bin/env bash +# Script by @fisx set -eo pipefail + +# cd into the dir where this script is placed cd "$( dirname "${BASH_SOURCE[0]}" )" -echo "regenerating .github/workflows/ci.yaml..." +echo "regenerating .github/workflows/ci.yaml" -# based on https://github.com/vmchale/github-actions-dhall -which dhall-to-yaml || cabal install dhall-yaml -dhall-to-yaml --file ci.dhall > ci.yaml +which dhall-to-yaml-ng || cabal install dhall-yaml +dhall-to-yaml-ng --generated-comment --file ci.dhall > ci.yaml diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index ae6467e..6a4310e 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -1,46 +1,57 @@ +# Code generated by dhall-to-yaml. DO NOT EDIT. jobs: build: - runs-on: ubuntu-latest + name: "GHC ${{ matrix.ghc }}, Cabal ${{ matrix.cabal }}, OS ${{ matrix.os }}" + "runs-on": "${{ matrix.os }}" steps: - - uses: "actions/checkout@v3" - - id: setup-haskell-cabal - uses: "haskell-actions/setup@v2" - with: - cabal-version: "${{ matrix.cabal }}" - enable-stack: false - ghc-version: "${{ matrix.ghc }}" - - name: Update Hackage repository - run: cabal update - - name: cabal.project.local.ci - run: | - if [ -e cabal.project.local.ci ]; then - cp cabal.project.local.ci cabal.project.local - fi - - name: freeze - run: cabal freeze --enable-tests --enable-benchmarks - - uses: "actions/cache@v3" - with: - key: "${{ runner.os }}-${{ matrix.ghc }}-cabal-${{ hashFiles('cabal.project.freeze') }}" - path: | - ${{ steps.setup-haskell-cabal.outputs.cabal-store }} - dist-newstyle - - name: Install dependencies - run: cabal build all --enable-tests --enable-benchmarks --only-dependencies - - name: build all - run: cabal build all --enable-tests --enable-benchmarks - - name: test all - run: cabal test all --enable-tests - - name: haddock all - run: cabal haddock all + - uses: "actions/checkout@v4" + with: + submodules: recursive + - id: "setup-haskell-cabal" + uses: "haskell-actions/setup@v2" + with: + "cabal-version": "${{ matrix.cabal }}" + "ghc-version": "${{ matrix.ghc }}" + - name: Update Hackage repository + run: cabal update + - name: cabal.project.local.ci + run: | + if [ -e cabal.project.local.ci ]; then + cp cabal.project.local.ci cabal.project.local + fi + - name: freeze + run: "cabal freeze --enable-tests --enable-benchmarks" + - uses: "actions/cache@v3" + with: + key: "${{ matrix.os }}-${{ matrix.ghc }}-${{ matrix.cabal}}-${{ hashFiles('cabal.project.freeze') }}" + path: | + ${{ steps.setup-haskell-cabal.outputs.cabal-store }} + dist-newstyle + - name: Install dependencies + run: "cabal build all --enable-tests --enable-benchmarks --only-dependencies" + - name: build all + run: "cabal build all --enable-tests --enable-benchmarks" + - name: test all + run: "cabal test all --enable-tests" + - name: haddock all + run: cabal haddock all + - name: "Install and run hlint (optional)" + run: | + cabal install hlint + hlint -g --no-exit-code strategy: matrix: cabal: - - '3.10' + - '3.10' ghc: - - '9.4.7' - - '9.0.2' - - '8.10.7' + - '9.6.3' + - '9.4.7' + - '9.2.8' + os: + - "ubuntu-latest" name: Haskell CI -on: - - push - - pull_request +'on': + pull_request: {} + push: {} + schedule: + - cron: "4 20 10 * *"