From 87a30be8cfd5e06726f02d3a48ab38ba80813719 Mon Sep 17 00:00:00 2001 From: Oleg Grenrus Date: Wed, 15 Jan 2025 09:14:59 +0200 Subject: [PATCH] Support GHC-9.12, tagged-0.8.9 --- .github/workflows/haskell-ci.yml | 50 ++++++++++++++++++------------- CHANGELOG.md | 5 ++++ binary-instances.cabal | 12 ++++---- src/Data/Binary/Instances/Time.hs | 8 ++--- 4 files changed, 45 insertions(+), 30 deletions(-) diff --git a/.github/workflows/haskell-ci.yml b/.github/workflows/haskell-ci.yml index db3ea45..efdf99c 100644 --- a/.github/workflows/haskell-ci.yml +++ b/.github/workflows/haskell-ci.yml @@ -8,9 +8,9 @@ # # For more information, see https://github.com/haskell-CI/haskell-ci # -# version: 0.19.20240708 +# version: 0.19.20250315 # -# REGENDATA ("0.19.20240708",["github","cabal.project"]) +# REGENDATA ("0.19.20250315",["github","cabal.project"]) # name: Haskell-CI on: @@ -23,7 +23,7 @@ on: jobs: linux: name: Haskell-CI - Linux - ${{ matrix.compiler }} - runs-on: ubuntu-20.04 + runs-on: ubuntu-24.04 timeout-minutes: 60 container: @@ -32,19 +32,24 @@ jobs: strategy: matrix: include: + - compiler: ghc-9.12.2 + compilerKind: ghc + compilerVersion: 9.12.2 + setup-method: ghcup + allow-failure: false - compiler: ghc-9.10.1 compilerKind: ghc compilerVersion: 9.10.1 setup-method: ghcup allow-failure: false - - compiler: ghc-9.8.2 + - compiler: ghc-9.8.4 compilerKind: ghc - compilerVersion: 9.8.2 + compilerVersion: 9.8.4 setup-method: ghcup allow-failure: false - - compiler: ghc-9.6.5 + - compiler: ghc-9.6.6 compilerKind: ghc - compilerVersion: 9.6.5 + compilerVersion: 9.6.6 setup-method: ghcup allow-failure: false - compiler: ghc-9.4.8 @@ -79,15 +84,29 @@ jobs: allow-failure: false fail-fast: false steps: - - name: apt + - name: apt-get install run: | apt-get update apt-get install -y --no-install-recommends gnupg ca-certificates dirmngr curl git software-properties-common libtinfo5 + - name: Install GHCup + run: | mkdir -p "$HOME/.ghcup/bin" - curl -sL https://downloads.haskell.org/ghcup/0.1.30.0/x86_64-linux-ghcup-0.1.30.0 > "$HOME/.ghcup/bin/ghcup" + curl -sL https://downloads.haskell.org/ghcup/0.1.40.0/x86_64-linux-ghcup-0.1.40.0 > "$HOME/.ghcup/bin/ghcup" chmod a+x "$HOME/.ghcup/bin/ghcup" - "$HOME/.ghcup/bin/ghcup" install ghc "$HCVER" || (cat "$HOME"/.ghcup/logs/*.* && false) + - name: Install cabal-install + run: | "$HOME/.ghcup/bin/ghcup" install cabal 3.12.1.0 || (cat "$HOME"/.ghcup/logs/*.* && false) + echo "CABAL=$HOME/.ghcup/bin/cabal-3.12.1.0 -vnormal+nowrap" >> "$GITHUB_ENV" + - name: Install GHC (GHCup) + if: matrix.setup-method == 'ghcup' + run: | + "$HOME/.ghcup/bin/ghcup" install ghc "$HCVER" || (cat "$HOME"/.ghcup/logs/*.* && false) + HC=$("$HOME/.ghcup/bin/ghcup" whereis ghc "$HCVER") + HCPKG=$(echo "$HC" | sed 's#ghc$#ghc-pkg#') + HADDOCK=$(echo "$HC" | sed 's#ghc$#haddock#') + echo "HC=$HC" >> "$GITHUB_ENV" + echo "HCPKG=$HCPKG" >> "$GITHUB_ENV" + echo "HADDOCK=$HADDOCK" >> "$GITHUB_ENV" env: HCKIND: ${{ matrix.compilerKind }} HCNAME: ${{ matrix.compiler }} @@ -98,21 +117,12 @@ jobs: echo "LANG=C.UTF-8" >> "$GITHUB_ENV" echo "CABAL_DIR=$HOME/.cabal" >> "$GITHUB_ENV" echo "CABAL_CONFIG=$HOME/.cabal/config" >> "$GITHUB_ENV" - HCDIR=/opt/$HCKIND/$HCVER - HC=$("$HOME/.ghcup/bin/ghcup" whereis ghc "$HCVER") - HCPKG=$(echo "$HC" | sed 's#ghc$#ghc-pkg#') - HADDOCK=$(echo "$HC" | sed 's#ghc$#haddock#') - echo "HC=$HC" >> "$GITHUB_ENV" - echo "HCPKG=$HCPKG" >> "$GITHUB_ENV" - echo "HADDOCK=$HADDOCK" >> "$GITHUB_ENV" - echo "CABAL=$HOME/.ghcup/bin/cabal-3.12.1.0 -vnormal+nowrap" >> "$GITHUB_ENV" HCNUMVER=$(${HC} --numeric-version|perl -ne '/^(\d+)\.(\d+)\.(\d+)(\.(\d+))?$/; print(10000 * $1 + 100 * $2 + ($3 == 0 ? $5 != 1 : $3))') echo "HCNUMVER=$HCNUMVER" >> "$GITHUB_ENV" echo "ARG_TESTS=--enable-tests" >> "$GITHUB_ENV" echo "ARG_BENCH=--enable-benchmarks" >> "$GITHUB_ENV" echo "HEADHACKAGE=false" >> "$GITHUB_ENV" echo "ARG_COMPILER=--$HCKIND --with-compiler=$HC" >> "$GITHUB_ENV" - echo "GHCJSARITH=0" >> "$GITHUB_ENV" env: HCKIND: ${{ matrix.compilerKind }} HCNAME: ${{ matrix.compiler }} @@ -228,8 +238,8 @@ jobs: rm -f cabal.project.local $CABAL v2-build $ARG_COMPILER --disable-tests --disable-benchmarks all - name: save cache - uses: actions/cache/save@v4 if: always() + uses: actions/cache/save@v4 with: key: ${{ runner.os }}-${{ matrix.compiler }}-${{ github.sha }} path: ~/.cabal/store diff --git a/CHANGELOG.md b/CHANGELOG.md index 6de4a6d..14ded29 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,8 @@ +## 1.0.6 + +- Support GHC-9.12.1 +- Fix a small bug QuarterOfYear instance + ## 1.0.5 - Support GHC-8.6.5...9.10.1 diff --git a/binary-instances.cabal b/binary-instances.cabal index ec146ef..d371d5b 100644 --- a/binary-instances.cabal +++ b/binary-instances.cabal @@ -1,7 +1,6 @@ cabal-version: 2.2 name: binary-instances -version: 1.0.5 -x-revision: 1 +version: 1.0.6 synopsis: Orphan instances for binary description: `binary-instances` defines orphan instances for types in some popular packages. @@ -21,9 +20,10 @@ tested-with: || ==9.0.2 || ==9.2.8 || ==9.4.8 - || ==9.6.5 - || ==9.8.2 + || ==9.6.6 + || ==9.8.4 || ==9.10.1 + || ==9.12.2 extra-source-files: CHANGELOG.md @@ -35,13 +35,13 @@ library default-language: Haskell2010 hs-source-dirs: src build-depends: - , base >=4.6.0.1 && <4.21 + , base >=4.6.0.1 && <4.22 , binary >=0.5.1.1 && <0.8.10 , text >=1.2.3.0 && <1.3 || >=2.0 && <2.2 build-depends: , case-insensitive >=1.2.1.0 && <1.2.2 - , tagged >=0.8.8 && <0.8.9 + , tagged >=0.8.8 && <0.8.10 build-depends: , aeson ^>=2.2.2.0 diff --git a/src/Data/Binary/Instances/Time.hs b/src/Data/Binary/Instances/Time.hs index 1be6a83..faf779e 100644 --- a/src/Data/Binary/Instances/Time.hs +++ b/src/Data/Binary/Instances/Time.hs @@ -86,7 +86,7 @@ instance Binary Time.DayOfWeek where 4 -> Time.Thursday 5 -> Time.Friday 6 -> Time.Saturday - _ -> error "panic: get @DayOfWeek" + j -> error $ "panic: get @DayOfWeek: " ++ show (i, j) instance Binary Time.Month where put (Time.MkMonth m) = put m @@ -104,9 +104,9 @@ instance Binary Time.QuarterOfYear where get = do i <- get - return $ case mod (i :: Word8) 7 of + return $ case mod (i :: Word8) 4 of 1 -> Time.Q1 2 -> Time.Q2 3 -> Time.Q3 - 4 -> Time.Q4 - _ -> error "panic: get @DayOfWeek" + 0 -> Time.Q4 + j -> error $ "panic: get @QuarterOfYear: " ++ show (i, j)