diff --git a/.circleci/config.yml b/.circleci/config.yml deleted file mode 100644 index 675bc7c936..0000000000 --- a/.circleci/config.yml +++ /dev/null @@ -1,220 +0,0 @@ -version: 2.1 - -#----------------------------------------------------------------------------- -# packcheck-0.7.0 -# Packcheck global environment variables -#----------------------------------------------------------------------------- - -env: &env - environment: - # ------------------------------------------------------------------------ - # Common options - # ------------------------------------------------------------------------ - # GHC_OPTIONS: "-Werror" - # For updating see: https://downloads.haskell.org/~ghcup/ - GHCUP_VERSION: 0.1.20.0 - CABAL_REINIT_CONFIG: "y" - LC_ALL: "C.UTF-8" - - # ------------------------------------------------------------------------ - # What to build - # ------------------------------------------------------------------------ - # DISABLE_TEST: "y" - # DISABLE_BENCH: "y" - # DISABLE_DOCS: "y" - # DISABLE_SDIST_BUILD: "y" - # DISABLE_DIST_CHECKS: "y" - - # ------------------------------------------------------------------------ - # stack options - # ------------------------------------------------------------------------ - # Note requiring a specific version of stack using STACKVER may fail due to - # github API limit while checking and upgrading/downgrading to the specific - # version. - #STACKVER: "1.6.5" - STACK_UPGRADE: "y" - #RESOLVER: "lts-12" - - # ------------------------------------------------------------------------ - # cabal options - # ------------------------------------------------------------------------ - CABAL_CHECK_RELAX: "y" - CABAL_BUILD_OPTIONS: "-j1 --flag limit-build-mem" - - # ------------------------------------------------------------------------ - # Where to find the required tools - # ------------------------------------------------------------------------ - PATH: /sbin:/usr/sbin:/bin:/usr/bin - - # ------------------------------------------------------------------------ - # Location of packcheck.sh (the shell script invoked to perform CI tests ). - # ------------------------------------------------------------------------ - # You can either commit the packcheck.sh script at this path in your repo or - # you can use it by specifying the PACKCHECK_REPO_URL option below in which - # case it will be automatically copied from the packcheck repo to this path - # during CI tests. In any case it is finally invoked from this path. - PACKCHECK: "./packcheck.sh" - # If you have not committed packcheck.sh in your repo at PACKCHECK - # then it is automatically pulled from this URL. - PACKCHECK_GITHUB_URL: "https://raw.githubusercontent.com/composewell/packcheck" - PACKCHECK_GITHUB_COMMIT: "e575ff318c93add2a6d3f9107a52c5e37c666a98" - -executors: - amd64-executor: - docker: - - image: ubuntu:latest - x86-executor: - docker: - - image: i386/ubuntu:focal - -#----------------------------------------------------------------------------- -# Common utility stuff, not to be modified usually -#----------------------------------------------------------------------------- - -preinstall: &preinstall - run: | - apt-get update - # required for https/cache save and restore - apt-get install -y ca-certificates - - # Alternative way of installing ghc and cabal, directly from - # haskell.org instead of using ghcup. NOTE: this is for Debian - # only and is debian release specific. - # gnupg is required for apt-key to work - #apt-get install -y gnupg - #apt-key adv --keyserver keyserver.ubuntu.com --recv-keys BA3CBA3FFE22B574 - #echo "deb http://downloads.haskell.org/debian buster main" >> /etc/apt/sources.list - #apt-get update - - # required for outbound https for stack and for stack setup - apt-get install -y netbase xz-utils make - apt-get install -y zlib1g-dev - - # For ghcup to install ghc - if test -n "$GHCUP_VERSION" - then - apt-get install -y gcc - apt-get install -y g++ - fi - - # libgmp required by ghc for linking - apt-get install -y libgmp-dev - apt-get install -y libtinfo-dev - - # Required by cabal when git URL is specified in project file - apt-get install -y git - - # Required for and by packcheck - apt-get install -y curl - - # Get packcheck if needed - if test ! -e "$PACKCHECK" - then - if test -z "$PACKCHECK_GITHUB_COMMIT" - then - die "PACKCHECK_GITHUB_COMMIT is not specified." - fi - PACKCHECK_URL=${PACKCHECK_GITHUB_URL}/${PACKCHECK_GITHUB_COMMIT}/packcheck.sh - curl --fail -sL -o "$PACKCHECK" $PACKCHECK_URL || exit 1 - chmod +x $PACKCHECK - elif test ! -x "$PACKCHECK" - then - chmod +x $PACKCHECK - fi - -restore: &restore - # Needs to happen after installing ca-certificates - restore_cache: - keys: - - v1-{{ .Environment.CIRCLE_JOB }}-{{ .Branch }} - # Fallback to master branch's cache. - - v1-{{ .Environment.CIRCLE_JOB }}-master - # Fallback to any branch's cache. - - v1-{{ .Environment.CIRCLE_JOB }}- - -save: &save - save_cache: - key: v1-{{ .Environment.CIRCLE_JOB }}-{{ .Branch }} - paths: - - ~/.local - - ~/.cabal - - ~/.stack - - ~/.ghcup - -#----------------------------------------------------------------------------- -# Build matrix -#----------------------------------------------------------------------------- - -jobs: - cabal-ghc-8_6_5: - <<: *env - executor: amd64-executor - steps: - - checkout - - *restore - - *preinstall - - run: - environment: - GHCVER: "8.6.5" - CABALVER: "3.6.2.0" - CABAL_PROJECT: "cabal.project" - DISABLE_SDIST_BUILD: "yes" - CABAL_BUILD_OPTIONS: "--flag debug --flag -opt" - command: | - bash -c "$PACKCHECK cabal" - - *save - cabal-ghc-9_8_1-docspec: - <<: *env - executor: amd64-executor - steps: - - checkout - - *restore - - *preinstall - - run: - environment: - GHCVER: "9.8.1" - CABALVER: "3.10.1.0" - CABAL_PROJECT: "cabal.project.doctest" - DISABLE_SDIST_BUILD: "y" - DISABLE_TEST: "y" - DISABLE_BENCH: "y" - DISABLE_DOCS: "y" - ENABLE_DOCSPEC: "y" - DOCSPEC_URL: https://github.com/phadej/cabal-extras/releases/download/cabal-docspec-0.0.0.20210111/cabal-docspec-0.0.0.20210111.xz - DOCSPEC_OPTIONS: "--timeout 60 --check-properties --property-variables xs" - command: | - sed -i 's/other-modules:/exposed-modules:/g' streamly.cabal - sed -i 's/other-modules:/exposed-modules:/g' core/streamly-core.cabal - bash -c "$PACKCHECK cabal" - - *save - hlint-trailing-spaces: - <<: *env - executor: amd64-executor - steps: - - checkout - - *restore - - *preinstall - - run: - name: hlint and trailing spaces - environment: - DISABLE_SDIST_BUILD: "yes" - HLINT_VERSION: 3.6.1 - HLINT_OPTIONS: lint - HLINT_TARGETS: core/src src test benchmark - command: | - bash -c "$PACKCHECK hlint" || exit 1 - echo "Checking trailing spaces..." - count=$(find . -name "*.hs" -exec grep -H '\ $' {} \; | tee /dev/tty | wc -l) - exit $count - - *save - -workflows: - version: 2 - build: - jobs: - #- cabal-ghc-8_6_5: - # name: 8.6.5-debug-unoptimized - - cabal-ghc-9_8_1-docspec: - name: ghc-9.8.1-docspec - - hlint-trailing-spaces: - name: hlint and trailing spaces diff --git a/.cirrus.yml b/.cirrus.yml deleted file mode 100644 index 888cf88f08..0000000000 --- a/.cirrus.yml +++ /dev/null @@ -1,74 +0,0 @@ -freebsd_instance: - image_family: freebsd-14-2 - -task: - name: FreeBSD+ghc-9.6.6+cabal - env: - LC_ALL: C.UTF-8 - BUILD: cabal - GHCUP_VERSION: 0.1.40.0 - DOCSPEC_URL: https://github.com/phadej/cabal-extras/releases/download/cabal-docspec-0.0.0.20210111/cabal-docspec-0.0.0.20210111.xz - DOCSPEC_OPTIONS: "--timeout 60 --check-properties --property-variables xs" - # GHCUP_GHC_OPTIONS: ${{ matrix.ghcup_ghc_options }} - GHCVER: 9.6.6 - CABALVER: 3.10.1.0 - DISABLE_DOCS: n - ENABLE_DOCSPEC: n - DISABLE_TEST: n - DISABLE_BENCH: n - DISABLE_DIST_CHECKS: y - # SDIST_OPTIONS: ${{ matrix.sdist_options }} - DISABLE_SDIST_BUILD: y - - # Cabal options - CABAL_REINIT_CONFIG: y - # CABAL_BUILD_OPTIONS: ${{ matrix.cabal_build_options }} --flag limit-build-mem - # CABAL_BUILD_TARGETS: ${{ matrix.cabal_build_targets }} - CABAL_PROJECT: cabal.project - CABAL_CHECK_RELAX: y - - # Stack options - # STACK_UPGRADE: "y" - # RESOLVER: ${{ matrix.resolver }} - # STACK_YAML: ${{ matrix.stack_yaml }} - # STACK_BUILD_OPTIONS: ${{ matrix.stack_build_options }} - - # packcheck location and revision - PACKCHECK: "./packcheck.sh" - PACKCHECK_GITHUB_URL: "https://raw.githubusercontent.com/composewell/packcheck" - PACKCHECK_GITHUB_COMMIT: "v0.7.1" - - # Pull token from "secrets" setting of the github repo - # COVERALLS_TOKEN: ${{ secrets.COVERALLS_TOKEN }} - # COVERAGE: ${{ matrix.coverage }} - - # hlint - # HLINT_VERSION: 3.6.1 - # HLINT_OPTIONS: "lint" - # HLINT_TARGETS: "core/src src test benchmark" - - # Subdir - # SUBDIR: ${{ matrix.subdir }} - - deps_install_script: | - pkg install -y gmake - pkg install -y bash - - packcheck_install_script: | - if test ! -e "$PACKCHECK" - then - if test -z "$PACKCHECK_GITHUB_COMMIT" - then - die "PACKCHECK_GITHUB_COMMIT is not specified." - fi - PACKCHECK_URL=${PACKCHECK_GITHUB_URL}/${PACKCHECK_GITHUB_COMMIT}/packcheck.sh - curl --fail -sL -o "$PACKCHECK" $PACKCHECK_URL || exit 1 - chmod +x $PACKCHECK - elif test ! -x "$PACKCHECK" - then - chmod +x $PACKCHECK - fi - - packcheck_run_script: | - export PATH=$HOME/.local/bin:$HOME/.ghcup/bin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/local/opt/curl/bin - bash -c "$PACKCHECK $BUILD" diff --git a/.github/workflows/haskell.yml b/.github/workflows/haskell.yml index 8c6cb24692..1580bdfa43 100644 --- a/.github/workflows/haskell.yml +++ b/.github/workflows/haskell.yml @@ -34,6 +34,7 @@ jobs: # default (ncpus) is good, this can be checked from the packcheck # output in case it changes. CABAL_BUILD_OPTIONS: ${{ matrix.cabal_build_options }} + # CABAL_TEST_OPTIONS: -j1 CABAL_BUILD_TARGETS: ${{ matrix.cabal_build_targets }} CABAL_PROJECT: ${{ matrix.cabal_project }} CABAL_CHECK_RELAX: y @@ -47,7 +48,7 @@ jobs: # packcheck location and revision PACKCHECK: "./packcheck.sh" PACKCHECK_GITHUB_URL: "https://raw.githubusercontent.com/composewell/packcheck" - PACKCHECK_GITHUB_COMMIT: "e575ff318c93add2a6d3f9107a52c5e37c666a98" + PACKCHECK_GITHUB_COMMIT: "8c61fb67ee860ad86049ab17e31bfa8f368b73cf" # Pull token from "secrets" setting of the github repo COVERALLS_TOKEN: ${{ secrets.COVERALLS_TOKEN }} @@ -68,7 +69,7 @@ jobs: matrix: # The order is important to optimize fail-fast. name: - - 9.10.1-Werror + - 9.2.8 # - 9.8.1-docspec # - 8.10.7-coverage @@ -76,176 +77,16 @@ jobs: # run. But we need at least one test where we test without # cabal.project because that is how hackage would build it. include: - - name: head - ghc_version: head - # The URL may change, to find a working URL go to https://gitlab.haskell.org/ghc/ghc/-/jobs/ - # Find a debian10/11/12 job, click on a passed/failed status, at the - # end of the output you will find the tar.xz name, put that tar - # name after "raw/", and put the job name after "job=". - # Also see https://github.com/mpickering/ghc-artefact-nix/blob/master/gitlab-artifact.nix - # - # May also use ghcup for installing ghc head version, use the - # version "LatestNightly", and the following config: - # ghcup config add-release-channel https://ghc.gitlab.haskell.org/ghcup-metadata/ghcup-nightlies-0.0.7.yaml - ghcup_ghc_options: "-u https://gitlab.haskell.org/ghc/ghc/-/jobs/artifacts/master/raw/ghc-x86_64-linux-deb10-int_native-validate.tar.xz?job=x86_64-linux-deb10-int_native-validate" - runner: ubuntu-latest - build: cabal - cabal_build_options: "--flag limit-build-mem" - cabal_version: 3.12.1.0 - cabal_project: cabal.project.ghc-head - disable_sdist_build: "y" - ignore_error: true - - name: 9.12.1 - ghc_version: 9.12.1 - runner: ubuntu-latest - build: cabal - cabal_build_options: "--flag limit-build-mem" - cabal_version: 3.12.1.0 - disable_sdist_build: "y" - cabal_project: cabal.project - ignore_error: false - # Note: use linux for warning build for convenient dev testing - - name: 9.10.1-Werror - ghc_version: 9.10.1 - runner: ubuntu-latest - build: cabal - cabal_build_options: "--flag limit-build-mem" - cabal_version: 3.12.1.0 - disable_sdist_build: "y" - cabal_project: cabal.project.Werror - ignore_error: false - - name: 9.10.1-macos - ghc_version: 9.10.1 - runner: macos-latest - build: cabal - cabal_build_options: "--flag limit-build-mem" - cabal_version: 3.12.1.0 - disable_sdist_build: "y" - cabal_project: cabal.project - ignore_error: false - - name: 9.10.1-fusion-inspection - ghc_version: 9.10.1 - runner: ubuntu-latest - build: cabal - cabal_version: 3.12.1.0 - disable_sdist_build: "y" - cabal_project: cabal.project - cabal_build_options: "--flag fusion-plugin --flag inspection" - ignore_error: false - - name: 9.8.2-macos-stack - runner: macos-latest - build: stack - resolver: nightly-2024-09-26 - stack_yaml: stack.yaml - disable_docs: "y" - disable_sdist_build: "y" - disable_dist_checks: "y" - disable_test: "y" - disable_bench: "y" - #sdist_options: "--ignore-check" - stack_build_options: "-v" - cabal_version: 3.12.1.0 - ignore_error: true - # - name: 9.8.1-docspec - # ghc_version: 9.8.1 - # runner: ubuntu-latest - # build: cabal - # cabal_version: 3.10.1.0 - # cabal_project: cabal.project.doctest - # disable_test: "y" - # disable_bench: "y" - # disable_docs: "y" - # enable_docspec: "y" - # disable_sdist_build: "y" - # ignore_error: false - - name: 9.8.1-fusion-inspection - ghc_version: 9.8.1 - runner: ubuntu-latest - build: cabal - cabal_version: 3.12.1.0 - disable_sdist_build: "y" - cabal_project: cabal.project - cabal_build_options: "--flag fusion-plugin --flag inspection" - ignore_error: false - - name: 9.6.3-macos - ghc_version: 9.6.3 - runner: macos-latest - build: cabal - cabal_version: 3.10.1.0 - disable_sdist_build: "y" - cabal_project: cabal.project - ignore_error: false - - name: 9.4.7-lstat-readir - ghc_version: 9.4.7 - runner: ubuntu-latest - build: cabal - cabal_build_options: "--flag force-lstat-readdir" - cabal_version: 3.8.1.0 - disable_sdist_build: "y" - cabal_project: cabal.project - ignore_error: false - name: 9.2.8 ghc_version: 9.2.8 + ghcup_ghc_options: "-u https://s3.ap-south-1.amazonaws.com/downloads.portal.composewell.com/ghc/ghc-9.2.8-x86_64-unknown-linux.tar.xz" runner: ubuntu-latest build: cabal cabal_project: cabal.project cabal_version: 3.6.2.0 disable_sdist_build: "y" ignore_error: false - - name: 9.0.2-streamly-sdist - ghc_version: 9.0.2 - runner: ubuntu-latest - build: cabal - cabal_version: 3.6.2.0 - cabal_project: cabal.project.streamly - ignore_error: true - - name: 9.0.2-streamly-core-sdist - ghc_version: 9.0.2 - runner: ubuntu-latest - build: cabal - cabal_version: 3.6.2.0 - subdir: core - ignore_error: false - - name: 8.10.7-noopt - ghc_version: 8.10.7 - runner: ubuntu-latest - build: cabal - cabal_version: 3.6.2.0 - cabal_project: cabal.project - disable_sdist_build: "y" - disable_docs: "y" - disable_dist_checks: "y" - cabal_build_options: "--flags \"-opt\"" - ignore_error: false - # - name: 8.10.7-coverage - # ghc_version: 8.10.7 - # runner: ubuntu-latest - # coverage: "y" - # cabal_version: 3.6.2.0 - # ignore_error: false - - name: 8.8.4 - ghc_version: 8.8.4 - runner: ubuntu-latest - build: cabal - cabal_version: 3.6.2.0 - cabal_project: cabal.project - disable_sdist_build: "y" - disable_docs: "y" - ignore_error: false - - name: 8.6.5-debug-unoptimized - ghc_version: 8.6.5 - runner: ubuntu-latest - build: cabal - cabal_version: 3.6.2.0 - cabal_project: cabal.project - cabal_build_options: "--flag debug --flag -opt" - disable_sdist_build: "y" - disable_docs: "y" - ignore_error: false - # - name: hlint - # build: hlint - # runner: ubuntu-latest - # ignore_error: true + disable_bench: "y" steps: - uses: actions/checkout@v2 diff --git a/.github/workflows/packdiff.yml b/.github/workflows/packdiff.yml deleted file mode 100644 index 6ff313b9e4..0000000000 --- a/.github/workflows/packdiff.yml +++ /dev/null @@ -1,39 +0,0 @@ -name: Packdiff - -on: pull_request - -jobs: - packdiff: - - runs-on: ubuntu-latest - - steps: - - - name: Download ghc - run: | - GHCUP_VER=0.1.20.0 - curl -sL -o ./ghcup https://downloads.haskell.org/~ghcup/$GHCUP_VER/x86_64-linux-ghcup-$GHCUP_VER - chmod +x ./ghcup - GHCVER=9.8.1 - ./ghcup install ghc $GHCVER - ./ghcup set ghc $GHCVER - cabal update - - - uses: actions/cache@v4 - name: Cache ~/.cabal - with: - path: | - ~/.cabal - # Bump the key version to clear the cache - key: cache-v2 - - - name: Checkout the current branch - uses: actions/checkout@v2 - with: - fetch-depth: 0 - - - name: Run packdiff on streamly-core - run: cabal run packdiff --project-file=cabal.project.packdiff -- diff streamly-core $(git rev-parse origin/master) streamly-core $(git rev-parse HEAD) - - - name: Run packdiff on streamly - run: cabal run packdiff --project-file=cabal.project.packdiff -- diff streamly $(git rev-parse origin/master) streamly $(git rev-parse HEAD) diff --git a/.github/workflows/regression-check.yml b/.github/workflows/regression-check.yml deleted file mode 100644 index abed634fc0..0000000000 --- a/.github/workflows/regression-check.yml +++ /dev/null @@ -1,175 +0,0 @@ -name: Regression checking - -on: - workflow_dispatch: - pull_request: - -# References: -# https://docs.github.com/en/actions/managing-workflow-runs/manually-running-a-workflow -# https://docs.github.com/en/actions/using-workflows/reusing-workflows#reusable-workflows-and-starter-workflows -# https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#onworkflow_call -# https://docs.github.com/en/actions/learn-github-actions/contexts#about-contexts-and-expressions - -# You can override the default DIFF_CUTOFF_PERCENT by specifying a cutoff along -# with the benchmark target. -# Eg, "Data.Async:12" where "Data.Async" is the benchmark target, ":" is the -# seperator, and "12" is the new cutoff percent -#---------------------------------------------------------------------- -#-- Benchmarks listed in alphabetical order -#---------------------------------------------------------------------- -jobs: - check-regressions: - env: - CI_BENCHMARKS_WITH_CUTOFF: >- - Data.Array - Data.Array.Generic - Data.Array.Stream - Data.Fold - Data.Fold.Prelude - Data.Fold.Window - Data.MutArray - Data.Parser - Data.ParserK - Data.ParserK.Chunked - Data.ParserK.Chunked.Generic - Data.RingArray - Data.Scanl.Window - Data.Serialize - Data.Stream - Data.Stream.Concurrent - Data.Stream.ConcurrentEager - Data.Stream.ConcurrentInterleaved - Data.Stream.ConcurrentOrdered - Data.StreamK:6 - Data.Unbox - Data.Unbox.Derive.TH - Data.Unfold - FileSystem.DirIO - FileSystem.Handle - Unicode.Parser - Unicode.Stream - CI_FIELDS: allocated - CI_DIFF_CUTOFF_PERCENT: 3 - - runs-on: ubuntu-latest - - steps: - - - name: Update environment - run: | - CI_BENCHMARKS="" - for i in $CI_BENCHMARKS_WITH_CUTOFF - do - bname=$(echo "$i" | cut -d: -f1) - CI_BENCHMARKS="$CI_BENCHMARKS $bname" - done - echo "CI_BENCHMARKS=$CI_BENCHMARKS" >> $GITHUB_ENV - - - name: Download ghc - run: | - GHCUP_VER=0.1.18.0 - curl -sL -o ./ghcup https://downloads.haskell.org/~ghcup/$GHCUP_VER/x86_64-linux-ghcup-$GHCUP_VER - chmod +x ./ghcup - GHCVER=9.2.7 - ./ghcup install ghc $GHCVER - ./ghcup set ghc $GHCVER - cabal update - - - uses: actions/cache@v4 - name: Cache ~/.cabal - with: - path: | - ~/.cabal - # Bump the key version to clear the cache - key: cache-v2 - - - name: Cache bench-runner from pr - id: cache-bench-runner-pr - uses: actions/cache@v4 - with: - path: bench-runner - # Bump the key version to clear the cache - key: bench-runner-v1 - - # ----------------------------------------------------------------- - # -- Install bench-report in the current directory - # ----------------------------------------------------------------- - - - name: Checkout the current branch - uses: actions/checkout@v2 - with: - clean: false - - - name: Install bench-runner - run: | - cabal install bench-runner --project-file=cabal.project.report --installdir=./ - - # ----------------------------------------------------------------- - # -- Generate reports for the base branch and upload - # ----------------------------------------------------------------- - - - name: Checkout the base branch - uses: actions/checkout@v2 - with: - ref: master - clean: false - - - name: Run benchmarks - run: | - ./bench-runner --package-name streamly-benchmarks --package-version 0.0.0 --targets "$CI_BENCHMARKS" --raw - - - name: Move charts to charts-master - run: mv charts charts-master - - # ----------------------------------------------------------------- - # -- Download, generate reports for the current branch and append - # ----------------------------------------------------------------- - - - name: Checkout the current branch - uses: actions/checkout@v2 - with: - clean: false - - - name: Copy charts-master to charts - run: cp -r charts-master charts - - - name: Run benchmarks and append - run: | - ./bench-runner --package-name streamly-benchmarks --package-version 0.0.0 --targets "$CI_BENCHMARKS" --raw --append - - # ----------------------------------------------------------------- - # -- Compare - # ----------------------------------------------------------------- - - - name: List all benchmarks - run: | - ./bench-runner --package-name streamly-benchmarks --package-version 0.0.0 --targets "$CI_BENCHMARKS" --no-measure - - - name: Compare benchmarks - run: | - - EXIT_STATUS=0 - - for i in $CI_BENCHMARKS_WITH_CUTOFF - do - arrI=(${i//:/ }) - - bname=${arrI[0]} - cutoff=${arrI[1]} - - test -z "$cutoff" && cutoff=$CI_DIFF_CUTOFF_PERCENT - - echo - echo "Checking $bname for regressions greater than $cutoff percent" - ! ./bench-runner \ - --package-name streamly-benchmarks \ - --package-version 0.0.0 \ - --targets "$bname" \ - --fields "$CI_FIELDS" \ - --no-measure --silent \ - --diff-cutoff-percent $cutoff \ - | grep -v "^$" - test $? -eq 1 && EXIT_STATUS=1 - done - - exit $EXIT_STATUS diff --git a/appveyor.yml b/appveyor.yml deleted file mode 100644 index 395dd48054..0000000000 --- a/appveyor.yml +++ /dev/null @@ -1,95 +0,0 @@ -# packcheck-0.4.2 -# You can use any of the options supported by packcheck as environment -# variables here. See https://github.com/harendra-kumar/packcheck for all -# options and their explanation. -branches: - only: - - master - -environment: - # ------------------------------------------------------------------------ - # Global options, you can use these per build as well - # ------------------------------------------------------------------------ - global: - # ------------------------------------------------------------------------ - # Common options - # ------------------------------------------------------------------------ - # GHC 9.2.7 onwards redundant constraint warnings are incompatible with - # older versions - GHC_OPTIONS: "-Werror" - CABAL_REINIT_CONFIG: "y" - LC_ALL: "C.UTF-8" - - # ------------------------------------------------------------------------ - # What to build - # ------------------------------------------------------------------------ - # DISABLE_TEST: "y" - # DISABLE_BENCH: "y" - # DISABLE_DOCS: "y" - DISABLE_SDIST_BUILD: "y" - DISABLE_DIST_CHECKS: "y" - ENABLE_INSTALL: "y" - - # ------------------------------------------------------------------------ - # stack options - # ------------------------------------------------------------------------ - # Note requiring a specific version of stack using STACKVER may fail due to - # github API limit while checking and upgrading/downgrading to the specific - # version. - # STACKVER: "1.6.5" - STACK_UPGRADE: "y" - # RESOLVER: "lts-18.27" - STACK_ROOT: "c:\\sr" - STACK_BUILD_OPTIONS: "--flag streamly-benchmarks:-opt" - STACK_YAML: "stack.yaml" - - # ------------------------------------------------------------------------ - # cabal options - # ------------------------------------------------------------------------ - CABAL_CHECK_RELAX: "y" - - # ------------------------------------------------------------------------ - # Where to find the required tools - # ------------------------------------------------------------------------ - PATH: "%PATH%;%APPDATA%\\local\\bin" - LOCAL_BIN: "%APPDATA%\\local\\bin" - - # ------------------------------------------------------------------------ - # Location of packcheck.sh (the shell script invoked to perform CI tests ). - # ------------------------------------------------------------------------ - # You can either commit the packcheck.sh script at this path in your repo or - # you can use it by specifying the PACKCHECK_REPO_URL option below in which - # case it will be automatically copied from the packcheck repo to this path - # during CI tests. In any case it is finally invoked from this path. - PACKCHECK_LOCAL_PATH: "./packcheck.sh" - # If you have not committed packcheck.sh in your repo at PACKCHECK_LOCAL_PATH - # then it is automatically pulled from this URL. - PACKCHECK_GITHUB_URL: "https://raw.githubusercontent.com/composewell/packcheck" - PACKCHECK_GITHUB_COMMIT: "101c73b53473ddfb763d65058b80123991cfeb4f" - - # Override the temp directory to avoid sed escaping issues - # See https://github.com/haskell/cabal/issues/5386 - TMP: "c:\\tmp" - -cache: - - "%STACK_ROOT%" - - "%LOCAL_BIN%" - - "%APPDATA%\\cabal" - - "%APPDATA%\\ghc" -# - "%LOCALAPPDATA%\\Programs\\stack" - -clone_folder: "c:\\pkg" -build: off - -before_test: -- if not exist %PACKCHECK_LOCAL_PATH% curl -sSkL -o%PACKCHECK_LOCAL_PATH% %PACKCHECK_GITHUB_URL%/%PACKCHECK_GITHUB_COMMIT%/packcheck.sh -- if not exist %LOCAL_BIN% mkdir %LOCAL_BIN% -- where stack.exe || curl -sSkL -ostack.zip http://www.stackage.org/stack/windows-x86_64 && 7z x stack.zip stack.exe && move stack.exe %LOCAL_BIN% -- if defined STACKVER (stack upgrade --binary-only --binary-version %STACKVER%) else (stack upgrade --binary-only || ver > nul) -- stack --version - -test_script: -- stack setup > nul -- for /f "usebackq tokens=*" %%i in (`where 7z.exe`) do set PATH7Z=%%i\.. -- for /f "usebackq tokens=*" %%i in (`where git.exe`) do set PATHGIT=%%i\.. -- chcp 65001 && stack exec bash -- -c "chmod +x %PACKCHECK_LOCAL_PATH%; %PACKCHECK_LOCAL_PATH% stack PATH=/usr/bin:\"%PATH7Z%\":\"%PATHGIT%\"" diff --git a/test/Streamly/Test/FileSystem/Event.hs b/test/Streamly/Test/FileSystem/Event.hs index 6ede989650..601fc4cd23 100644 --- a/test/Streamly/Test/FileSystem/Event.hs +++ b/test/Streamly/Test/FileSystem/Event.hs @@ -14,12 +14,15 @@ module Streamly.Test.FileSystem.Event (main) where import qualified Streamly.Internal.FileSystem.Event as Event import Streamly.Test.FileSystem.Event.Common +tempPrefix :: String +tempPrefix = "fsevent_common" + moduleName :: String moduleName = "FileSystem.Event" main :: IO () main = do - let run = runTests moduleName "non-recursive" Event.watch + let run = runTests tempPrefix moduleName "non-recursive" Event.watch run DirType commonTests run #if defined(CABAL_OS_DARWIN) diff --git a/test/Streamly/Test/FileSystem/Event/Common.hs b/test/Streamly/Test/FileSystem/Event/Common.hs index 6960c1973a..17bcff33c6 100644 --- a/test/Streamly/Test/FileSystem/Event/Common.hs +++ b/test/Streamly/Test/FileSystem/Event/Common.hs @@ -12,6 +12,7 @@ module Streamly.Test.FileSystem.Event.Common ( TestDesc -- * Running tests + , runDiagnostics , runTests , WatchRootType (..) @@ -86,7 +87,7 @@ import Streamly.Internal.FileSystem.Event (Event) import qualified Streamly.Internal.FileSystem.Event as Event #endif -import Test.Hspec +-- import Test.Hspec ------------------------------------------------------------------------------- -- Check generated events @@ -153,15 +154,15 @@ data WatchRootType = -- Event contains path via the original symlink deriving Show -driver :: EventChecker -> WatchRootType -> TestDesc -> SpecWith () -driver checker symlinkStyle (desc, pre, ops, expected) = - it desc $ runOneTest `shouldReturn` () +-- driver :: EventChecker -> WatchRootType -> TestDesc -> SpecWith () +driver :: String -> EventChecker -> WatchRootType -> TestDesc -> IO () +driver fseventDir checker symlinkStyle (desc, pre, ops, expected) = do + -- it desc $ runOneTest `shouldReturn` () + putStrLn $ "Running: " ++ desc + runOneTest where - fseventDir :: String - fseventDir = "fsevent_dir" - runOneTest = do sync <- newEmptyMVar withSystemTempDirectory fseventDir $ \fp -> do @@ -309,31 +310,33 @@ rootDirMove suffix events = -- File tests ------------------------------------------------------------------------------- -createFileWithParent :: FilePath -> FilePath -> IO () -createFileWithParent file parent = do +createFile :: FilePath -> FilePath -> IO () +createFile file parent = do let filepath = parent file let dir = takeDirectory filepath - putStrLn $ "createFileWithParent: file [" - ++ file ++ "] dir [" ++ dir ++ "]" - putStrLn $ "Ensuring dir: " ++ dir - createDirectoryIfMissing True dir r <- doesDirectoryExist dir if r then do - putStrLn $ "Ensured dir: " ++ dir + putStrLn $ "createFile: directory exists: " ++ dir when (not (null file)) $ do exists <- doesFileExist filepath if not exists then do - putStrLn $ "Creating file: " ++ (parent file) + putStrLn $ "createFile: Creating file: " ++ (parent file) openFile (parent file) WriteMode >>= hClose - putStrLn $ "Created file: " ++ (parent file) - else error $ "File exists: " ++ filepath - else error $ "Could not create dir: " ++ dir + putStrLn $ "createFile: Created file: " ++ (parent file) + else error $ "createFile: File exists: " ++ filepath + else error $ "createFile: directory does not exist: " ++ dir -createFile :: FilePath -> FilePath -> IO () -createFile file parent = - openFile (parent file) WriteMode >>= hClose +createFileWithParent :: FilePath -> FilePath -> IO () +createFileWithParent file parent = do + let filepath = parent file + let dir = takeDirectory filepath + putStrLn $ "createFileWithParent: file [" + ++ file ++ "] dir [" ++ dir ++ "]" + putStrLn $ "Ensuring dir: " ++ dir + createDirectoryIfMissing True dir + createFile file parent fileCreate :: String -> (String -> [(String, Event -> Bool)]) -> TestDesc fileCreate file1 events = @@ -433,12 +436,17 @@ commonRecTests = testsWithParent "subdir" runTests :: String -> String + -> String -> EventWatcher -> WatchRootType -> [TestDesc] -> IO () -runTests modName watchType watcher rootType tests = do +runTests tempPrefix modName watchType watcher rootType tests = do + putStrLn $ "Running tests, module: " ++ modName + ++ " watchType: " ++ watchType hSetBuffering stdout NoBuffering + let checker = checkEvents watcher + {- hspec $ describe modName $ describe watchType @@ -446,3 +454,71 @@ runTests modName watchType watcher rootType tests = do let checker = checkEvents watcher describe ("Root type " ++ show rootType) $ mapM_ (driver checker rootType) tests + -} + mapM_ (driver tempPrefix checker rootType) tests + +diagDriver :: EventChecker -> TestDesc -> IO () +diagDriver checker (desc, pre, ops, expected) = do + putStrLn $ "Running diag: " ++ desc + sync <- newEmptyMVar + withSystemTempDirectory "fsevent_dir_diag" $ \fp -> do + let root = fp "watch-root-diag" + createDirectory root + + -- XXX On macOS we seem to get the watch root create events + -- even though they occur before the watch is started. Even if + -- we add a delay here. + startWatchAndCheck root sync + + where + + startWatchAndCheck root sync = do + putStrLn ("Before pre op: root [" <> root <> "]") + pre root + putStrLn ("After pre op: root [" <> root <> "]") + let check = checker root root sync expected + fsOps = Stream.fromEffect $ runFSOps root sync + Stream.drain + $ Stream.parListEagerFst [Stream.fromEffect check, fsOps] + + runFSOps root sync = do + -- We put the MVar before the event watcher starts to run but that does + -- not ensure that the event watcher has actually started. So we need a + -- delay as well. Do we? + takeMVar sync >> threadDelay 200000 + putStrLn ("Before fs ops: root [" <> root <> "]") + ops root + putStrLn ("After fs ops: root [" <> root <> "]") + threadDelay 10000000 + error $ root <> ": Time out occurred before event watcher could terminate" + +checkDiag :: EventChecker +checkDiag rootPath targetPath mvar matchList = do + putStrLn ("Watching on root [" <> rootPath + <> "] for [" <> targetPath <> "]") + + let matchList1 = fmap (first (targetPath )) matchList + finder xs ev = filter (not . eventMatches ev) xs + + paths <- mapM toUtf8 [rootPath] +#if defined(FILESYSTEM_EVENT_LINUX) + Event.watchWith (Event.setAllEvents True) +#elif defined(FILESYSTEM_EVENT_DARWIN) + Event.watchWith (Event.setAllEvents True) +#elif defined(FILESYSTEM_EVENT_WINDOWS) + Event.watchWith (Event.setAllEvents True) +#else + Event.watch +#endif + (NonEmpty.fromList paths) + & Stream.before (putMVar mvar ()) + & Stream.trace (putStrLn . Event.showEvent) + & Stream.scanl' finder matchList1 + & Stream.takeWhile (not . null) + & Stream.drain + +runDiagnostics :: [TestDesc] -> IO () +runDiagnostics tests = do + putStrLn $ "Running diag tests" + hSetBuffering stdout NoBuffering + mapM_ (diagDriver checkDiag) tests diff --git a/test/Streamly/Test/FileSystem/Event/Darwin.hs b/test/Streamly/Test/FileSystem/Event/Darwin.hs index d99b394c1c..173391cb86 100644 --- a/test/Streamly/Test/FileSystem/Event/Darwin.hs +++ b/test/Streamly/Test/FileSystem/Event/Darwin.hs @@ -14,6 +14,9 @@ import qualified Streamly.Internal.FileSystem.Event.Darwin as Event import Streamly.Test.FileSystem.Event.Common +tempPrefix :: String +tempPrefix = "fsevent_darwin" + moduleName :: String moduleName = "FileSystem.Event.Darwin" @@ -81,7 +84,7 @@ main = do ] let w = Event.watchWith (Event.setAllEvents True) - run = runTests moduleName "recursive" w + run = runTests tempPrefix moduleName "recursive" w run DirType regularRootTests run SymLinkResolvedPath symLinkRootTests diff --git a/test/Streamly/Test/FileSystem/Event/Linux.hs b/test/Streamly/Test/FileSystem/Event/Linux.hs index b1003bc639..504b65a098 100644 --- a/test/Streamly/Test/FileSystem/Event/Linux.hs +++ b/test/Streamly/Test/FileSystem/Event/Linux.hs @@ -10,6 +10,7 @@ -- module Streamly.Test.FileSystem.Event.Linux (main) where +-- import Control.Monad (replicateM) import Streamly.Internal.FileSystem.Event.Linux (Event) -- #if __GLASGOW_HASKELL__ == 902 #if 1 @@ -21,6 +22,9 @@ import Streamly.Test.FileSystem.Event.Common #define DEVBUILD +tempPrefix :: String +tempPrefix = "fsevent_linux" + moduleName :: String moduleName = "FileSystem.Event.Linux" @@ -83,6 +87,8 @@ fileMoveEvents src dst = main :: IO () main = do + -- _ <- replicateM 100 $ runDiagnostics [fileCreate "file" fileTouchEvents] + -- We ignore the events on root/parent dir during regular non-root dir/file -- tests. @@ -111,7 +117,7 @@ main = do regSymTests let w = Event.watchWith (Event.setAllEvents True) - run = runTests moduleName "non-recursive" w + run = runTests tempPrefix moduleName "non-recursive" w #if 1 let failingTests = @@ -147,7 +153,7 @@ main = do let recw = Event.watchWith (Event.setAllEvents True . Event.setRecursiveMode True) - runRec = runTests moduleName "recursive" recw + runRec = runTests tempPrefix moduleName "recursive" recw #ifdef DEVBUILD -- In recursive mode all subdirectories are roots therefore they will diff --git a/test/Streamly/Test/FileSystem/Event/Windows.hs b/test/Streamly/Test/FileSystem/Event/Windows.hs index 4e8172c7e9..90c6333faa 100644 --- a/test/Streamly/Test/FileSystem/Event/Windows.hs +++ b/test/Streamly/Test/FileSystem/Event/Windows.hs @@ -16,6 +16,9 @@ import Streamly.Test.FileSystem.Event.Common moduleName :: String moduleName = "FileSystem.Event.Windows" +tempPrefix :: String +tempPrefix = "fsevent_windows" + -- TODO Test isModified event for parent directories when a file is created or -- deleted. @@ -33,7 +36,7 @@ main = do -- ++ dirDelete "" (\dir -> [(dir, Event.isDeleted)]) let w = Event.watchWith (Event.setAllEvents True) - run = runTests moduleName "non-recursive" w + run = runTests tempPrefix moduleName "non-recursive" w run DirType regularRootTests run SymLinkOrigPath commonTests @@ -47,7 +50,7 @@ main = do let recw = Event.watchWith (Event.setAllEvents True . Event.setRecursiveMode True) - runRec = runTests moduleName "recursive" recw + runRec = runTests tempPrefix moduleName "recursive" recw runRec DirType (regularRootTests ++ recTests) runRec SymLinkOrigPath (commonTests ++ recTests)