From 26afd05e4dd46e4aec38dc4737ff99b2acefedc8 Mon Sep 17 00:00:00 2001 From: Andreas Abel Date: Tue, 11 Mar 2025 21:08:29 +0100 Subject: [PATCH] v0.1.0.2 revision 1: Allow newer containers --- .github/workflows/haskell-ci.yml | 74 ++++++++++++------------- .github/workflows/stack.yml | 94 ++++++++++++++++++++++++++++++++ .gitignore | 3 + cabal.haskell-ci | 42 +++----------- microaeson.cabal | 29 ++++------ 5 files changed, 151 insertions(+), 91 deletions(-) create mode 100644 .github/workflows/stack.yml diff --git a/.github/workflows/haskell-ci.yml b/.github/workflows/haskell-ci.yml index d67aecd..e73a198 100644 --- a/.github/workflows/haskell-ci.yml +++ b/.github/workflows/haskell-ci.yml @@ -6,11 +6,11 @@ # # haskell-ci regenerate # -# For more information, see https://github.com/andreasabel/haskell-ci +# For more information, see https://github.com/haskell-CI/haskell-ci # -# version: 0.19.20241021 +# version: 0.19.20250216 # -# REGENDATA ("0.19.20241021",["github","microaeson.cabal"]) +# REGENDATA ("0.19.20250216",["github","microaeson.cabal"]) # 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,9 +32,9 @@ jobs: strategy: matrix: include: - - compiler: ghc-9.12.20241014 + - compiler: ghc-9.12.1 compilerKind: ghc - compilerVersion: 9.12.20241014 + compilerVersion: 9.12.1 setup-method: ghcup allow-failure: false - compiler: ghc-9.10.1 @@ -42,9 +42,9 @@ jobs: 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.6 @@ -99,16 +99,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 libnuma-dev + - 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" chmod a+x "$HOME/.ghcup/bin/ghcup" - "$HOME/.ghcup/bin/ghcup" config add-release-channel https://raw.githubusercontent.com/haskell/ghcup-metadata/master/ghcup-prereleases-0.0.8.yaml; - "$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 }} @@ -119,21 +132,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" - if [ $((HCNUMVER >= 91200)) -ne 0 ] ; then echo "HEADHACKAGE=true" >> "$GITHUB_ENV" ; else echo "HEADHACKAGE=false" >> "$GITHUB_ENV" ; fi + 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 }} @@ -160,18 +164,6 @@ jobs: repository hackage.haskell.org url: http://hackage.haskell.org/ EOF - if $HEADHACKAGE; then - cat >> $CABAL_CONFIG <> $CABAL_CONFIG <= 80200)) -ne 0 ] ; then echo "package microaeson" >> cabal.project ; fi if [ $((HCNUMVER >= 80200)) -ne 0 ] ; then echo " ghc-options: -Werror=missing-methods" >> cabal.project ; fi cat >> cabal.project <> cabal.project - fi $HCPKG list --simple-output --names-only | perl -ne 'for (split /\s+/) { print "constraints: any.$_ installed\n" unless /^(microaeson)$/; }' >> cabal.project.local cat cabal.project cat cabal.project.local @@ -263,9 +253,19 @@ jobs: run: | rm -f cabal.project.local $CABAL v2-build $ARG_COMPILER --disable-tests --disable-benchmarks all + - name: prepare for constraint sets + run: | + rm -f cabal.project.local + - name: constraint set containers-0.8 + run: | + if [ $((HCNUMVER >= 80200)) -ne 0 ] ; then $CABAL v2-build $ARG_COMPILER --enable-tests --disable-benchmarks --constraint='containers ^>= 0.8' all --dry-run ; fi + if [ $((HCNUMVER >= 80200)) -ne 0 ] ; then cabal-plan topo | sort ; fi + if [ $((HCNUMVER >= 80200)) -ne 0 ] ; then $CABAL v2-build $ARG_COMPILER --enable-tests --disable-benchmarks --constraint='containers ^>= 0.8' --dependencies-only -j2 all ; fi + if [ $((HCNUMVER >= 80200)) -ne 0 ] ; then $CABAL v2-build $ARG_COMPILER --enable-tests --disable-benchmarks --constraint='containers ^>= 0.8' all ; fi + if [ $((HCNUMVER >= 80200)) -ne 0 ] ; then $CABAL v2-test $ARG_COMPILER --enable-tests --disable-benchmarks --constraint='containers ^>= 0.8' all ; fi - 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/.github/workflows/stack.yml b/.github/workflows/stack.yml new file mode 100644 index 0000000..9908352 --- /dev/null +++ b/.github/workflows/stack.yml @@ -0,0 +1,94 @@ +name: Stack build + +on: + push: + branches: + - master + pull_request: + branches: + - master + +defaults: + run: + shell: bash + +jobs: + stack: + name: ${{ matrix.os }} Stack ${{ matrix.plan.resolver }} / ${{ matrix.plan.ghc }} + strategy: + fail-fast: false + matrix: + os: [ubuntu-latest] + plan: + - ghc: '9.10.1' + resolver: 'nightly-2025-03-11' + - ghc: '9.8.4' + resolver: 'lts-23.14' + - ghc: '9.6.6' + resolver: 'lts-22.43' + - ghc: '9.4.8' + resolver: 'lts-21.25' + - ghc: '9.2.8' + resolver: 'lts-20.26' + - ghc: '9.0.2' + resolver: 'lts-19.33' + - ghc: '8.10.7' + resolver: 'lts-18.28' + - ghc: '8.8.4' + resolver: 'lts-16.31' + - ghc: '8.6.5' + resolver: 'lts-14.27' + - ghc: '8.4.4' + resolver: 'lts-12.26' + + include: + - os: windows-latest + plan: + ghc: '9.10.1' + resolver: 'nightly-2025-03-11' + + - os: macos-latest + plan: + ghc: '9.10.1' + resolver: 'nightly-2025-03-11' + + runs-on: ${{ matrix.os }} + env: + STACK: stack --system-ghc --no-terminal --resolver ${{ matrix.plan.resolver }} + + steps: + - uses: actions/checkout@v4 + + - uses: haskell-actions/setup@latest + id: setup + with: + ghc-version: ${{ matrix.plan.ghc }} + enable-stack: true + cabal-update: false + + - uses: actions/cache/restore@v4 + id: cache + env: + key: ${{ runner.os }}-stack-${{ steps.setup.outputs.stack-version }}-ghc-${{ steps.setup.outputs.ghc-version }} + with: + path: ${{ steps.setup.outputs.stack-root }} + key: ${{ env.key }}-${{ github.sha }} + restore-keys: ${{ env.key }}- + + - name: Configure + run: $STACK init + + - name: Install dependencies + run: $STACK test --only-dependencies + + - name: Build + run: $STACK test --haddock --no-haddock-deps --no-run-tests + + - name: Test + run: $STACK -j 1 test --haddock --no-haddock-deps + + - uses: actions/cache/save@v4 + if: always() && steps.cache.outputs.cache-hit != 'true' + with: + path: ${{ steps.setup.outputs.stack-root }} + key: ${{ steps.cache.outputs.cache-primary-key }} diff --git a/.gitignore b/.gitignore index f5ac200..265c702 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,5 @@ /dist-newstyle/ /.stack-work/ +stack*.yaml.lock +.ghc.environment.* +*~ diff --git a/cabal.haskell-ci b/cabal.haskell-ci index 4db5de0..3958024 100644 --- a/cabal.haskell-ci +++ b/cabal.haskell-ci @@ -1,38 +1,10 @@ branches: master --- constraint-set containers-0.7 --- ghc: >= 8.2 && < 9.8 --- constraints: containers ^>= 0.7 --- tests: True --- run-tests: True +constraint-set containers-0.8 + ghc: >= 8.2 + constraints: containers ^>= 0.8 + tests: True + run-tests: True --- raw-project --- allow-newer: containers - --- -- `allow-newer: text` breaks aeson in the GHC-8.2 build --- enabled: < 8.2 || > 8.3 --- --- constraint-set bytestring-0.12 --- ghc: >= 8.2 --- constraints: bytestring ^>= 0.12 --- constraints: text < 2.1 --- -- otherwise aeson fails to build --- tests: True --- run-tests: True --- --- constraint-set text-2.1 --- ghc: >= 8.2 && < 9.8 --- constraints: text ^>= 2.1 --- -- Cannot build aeson with text-2.1 atm (2023-08-31) --- tests: False --- --- constraint-set text-2.1-tests --- ghc: >= 9.8 --- constraints: text ^>= 2.1 --- tests: True --- run-tests: True --- --- -- For constraint-sets --- raw-project --- allow-newer: bytestring --- allow-newer: text +raw-project + allow-newer: containers diff --git a/microaeson.cabal b/microaeson.cabal index d01f77d..63c947c 100644 --- a/microaeson.cabal +++ b/microaeson.cabal @@ -1,6 +1,7 @@ cabal-version: 2.0 name: microaeson version: 0.1.0.2 +x-revision: 1 synopsis: A tiny JSON library with light dependency footprint license: GPL-3 @@ -20,9 +21,9 @@ The API is designed in such a way to allow to easily convert client code written } tested-with: - GHC == 9.12.0 + GHC == 9.12.1 GHC == 9.10.1 - GHC == 9.8.2 + GHC == 9.8.4 GHC == 9.6.6 GHC == 9.4.8 GHC == 9.2.8 @@ -58,18 +59,13 @@ library other-modules: Data.Aeson.Micro.Parser Data.Aeson.Micro.Scanner - build-depends: array ^>= 0.5.1.0 - , base >= 4.8.0.0 && < 5 - , bytestring >= 0.10.6.0 && < 0.13 - , containers ^>= 0.5.6.2 - || ^>= 0.6.0.1 - || ^>= 0.7 - , deepseq ^>= 1.4.1.1 - || ^>= 1.5.0.0 + build-depends: array ^>= 0.5.1.1 + , base >= 4.9.0.0 && < 5 + , bytestring >= 0.10.8.0 && < 0.13 + , containers >= 0.5.7.1 && < 1 + , deepseq >= 1.4.2.0 && < 1.6 , fail ^>= 4.9.0.0 - , text ^>= 1.2.2.2 - || ^>= 2.0 - || ^>= 2.1 + , text >= 1.2.2.2 && < 1.3 || >= 2.0 && < 3 build-tool-depends: alex:alex >= 3.2.0 @@ -100,12 +96,7 @@ test-suite microaeson , text -- dependencies requiring constraints - build-depends: aeson ^>= 1.3.1.0 - || ^>= 1.4.7.1 - || ^>= 1.5.6.0 - || ^>= 2.0.3.0 - || ^>= 2.1.0.0 - || ^>= 2.2.0.0 + build-depends: aeson >= 1.3.1.0 && < 2.3 , QuickCheck >= 2.11.3 && < 2.16 , quickcheck-instances ^>= 0.3.16 , tasty >= 1.0.1.1 && < 1.6