From 4206fb41e009b4950209607b20246e5fc1d4f81a Mon Sep 17 00:00:00 2001 From: Nitin Prakash Date: Thu, 7 Mar 2024 00:30:10 +0530 Subject: [PATCH] hlint + fix cabal.project --- .github/workflows/haskell-ci.yml | 26 +++++++++++++++++++++++--- cabal.haskell-ci | 2 ++ cabal.project | 3 +-- 3 files changed, 26 insertions(+), 5 deletions(-) create mode 100644 cabal.haskell-ci diff --git a/.github/workflows/haskell-ci.yml b/.github/workflows/haskell-ci.yml index 7791443..e4d3a3e 100644 --- a/.github/workflows/haskell-ci.yml +++ b/.github/workflows/haskell-ci.yml @@ -1,6 +1,6 @@ # This GitHub workflow config has been generated by a script via # -# haskell-ci 'github' 'azure-auth/azure-auth.cabal' +# haskell-ci 'github' '--config=cabal.haskell-ci' 'cabal.project' # # To regenerate the script (for example after adjusting tested-with) run # @@ -10,7 +10,7 @@ # # version: 0.16.6 # -# REGENDATA ("0.16.6",["github","azure-auth/azure-auth.cabal"]) +# REGENDATA ("0.16.6",["github","--config=cabal.haskell-ci","cabal.project"]) # name: Haskell-CI on: @@ -121,6 +121,11 @@ jobs: - name: update cabal index run: | $CABAL v2-update -v + - name: cache (tools) + uses: actions/cache/restore@v3 + with: + key: ${{ runner.os }}-${{ matrix.compiler }}-tools-16576a04 + path: ~/.haskell-ci-tools - name: install cabal-plan run: | mkdir -p $HOME/.cabal/bin @@ -130,6 +135,18 @@ jobs: rm -f cabal-plan.xz chmod a+x $HOME/.cabal/bin/cabal-plan cabal-plan --version + - name: install hlint + run: | + if [ $((HCNUMVER >= 90600)) -ne 0 ] ; then HLINTVER=$(cd /tmp && (${CABAL} v2-install -v $ARG_COMPILER --dry-run hlint --constraint='hlint >=3.6 && <3.7' | perl -ne 'if (/\bhlint-(\d+(\.\d+)*)\b/) { print "$1"; last; }')); echo "HLint version $HLINTVER" ; fi + if [ $((HCNUMVER >= 90600)) -ne 0 ] ; then if [ ! -e $HOME/.haskell-ci-tools/hlint-$HLINTVER/hlint ]; then echo "Downloading HLint version $HLINTVER"; mkdir -p $HOME/.haskell-ci-tools; curl --write-out 'Status Code: %{http_code} Redirects: %{num_redirects} Total time: %{time_total} Total Dsize: %{size_download}\n' --silent --location --output $HOME/.haskell-ci-tools/hlint-$HLINTVER.tar.gz "https://github.com/ndmitchell/hlint/releases/download/v$HLINTVER/hlint-$HLINTVER-x86_64-linux.tar.gz"; tar -xzv -f $HOME/.haskell-ci-tools/hlint-$HLINTVER.tar.gz -C $HOME/.haskell-ci-tools; fi ; fi + if [ $((HCNUMVER >= 90600)) -ne 0 ] ; then mkdir -p $CABAL_DIR/bin && ln -sf "$HOME/.haskell-ci-tools/hlint-$HLINTVER/hlint" $CABAL_DIR/bin/hlint ; fi + if [ $((HCNUMVER >= 90600)) -ne 0 ] ; then hlint --version ; fi + - name: save cache (tools) + uses: actions/cache/save@v3 + if: always() + with: + key: ${{ runner.os }}-${{ matrix.compiler }}-tools-16576a04 + path: ~/.haskell-ci-tools - name: checkout uses: actions/checkout@v3 with: @@ -137,7 +154,7 @@ jobs: - name: initial cabal.project for sdist run: | touch cabal.project - echo "packages: $GITHUB_WORKSPACE/source/azure-auth" >> cabal.project + echo "packages: $GITHUB_WORKSPACE/source/./azure-auth" >> cabal.project cat cabal.project - name: sdist run: | @@ -185,6 +202,9 @@ jobs: - name: tests run: | $CABAL v2-test $ARG_COMPILER $ARG_TESTS $ARG_BENCH all --test-show-details=direct + - name: hlint + run: | + if [ $((HCNUMVER >= 90600)) -ne 0 ] ; then (cd ${PKGDIR_azure_auth} && hlint -XHaskell2010 -XDataKinds -XDerivingStrategies -XDerivingVia -XLambdaCase -XNoImportQualifiedPost -XNoGeneralisedNewtypeDeriving -XOverloadedStrings -XOverloadedLabels -XRecordWildCards -XTypeFamilies -XViewPatterns src) ; fi - name: cabal check run: | cd ${PKGDIR_azure_auth} || false diff --git a/cabal.haskell-ci b/cabal.haskell-ci new file mode 100644 index 0000000..0ac17fb --- /dev/null +++ b/cabal.haskell-ci @@ -0,0 +1,2 @@ +hlint: True +hlint-version: >=3.6 && <3.7 diff --git a/cabal.project b/cabal.project index 48efb45..d438e69 100644 --- a/cabal.project +++ b/cabal.project @@ -1,3 +1,2 @@ packages: - azure-auth/ - + ./azure-auth