From 537ca624777ef771d3bf61c5cf3d7739a2fc3b7e Mon Sep 17 00:00:00 2001 From: Andrzej Rybczak Date: Mon, 25 Mar 2024 18:26:10 +0100 Subject: [PATCH] Add CI --- .github/workflows/haskell-ci.yml | 220 +++++++++++++++++++++++++++++++ .github/workflows/test.yml | 21 --- .gitignore | 10 ++ .travis.yml | 19 --- Setup.hs | 2 - cabal.haskell-ci | 2 + cabal.project | 1 + src/Control/Monad/Trace/Class.hs | 1 + stack.yaml | 64 --------- stack.yaml.lock | 12 -- tracing.cabal | 16 ++- 11 files changed, 243 insertions(+), 125 deletions(-) create mode 100644 .github/workflows/haskell-ci.yml delete mode 100644 .github/workflows/test.yml create mode 100644 .gitignore delete mode 100644 .travis.yml delete mode 100644 Setup.hs create mode 100644 cabal.haskell-ci create mode 100644 cabal.project delete mode 100644 stack.yaml delete mode 100644 stack.yaml.lock diff --git a/.github/workflows/haskell-ci.yml b/.github/workflows/haskell-ci.yml new file mode 100644 index 0000000..eb71446 --- /dev/null +++ b/.github/workflows/haskell-ci.yml @@ -0,0 +1,220 @@ +# This GitHub workflow config has been generated by a script via +# +# haskell-ci 'github' '--config=cabal.haskell-ci' 'cabal.project' +# +# To regenerate the script (for example after adjusting tested-with) run +# +# haskell-ci regenerate +# +# For more information, see https://github.com/haskell-CI/haskell-ci +# +# version: 0.18.1 +# +# REGENDATA ("0.18.1",["github","--config=cabal.haskell-ci","cabal.project"]) +# +name: Haskell-CI +on: + push: + branches: + - master + pull_request: + branches: + - master +jobs: + linux: + name: Haskell-CI - Linux - ${{ matrix.compiler }} + runs-on: ubuntu-20.04 + timeout-minutes: + 60 + container: + image: buildpack-deps:bionic + continue-on-error: ${{ matrix.allow-failure }} + strategy: + matrix: + include: + - compiler: ghc-9.8.2 + compilerKind: ghc + compilerVersion: 9.8.2 + setup-method: ghcup + allow-failure: false + - compiler: ghc-9.6.4 + compilerKind: ghc + compilerVersion: 9.6.4 + setup-method: ghcup + allow-failure: false + - compiler: ghc-9.4.8 + compilerKind: ghc + compilerVersion: 9.4.8 + setup-method: ghcup + allow-failure: false + - compiler: ghc-9.2.8 + compilerKind: ghc + compilerVersion: 9.2.8 + setup-method: ghcup + allow-failure: false + - compiler: ghc-9.0.2 + compilerKind: ghc + compilerVersion: 9.0.2 + setup-method: ghcup + allow-failure: false + - compiler: ghc-8.10.7 + compilerKind: ghc + compilerVersion: 8.10.7 + setup-method: ghcup + allow-failure: false + fail-fast: false + steps: + - name: apt + run: | + apt-get update + apt-get install -y --no-install-recommends gnupg ca-certificates dirmngr curl git software-properties-common libtinfo5 + mkdir -p "$HOME/.ghcup/bin" + curl -sL https://downloads.haskell.org/ghcup/0.1.20.0/x86_64-linux-ghcup-0.1.20.0 > "$HOME/.ghcup/bin/ghcup" + chmod a+x "$HOME/.ghcup/bin/ghcup" + "$HOME/.ghcup/bin/ghcup" install ghc "$HCVER" || (cat "$HOME"/.ghcup/logs/*.* && false) + "$HOME/.ghcup/bin/ghcup" install cabal 3.10.2.0 || (cat "$HOME"/.ghcup/logs/*.* && false) + env: + HCKIND: ${{ matrix.compilerKind }} + HCNAME: ${{ matrix.compiler }} + HCVER: ${{ matrix.compilerVersion }} + - name: Set PATH and environment variables + run: | + echo "$HOME/.cabal/bin" >> $GITHUB_PATH + 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.10.2.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 }} + HCVER: ${{ matrix.compilerVersion }} + - name: env + run: | + env + - name: write cabal config + run: | + mkdir -p $CABAL_DIR + cat >> $CABAL_CONFIG <> $CABAL_CONFIG < cabal-plan.xz + echo 'f62ccb2971567a5f638f2005ad3173dba14693a45154c1508645c52289714cb2 cabal-plan.xz' | sha256sum -c - + xz -d < cabal-plan.xz > $HOME/.cabal/bin/cabal-plan + rm -f cabal-plan.xz + chmod a+x $HOME/.cabal/bin/cabal-plan + cabal-plan --version + - name: checkout + uses: actions/checkout@v3 + with: + path: source + - name: initial cabal.project for sdist + run: | + touch cabal.project + echo "packages: $GITHUB_WORKSPACE/source/." >> cabal.project + cat cabal.project + - name: sdist + run: | + mkdir -p sdist + $CABAL sdist all --output-dir $GITHUB_WORKSPACE/sdist + - name: unpack + run: | + mkdir -p unpacked + find sdist -maxdepth 1 -type f -name '*.tar.gz' -exec tar -C $GITHUB_WORKSPACE/unpacked -xzvf {} \; + - name: generate cabal.project + run: | + PKGDIR_tracing="$(find "$GITHUB_WORKSPACE/unpacked" -maxdepth 1 -type d -regex '.*/tracing-[0-9.]*')" + echo "PKGDIR_tracing=${PKGDIR_tracing}" >> "$GITHUB_ENV" + rm -f cabal.project cabal.project.local + touch cabal.project + touch cabal.project.local + echo "packages: ${PKGDIR_tracing}" >> cabal.project + echo "package tracing" >> cabal.project + echo " ghc-options: -Werror=missing-methods" >> cabal.project + cat >> cabal.project <> cabal.project.local + cat cabal.project + cat cabal.project.local + - name: dump install plan + run: | + $CABAL v2-build $ARG_COMPILER $ARG_TESTS $ARG_BENCH --dry-run all + cabal-plan + - name: restore cache + uses: actions/cache/restore@v3 + with: + key: ${{ runner.os }}-${{ matrix.compiler }}-${{ github.sha }} + path: ~/.cabal/store + restore-keys: ${{ runner.os }}-${{ matrix.compiler }}- + - name: install dependencies + run: | + $CABAL v2-build $ARG_COMPILER --disable-tests --disable-benchmarks --dependencies-only -j2 all + $CABAL v2-build $ARG_COMPILER $ARG_TESTS $ARG_BENCH --dependencies-only -j2 all + - name: build w/o tests + run: | + $CABAL v2-build $ARG_COMPILER --disable-tests --disable-benchmarks all + - name: build + run: | + $CABAL v2-build $ARG_COMPILER $ARG_TESTS $ARG_BENCH all --write-ghc-environment-files=always + - name: tests + run: | + $CABAL v2-test $ARG_COMPILER $ARG_TESTS $ARG_BENCH all --test-show-details=direct + - name: cabal check + run: | + cd ${PKGDIR_tracing} || false + ${CABAL} -vnormal check + - name: haddock + run: | + $CABAL v2-haddock --disable-documentation --haddock-all $ARG_COMPILER --with-haddock $HADDOCK $ARG_TESTS $ARG_BENCH all + - name: unconstrained build + run: | + rm -f cabal.project.local + $CABAL v2-build $ARG_COMPILER --disable-tests --disable-benchmarks all + - name: save cache + uses: actions/cache/save@v3 + if: always() + with: + key: ${{ runner.os }}-${{ matrix.compiler }}-${{ github.sha }} + path: ~/.cabal/store diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml deleted file mode 100644 index ad7ba88..0000000 --- a/.github/workflows/test.yml +++ /dev/null @@ -1,21 +0,0 @@ -name: Haskell CI -on: [push] -jobs: - test: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v1 - - uses: actions/setup-haskell@v1 - with: - ghc-version: '8.6.5' - cabal-version: '3.0' - - name: Install dependencies - run: | - cabal update - cabal build --only-dependencies --enable-tests - - name: Build - run: | - cabal configure --enable-tests - cabal build - - name: Run tests - run: cabal test diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..bfc4e76 --- /dev/null +++ b/.gitignore @@ -0,0 +1,10 @@ +*~ +*.swp +dist-* +dist +.ghc.environment.* +.stack-work/ +stack.yaml +stack.yaml.lock +cabal.project.local +TAGS* diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index bf80177..0000000 --- a/.travis.yml +++ /dev/null @@ -1,19 +0,0 @@ -language: haskell -ghc: - - '8.6' - # - '8.4' # Disabled to avoid --force-reinstalls. - - '8.2' - - '8.0' -jobs: - include: - - stage: deploy - if: tag =~ ^v[\d\.]+$ - script: skip - deploy: - provider: hackage - username: mtth - password: - secure: ap8/hMzF7D9YHPdUHvK3qgxKEorQS+jO/xPaV3zgcBgqN6NTkHpSvCUBzI9n8WZe489zcTY1SkYiEh+VSy8vj+nxPTdInbS2p/tB+qYnzRNlozWveWbw9dwYBDpTOavkAe/WMeAVg5zfm76/tsxkqGcxdqPf8iIXqx0MdS7Iif15X/DDRwgxpyGS0kZoKByoxQwOdsvqx4YtO7pbSm4s+62+jrIky5AI2MMzpt0V3am0RRygQxDZIHXATpFX4Bj0RB619qrHIh7T1MRQi12vspoUC3j0XY92E+UHTNEiWXsVF4cRjPU4N6R+KjZXLBbEoqEOfHUqzee1ACcD8QVYdIAEZVYzdAM5PUIMVggsqUx3pag5dslwjJf8KFOHcddUSFDrTuB1LpTZHrcKbdsuF1WF1J1ShWm18cwArGO/JiQsuLfHMPAMFApxYKWYfAbNO1g48pw2r659rS/AMaA8EPk77LlvAPF0N7at1ba33AIprqfFVQfkxjuSKiZXf4fZoA5HruimYWLxh0JRsDrM3oHXTRhgL16WTrjmnu0+I/DrSTBdj1DFeeSYdwh88x4vLwuMO+eS6sGCj77SJgPq5E3OuNGXuU9dHjeqVQ0RnHYzO3o7uTKQ5wu04B3QKO4o5uAqwnbsMIuNTAgPHEBQ8WG/BVYvAFhByWzuO2db09c= - on: - repo: mtth/tracing - tags: true diff --git a/Setup.hs b/Setup.hs deleted file mode 100644 index 9a994af..0000000 --- a/Setup.hs +++ /dev/null @@ -1,2 +0,0 @@ -import Distribution.Simple -main = defaultMain diff --git a/cabal.haskell-ci b/cabal.haskell-ci new file mode 100644 index 0000000..9759054 --- /dev/null +++ b/cabal.haskell-ci @@ -0,0 +1,2 @@ +branches: master +tests: True diff --git a/cabal.project b/cabal.project new file mode 100644 index 0000000..e6fdbad --- /dev/null +++ b/cabal.project @@ -0,0 +1 @@ +packages: . diff --git a/src/Control/Monad/Trace/Class.hs b/src/Control/Monad/Trace/Class.hs index f79ee84..53cbafe 100644 --- a/src/Control/Monad/Trace/Class.hs +++ b/src/Control/Monad/Trace/Class.hs @@ -5,6 +5,7 @@ {-# LANGUAGE FlexibleInstances #-} {-# LANGUAGE UndecidableInstances #-} {-# LANGUAGE RankNTypes #-} +{-# LANGUAGE TypeOperators #-} -- | This module exposes the generic 'MonadTrace' class. module Control.Monad.Trace.Class ( diff --git a/stack.yaml b/stack.yaml deleted file mode 100644 index 139ba7f..0000000 --- a/stack.yaml +++ /dev/null @@ -1,64 +0,0 @@ -# This file was automatically generated by 'stack init' -# -# Some commonly used options have been documented as comments in this file. -# For advanced use and comprehensive documentation of the format, please see: -# https://docs.haskellstack.org/en/stable/yaml_configuration/ - -# Resolver to choose a 'specific' stackage snapshot or a compiler version. -# A snapshot resolver dictates the compiler version and the set of packages -# to be used for project dependencies. For example: -# -# resolver: lts-3.5 -# resolver: nightly-2015-09-21 -# resolver: ghc-7.10.2 -# -# The location of a snapshot can be provided as a file or url. Stack assumes -# a snapshot provided as a file might change, whereas a url resource does not. -# -# resolver: ./custom-snapshot.yaml -# resolver: https://example.com/snapshots/2018-01-01.yaml -resolver: nightly-2021-04-02 - -# User packages to be built. -# Various formats can be used as shown in the example below. -# -# packages: -# - some-directory -# - https://example.com/foo/bar/baz-0.0.2.tar.gz -# - location: -# git: https://github.com/commercialhaskell/stack.git -# commit: e7b331f14bcffb8367cd58fbfc8b40ec7642100a -# - location: https://github.com/commercialhaskell/stack/commit/e7b331f14bcffb8367cd58fbfc8b40ec7642100a -# subdirs: -# - auto-update -# - wai -packages: -- . -# Dependency packages to be pulled from upstream that are not in the resolver -# using the same syntax as the packages field. -# (e.g., acme-missiles-0.3) -# extra-deps: [] - -# Override default flag values for local packages and extra-deps -# flags: {} - -# Extra package databases containing global packages -# extra-package-dbs: [] - -# Control whether we use the GHC we find on the path -# system-ghc: true -# -# Require a specific version of stack, using version ranges -# require-stack-version: -any # Default -# require-stack-version: ">=1.9" -# -# Override the architecture used by stack, especially useful on Windows -# arch: i386 -# arch: x86_64 -# -# Extra directories used by stack for building -# extra-include-dirs: [/path/to/dir] -# extra-lib-dirs: [/path/to/dir] -# -# Allow a newer minor version of GHC than the snapshot specifies -# compiler-check: newer-minor diff --git a/stack.yaml.lock b/stack.yaml.lock deleted file mode 100644 index 8be4a66..0000000 --- a/stack.yaml.lock +++ /dev/null @@ -1,12 +0,0 @@ -# This file was autogenerated by Stack. -# You should not edit this file by hand. -# For more information, please see the documentation at: -# https://docs.haskellstack.org/en/stable/lock_files - -packages: [] -snapshots: -- completed: - size: 576534 - url: https://raw.githubusercontent.com/commercialhaskell/stackage-snapshots/master/nightly/2021/4/2.yaml - sha256: 76ba2ea759dfc59a1b2a9ea92ea2c8d418812bc57612522ce17955e19d817faa - original: nightly-2021-04-02 diff --git a/tracing.cabal b/tracing.cabal index 3f694b0..6a7ad03 100644 --- a/tracing.cabal +++ b/tracing.cabal @@ -1,4 +1,4 @@ -cabal-version: 2.0 +cabal-version: 3.0 name: tracing version: 0.0.7.2 @@ -8,7 +8,7 @@ description: category: Web homepage: https://github.com/mtth/tracing -license: BSD3 +license: BSD-3-Clause license-file: LICENSE author: Matthieu Monsch maintainer: mtth@apache.org @@ -17,9 +17,11 @@ copyright: 2020 Matthieu Monsch build-type: Simple extra-source-files: README.md +tested-with: GHC == { 8.10.7, 9.0.2, 9.2.8, 9.4.8, 9.6.4, 9.8.2 } + source-repository head type: git - location: https://github.com/mtth/tracing + location: https://github.com/scrive/tracing library hs-source-dirs: src @@ -32,8 +34,8 @@ library other-modules: Control.Monad.Trace.Internal build-depends: - aeson >= 1.4 - , base >= 4.9 && < 5 + aeson >= 2.0 + , base >= 4.14 && < 5 , base16-bytestring >= 1.0 , bytestring >= 0.10 , case-insensitive >= 1.2 @@ -47,7 +49,7 @@ library , random >= 1.1 , stm >= 2.5 , text >= 1.2 - , time >= 1.8 && < 1.10 + , time >= 1.8 , transformers >= 0.5 , transformers-base >= 0.4 ghc-options: -Wall @@ -67,5 +69,5 @@ test-suite tracing-test , stm , text , tracing - ghc-options: -threaded -rtsopts -with-rtsopts=-N + ghc-options: -threaded -rtsopts -with-rtsopts=-N4 default-language: Haskell2010