From fd8e10168164295c7ba6cacd1ea3c88d7f3dc0f0 Mon Sep 17 00:00:00 2001 From: Alexey Kuleshevich Date: Sat, 28 Oct 2023 18:25:23 +0200 Subject: [PATCH 1/4] Update ghc versions on CI --- .github/workflows/ci.yaml | 21 ++++++++++++--------- random.cabal | 6 ++++-- 2 files changed, 16 insertions(+), 11 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index a5359673..8aba117a 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -24,9 +24,10 @@ jobs: - { os: ubuntu-latest, ghc: "8.8.4" } - { os: ubuntu-latest, ghc: "8.10.7" } - { os: ubuntu-latest, ghc: "9.0.2" } - - { os: ubuntu-latest, ghc: "9.2.7" } - - { os: ubuntu-latest, ghc: "9.4.4" } - - { os: ubuntu-latest, ghc: "9.6.1" } + - { os: ubuntu-latest, ghc: "9.2.8" } + - { os: ubuntu-latest, ghc: "9.4.7" } + - { os: ubuntu-latest, ghc: "9.6.3" } + - { os: ubuntu-latest, ghc: "9.8.1" } # MacOS - { os: macOS-latest, ghc: "8.0.2" } - { os: macOS-latest, ghc: "8.2.2" } @@ -35,9 +36,10 @@ jobs: - { os: macOS-latest, ghc: "8.8.4" } - { os: macOS-latest, ghc: "8.10.7" } - { os: macOS-latest, ghc: "9.0.2" } - - { os: macOS-latest, ghc: "9.2.7" } - - { os: macOS-latest, ghc: "9.4.4" } - - { os: macOS-latest, ghc: "9.6.1" } + - { os: macOS-latest, ghc: "9.2.8" } + - { os: macOS-latest, ghc: "9.4.7" } + - { os: macOS-latest, ghc: "9.6.3" } + - { os: macOS-latest, ghc: "9.8.1" } # Windows - { os: windows-latest, ghc: "8.0.2" } - { os: windows-latest, ghc: "8.2.2" } @@ -46,9 +48,10 @@ jobs: - { os: windows-latest, ghc: "8.8.4" } - { os: windows-latest, ghc: "8.10.7" } - { os: windows-latest, ghc: "9.0.2" } - - { os: windows-latest, ghc: "9.2.7" } - - { os: windows-latest, ghc: "9.4.4" } - - { os: windows-latest, ghc: "9.6.1" } + - { os: windows-latest, ghc: "9.2.8" } + - { os: windows-latest, ghc: "9.4.7" } + - { os: windows-latest, ghc: "9.6.3" } + - { os: windows-latest, ghc: "9.8.1" } steps: - uses: actions/checkout@v3 diff --git a/random.cabal b/random.cabal index 16d94b34..969527a8 100644 --- a/random.cabal +++ b/random.cabal @@ -70,8 +70,10 @@ tested-with: GHC == 8.0.2 , GHC == 8.8.4 , GHC == 8.10.7 , GHC == 9.0.2 - , GHC == 9.2.4 - , GHC == 9.4.1 + , GHC == 9.2.8 + , GHC == 9.4.7 + , GHC == 9.6.3 + , GHC == 9.8.1 source-repository head type: git From 9be7c07aecdcbbeb025e81b0738b74a32e5527ed Mon Sep 17 00:00:00 2001 From: Alexey Kuleshevich Date: Sat, 28 Oct 2023 19:37:40 +0200 Subject: [PATCH 2/4] Fix coverage and simplify stack CI --- .github/workflows/ci.yaml | 78 +++++++++++++++++++++------------------ random.cabal | 31 +++++----------- stack-coveralls.yaml | 12 ++---- 3 files changed, 54 insertions(+), 67 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 8aba117a..e932ae71 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -8,6 +8,11 @@ on: defaults: { run: { shell: bash } } +# Cancel running actions when a new action on the same PR is started +concurrency: + group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} + cancel-in-progress: true + jobs: build-cabal: name: CI-cabal @@ -87,40 +92,46 @@ jobs: fail-fast: false matrix: os: [ubuntu-latest] - resolver: [nightly, lts-20, lts-19, lts-18, lts-16, lts-14, lts-12, lts-11] + resolver: [nightly, lts-21, lts-20, lts-19, lts-18, lts-16, lts-14, lts-12, lts-11] include: - resolver: lts-11 - ghc: 8.2.2 + ghc: '8.2.2' stack-yaml: stack-old.yaml - resolver: lts-12 - ghc: 8.4.4 + ghc: '8.4.4' stack-yaml: stack-old.yaml - resolver: lts-14 - stack-yaml: stack-coveralls.yaml + ghc: '8.6.5' + stack-yaml: stack-old.yaml - resolver: lts-16 - ghc: 8.8.4 + ghc: '8.8.4' stack-yaml: stack-old.yaml - resolver: lts-18 - ghc: 8.10.7 + ghc: '8.10.7' stack-yaml: stack.yaml - resolver: lts-19 - ghc: 9.0.2 - stack-yaml: stack.yaml + ghc: '9.0.2' + stack-yaml: stack-coveralls.yaml - resolver: lts-20 - ghc: 9.2.7 + ghc: '9.2.8' + stack-yaml: stack.yaml + - resolver: lts-21 + ghc: '9.4.7' stack-yaml: stack.yaml - resolver: nightly stack-yaml: stack.yaml # Latest stable for MacOS: ghc-8.8.4 - resolver: lts-16 os: macos-latest + ghc: '8.8.4' stack-yaml: stack-old.yaml # Latest stable for Windows: ghc-8.6.4 - resolver: lts-14 os: windows-latest - stack-yaml: stack-coveralls.yaml + ghc: '8.6.5' + stack-yaml: stack-old.yaml env: - STACK_YAML: stack.yaml + STACK_YAML: '${{ matrix.stack-yaml }}' STACK_ARGS: '--resolver ${{ matrix.resolver }} --system-ghc' cache-version: v5 # bump up this version to invalidate currently stored cache steps: @@ -161,44 +172,39 @@ jobs: if: matrix.os == 'windows-latest' with: path: | - C:\\Users\\RUNNER~1\\AppData\\Roaming\\stack C:\\Users\\RUNNER~1\\AppData\\Local\\Programs\\stack key: ${{ runner.os }}-${{ matrix.resolver }}-programs-${{ env.cache-version }} restore-keys: | ${{ runner.os }}-${{ matrix.resolver }}-programs-${{ env.cache-version }} - - name: Install Stack and GHC + - name: Reset modtime run: | set -ex - curl -sSL https://get.haskellstack.org/ | sh -s - -f - curl -sSL https://raw.githubusercontent.com/lehins/utils/c426e74aa129b7cb14e83305fd2639ccc41b03cd/haskell/git-modtime/git-modtime.hs -o git-modtime.hs - [ -n "${{ matrix.ghc }}" ] && [ "${{ matrix.os }}" == "ubuntu-latest" ] && STACK_ARGS="$STACK_ARGS --system-ghc" - [ -n "${{ matrix.stack-yaml }}" ] && STACK_YAML=${{ matrix.stack-yaml }} - # git-modtime.hs updates modification time of files to the latest commit time that - # a file was modified in. This ensures that stack does not rebuild unchanged - # files. More info in this SO answer: - # https://stackoverflow.com/questions/60906336/stack-haskell-build-cache-of-source-files-with-github-actions/61178945#61178945 - # Windows is confused about stack's default user directory - stack $STACK_ARGS runghc -- git-modtime.hs -f .stack-work/tree-contents.txt + curl -sSL https://raw.githubusercontent.com/lehins/utils/master/haskell/git-modtime/git-modtime.hs -o git-modtime.hs + runhaskell -- git-modtime.hs -f .stack-work/tree-contents.txt - - name: Tests + - name: Build + env: + COVERALLS_TOKEN: ${{ secrets.COVERALLS_TOKEN }} + run: | + set -ex + if [ "${{ matrix.os }}.${{ matrix.resolver }}" == "ubuntu-latest.lts-19" ] && [ -n "${COVERALLS_TOKEN}" ]; then + # Inspection tests aren't compatible with coverage + stack $STACK_ARGS build :spec :legacy-test --coverage --test --no-run-tests --haddock --no-haddock-deps + else + stack $STACK_ARGS build --test --no-run-tests --bench --no-run-benchmarks --haddock --no-haddock-deps + fi + + - name: Test env: COVERALLS_TOKEN: ${{ secrets.COVERALLS_TOKEN }} run: | set -ex - [ -n "${{ matrix.ghc }}" ] && [ "${{ matrix.os }}" == "ubuntu-latest" ] && STACK_ARGS="$STACK_ARGS --system-ghc" - [ -n "${{ matrix.stack-yaml }}" ] && STACK_YAML=${{ matrix.stack-yaml }} - if [ "${{ matrix.os }}.${{ matrix.resolver }}" == "ubuntu-latest.lts-14" ]; then - stack $STACK_ARGS test random:spec random:legacy-test --coverage --haddock --no-haddock-deps + if [ "${{ matrix.os }}.${{ matrix.resolver }}" == "ubuntu-latest.lts-19" ] && [ -n "${COVERALLS_TOKEN}" ]; then + stack $STACK_ARGS test :spec :legacy-test --coverage --haddock --no-haddock-deps stack $STACK_ARGS hpc report --all - # Upload coverage report only when the token is available. - if [ -n "${COVERALLS_TOKEN}" ]; then - curl -L https://github.com/rubik/stack-hpc-coveralls/releases/download/v0.0.6.1/shc-linux-x64-8.8.4.tar.bz2 | tar xj shc - ./shc --repo-token="$COVERALLS_TOKEN" --partial-coverage --fetch-coverage combined custom - fi - elif [ "${{ matrix.resolver }}" == "lts-6" ]; then - # Inspection tests are not supported by pre ghc-8.0 compiler - stack $STACK_ARGS test random:spec random:legacy-test --bench --no-run-benchmarks --haddock --no-haddock-deps + curl -L https://github.com/rubik/stack-hpc-coveralls/releases/download/v0.0.7.0/shc-Linux-X64.tar.bz2 | tar xj shc + ./shc --repo-token="$COVERALLS_TOKEN" --partial-coverage --fetch-coverage combined custom else stack $STACK_ARGS test --bench --no-run-benchmarks --haddock --no-haddock-deps fi diff --git a/random.cabal b/random.cabal index 969527a8..6e9fd3bc 100644 --- a/random.cabal +++ b/random.cabal @@ -92,9 +92,7 @@ library default-language: Haskell2010 ghc-options: -Wall - if impl(ghc >= 8.0) - ghc-options: - -Wincomplete-record-updates -Wincomplete-uni-patterns + -Wincomplete-record-updates -Wincomplete-uni-patterns build-depends: base >=4.9 && <5, @@ -102,9 +100,6 @@ library deepseq >=1.1 && <2, mtl >=2.2 && <2.4, splitmix >=0.1 && <0.2 - if impl(ghc < 8.0) - build-depends: - transformers test-suite legacy-test type: exitcode-stdio-1.0 @@ -118,10 +113,9 @@ test-suite legacy-test RangeTest default-language: Haskell2010 - ghc-options: -with-rtsopts=-M8M - if impl(ghc >= 8.0) - ghc-options: - -Wno-deprecations + ghc-options: + -with-rtsopts=-M8M + -Wno-deprecations build-depends: base, containers >=0.5 && <0.7, @@ -172,19 +166,15 @@ test-suite spec-inspection type: exitcode-stdio-1.0 main-is: Spec.hs hs-source-dirs: test-inspection - build-depends: - default-language: Haskell2010 ghc-options: -Wall + other-modules: + Spec.Inspection build-depends: base, random, - tasty >=1.0 && <1.6 - if impl(ghc >= 8.0) - build-depends: - tasty-inspection-testing - other-modules: - Spec.Inspection + tasty >=1.0 && <1.6, + tasty-inspection-testing benchmark legacy-bench type: exitcode-stdio-1.0 @@ -193,10 +183,7 @@ benchmark legacy-bench other-modules: BinSearch default-language: Haskell2010 ghc-options: - -Wall -O2 -threaded -rtsopts -with-rtsopts=-N - if impl(ghc >= 8.0) - ghc-options: - -Wno-deprecations + -Wall -O2 -threaded -rtsopts -with-rtsopts=-N -Wno-deprecations build-depends: base, diff --git a/stack-coveralls.yaml b/stack-coveralls.yaml index 2f898997..6a2143bc 100644 --- a/stack-coveralls.yaml +++ b/stack-coveralls.yaml @@ -1,11 +1,5 @@ -resolver: lts-14.27 +resolver: lts-19.33 +system-ghc: true packages: - . -extra-deps: -- splitmix-0.1@sha256:d50c4d0801a35be7875a040470c09863342514930c82a7d25780a6c2efc4fda9,5249 -- rdtsc-1.3.0.1@sha256:0a6e8dc715ba82ad72c7e2b1c2f468999559bec059d50540719a80b00dcc4e66,1557 -- smallcheck-1.2.0@sha256:8b431572e6a0503223e0e52014d41084c1b01f2aeea3bd499f6f529b3f6dfa89,1482 -- tasty-bench-0.2.3@sha256:daa2221a1b1c65990633a51236f1cb4a52cba8ef0f0731f653e712a8bab07616,1319 -- inspection-testing-0.4.5.0@sha256:938e7ce2ef42033071a5e60198c6e19ab61c411f5879b85821247a504f131768,8058 -- tasty-inspection-testing-0.1@sha256:9c5e76345168fd3a59b43d305eebf8df3c792ce324c66bbdee45b54aa7d2c0ad,1214 -- primitive-0.7.1.0@sha256:29de6bfd0cf8ba023ceb806203dfbec0e51e3524e75ffe41056f70b4229c6f0f,2728 +extra-deps: [] From bdb150b9fc95986612ff52eeb5ac41d5275fbadc Mon Sep 17 00:00:00 2001 From: Alexey Kuleshevich Date: Sat, 28 Oct 2023 19:45:51 +0200 Subject: [PATCH 3/4] Switch to new repo for haskell-actions --- .github/workflows/ci.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index e932ae71..d965adb4 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -60,7 +60,7 @@ jobs: steps: - uses: actions/checkout@v3 - - uses: haskell/actions/setup@v2 + - uses: haskell-actions/setup@v2 id: setup-haskell-cabal name: Setup Haskell with: @@ -137,7 +137,7 @@ jobs: steps: - uses: actions/checkout@v3 - - uses: haskell/actions/setup@v2 + - uses: haskell-actions/setup@v2 id: setup-haskell-stack name: Setup Haskell with: From 425ca9af3498edd81aa5243dfc4643332b09055e Mon Sep 17 00:00:00 2001 From: Alexey Kuleshevich Date: Sat, 28 Oct 2023 23:55:45 +0200 Subject: [PATCH 4/4] Bump up heap limit. stack+ghc-9.6.3 leads to hitting the limit --- random.cabal | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/random.cabal b/random.cabal index 6e9fd3bc..975bc62d 100644 --- a/random.cabal +++ b/random.cabal @@ -114,7 +114,7 @@ test-suite legacy-test default-language: Haskell2010 ghc-options: - -with-rtsopts=-M8M + -with-rtsopts=-M9M -Wno-deprecations build-depends: base,