From af06661cd89a7e09bdbac324423b731d242bbbae Mon Sep 17 00:00:00 2001 From: Dmitrii Kovanikov Date: Fri, 30 Apr 2021 15:04:59 +0100 Subject: [PATCH] Update CI config --- .github/workflows/ci.yml | 50 +++++++++++++++++++++++++--------------- hit-on.cabal | 5 ++-- 2 files changed, 34 insertions(+), 21 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 5d734a9..053279f 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,47 +1,56 @@ name: CI on: - # Trigger the workflow on push or pull request, - # but only for the main branch - push: - branches: - - main pull_request: + types: [synchronize, opened, reopened] + push: + branches: [main] + schedule: + # additionally run once per week (At 00:00 on Sunday) to maintain cache + - cron: '0 0 * * 0' jobs: - build: + cabal: name: ${{ matrix.os }} / ghc ${{ matrix.ghc }} runs-on: ${{ matrix.os }} strategy: matrix: os: [ubuntu-latest, macOS-latest, windows-latest] cabal: ["3.4"] - ghc: ["8.10.4"] + ghc: + - "8.10.4" steps: - uses: actions/checkout@v2 - if: github.event.action == 'opened' || github.event.action == 'synchronize' || github.event.ref == 'refs/heads/main' - - name: Setup Haskell - uses: actions/setup-haskell@v1.1.4 + - uses: haskell/actions/setup@v1 id: setup-haskell-cabal + name: Setup Haskell with: ghc-version: ${{ matrix.ghc }} cabal-version: ${{ matrix.cabal }} + - name: Configure + run: | + cabal configure --enable-tests --enable-benchmarks --test-show-details=direct --write-ghc-environment-files=always + - name: Freeze - run: cabal freeze + run: | + cabal freeze - - name: Cache ~/.cabal/store - uses: actions/cache@v2.1.4 + - uses: actions/cache@v2.1.3 + name: Cache ~/.cabal/store with: path: ${{ steps.setup-haskell-cabal.outputs.cabal-store }} key: ${{ runner.os }}-${{ matrix.ghc }}-${{ hashFiles('cabal.project.freeze') }} + - name: Install dependencies + run: | + cabal build all --only-dependencies + - name: Build run: | - cabal configure --enable-tests --enable-benchmarks --test-show-details=direct - cabal build --enable-tests --enable-benchmarks + cabal build all - name: origin/HEAD if: matrix.os != 'macOS-latest' @@ -58,7 +67,8 @@ jobs: if: matrix.os != 'macOS-latest' env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - run: cabal test + run: | + cabal test hlint: name: hlint @@ -66,9 +76,13 @@ jobs: steps: - uses: actions/checkout@v2 - if: github.event.action == 'opened' || github.event.action == 'synchronize' || github.event.ref == 'refs/heads/main' - name: Run HLint + env: + HLINT_VERSION: "3.2.7" run: | curl https://raw.githubusercontent.com/kowainik/relude/v0.7.0.0/.hlint.yaml -o .hlint-relude.yaml - curl -sSL https://raw.github.com/ndmitchell/hlint/master/misc/run.sh | sh -s src/ test/ -h .hlint-relude.yaml + + curl -L https://github.com/ndmitchell/hlint/releases/download/v${HLINT_VERSION}/hlint-${HLINT_VERSION}-x86_64-linux.tar.gz --output hlint.tar.gz + tar -xvf hlint.tar.gz + ./hlint-${HLINT_VERSION}/hlint src/ test/ -h .hlint-relude.yaml \ No newline at end of file diff --git a/hit-on.cabal b/hit-on.cabal index 2869f65..021a386 100644 --- a/hit-on.cabal +++ b/hit-on.cabal @@ -14,15 +14,14 @@ category: Git, CLI Tool build-type: Simple extra-doc-files: README.md CHANGELOG.md -tested-with: GHC == 8.8.4 - GHC == 8.10.4 +tested-with: GHC == 8.10.4 source-repository head type: git location: https://github.com/kowainik/hit-on.git common common-options - build-depends: base >= 4.13.0.0 && < 4.15 + build-depends: base ^>= 4.14 , relude ^>= 0.7.0.0 mixins: base hiding (Prelude)