diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 4d6ae319..0bf8ff40 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -2,12 +2,17 @@ name: random-CI on: push: - branches: [ '*' ] + branches: [ "**" ] pull_request: branches: [ master ] 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 @@ -17,7 +22,6 @@ jobs: matrix: include: # Linux - - { cabal: "3.6", os: ubuntu-latest, ghc: "7.10.3" } - { cabal: "3.6", os: ubuntu-latest, ghc: "8.0.2" } - { cabal: "3.6", os: ubuntu-latest, ghc: "8.2.2" } - { cabal: "3.6", os: ubuntu-latest, ghc: "8.4.4" } @@ -27,7 +31,6 @@ jobs: - { cabal: "3.6", os: ubuntu-latest, ghc: "9.0.2" } - { cabal: "3.6", os: ubuntu-latest, ghc: "9.2.2" } # MacOS - - { cabal: "3.6", os: macOS-latest, ghc: "7.10.3" } - { cabal: "3.6", os: macOS-latest, ghc: "8.0.2" } - { cabal: "3.6", os: macOS-latest, ghc: "8.2.2" } - { cabal: "3.6", os: macOS-latest, ghc: "8.4.4" } @@ -37,7 +40,6 @@ jobs: - { cabal: "3.6", os: macOS-latest, ghc: "9.0.2" } - { cabal: "3.6", os: macOS-latest, ghc: "9.2.2" } # Windows - - { cabal: "3.6", os: windows-latest, ghc: "7.10.3" } - { cabal: "3.6", os: windows-latest, ghc: "8.0.2" } - { cabal: "3.6", os: windows-latest, ghc: "8.2.2" } - { cabal: "3.6", os: windows-latest, ghc: "8.4.4" } @@ -47,15 +49,16 @@ jobs: - { cabal: "3.6", os: windows-latest, ghc: "9.0.2" } - { cabal: "3.6", os: windows-latest, ghc: "9.2.2" } steps: - - uses: actions/checkout@v2 - - uses: actions/setup-haskell@v1 + - uses: actions/checkout@v4 + + - uses: haskell-actions/setup@v2 id: setup-haskell-cabal with: ghc-version: ${{ matrix.ghc }} cabal-version: ${{ matrix.cabal }} - name: Update cabal package database run: cabal update - - uses: actions/cache@v2 + - uses: actions/cache@v4 name: Cache cabal stuff with: path: | @@ -67,9 +70,6 @@ jobs: cabal sdist -z -o . cabal get random-*.tar.gz cd random-*/ - if [ ${{matrix.ghc}} = 7.10.3 ]; then - EXTRA_FLAGS=--ghc-option="-optl-no-pie" - fi echo $EXTRA_FLAGS cabal $EXTRA_FLAGS configure --haddock-all --enable-tests --enable-benchmarks --benchmark-option=-l cabal $EXTRA_FLAGS build all --write-ghc-environment-files=always @@ -80,51 +80,63 @@ jobs: fail-fast: false matrix: os: [ubuntu-latest] - resolver: [nightly, lts-19, lts-18, lts-16, lts-14, lts-12] + 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' + 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 + ghc: '9.0.2' + stack-yaml: stack-coveralls.yaml + - resolver: lts-20 + 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: v4 # bump up this version to invalidate currently stored cache steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 - - uses: haskell/actions/setup@v1 - id: setup-haskell-cabal + - uses: haskell-actions/setup@v2 + id: setup-haskell-stack name: Setup Haskell with: ghc-version: ${{ matrix.ghc }} enable-stack: true stack-version: 'latest' - cabal-version: '3.6' + cabal-version: '3.10' - name: Cache id: cache - uses: actions/cache@v2 + uses: actions/cache@v4 with: path: | ~/.stack @@ -142,47 +154,43 @@ jobs: rm -r .stack-work - name: Windows Cache id: cache-windows - uses: actions/cache@v2 + uses: actions/cache@v4 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/5d9b17f2f084ce54978dbd71974970483063a540/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 - - name: Tests + 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: 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 7aa655e2..0e034d06 100644 --- a/random.cabal +++ b/random.cabal @@ -1,6 +1,6 @@ cabal-version: >=1.10 name: random -version: 1.2.1.1 +version: 1.2.1.2 license: BSD3 license-file: LICENSE maintainer: core-libraries-committee@haskell.org @@ -63,9 +63,7 @@ build-type: Simple extra-source-files: README.md CHANGELOG.md -tested-with: GHC == 7.10.2 - , GHC == 7.10.3 - , GHC == 8.0.2 +tested-with: GHC == 8.0.2 , GHC == 8.2.2 , GHC == 8.4.3 , GHC == 8.4.4 @@ -99,7 +97,7 @@ library build-depends: base >=4.8 && <5, - bytestring >=0.10.4 && <0.12, + bytestring >=0.10.4 && <0.13, deepseq >=1.1 && <2, mtl >=2.2 && <2.4, splitmix >=0.1 && <0.2 @@ -119,7 +117,7 @@ test-suite legacy-test RangeTest default-language: Haskell2010 - ghc-options: -with-rtsopts=-M8M + ghc-options: -rtsopts -with-rtsopts=-M9M if impl(ghc >= 8.0) ghc-options: -Wno-deprecations @@ -135,7 +133,7 @@ test-suite doctests default-language: Haskell2010 build-depends: base, - doctest >=0.15 && <0.21 + doctest >=0.15 && <0.23 if impl(ghc >= 8.2) && impl(ghc < 8.10) build-depends: mwc-random >=0.13 && <0.16, @@ -162,7 +160,7 @@ test-suite spec random, smallcheck >=1.2 && <1.3, stm, - tasty >=1.0 && <1.5, + tasty >=1.0 && <1.6, tasty-smallcheck >=0.8 && <0.9, tasty-hunit >=0.10 && <0.11, transformers @@ -173,14 +171,12 @@ 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 build-depends: base, random, - tasty >=1.0 && <1.5 + tasty >=1.0 && <1.6 if impl(ghc >= 8.0) build-depends: tasty-inspection-testing 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: [] diff --git a/stack-old.yaml b/stack-old.yaml index 6891a329..025127c5 100644 --- a/stack-old.yaml +++ b/stack-old.yaml @@ -14,4 +14,5 @@ extra-deps: - 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 +- primitive-0.7.4.0@sha256:89b88a3e08493b7727fa4089b0692bfbdf7e1e666ef54635f458644eb8358764,2857 +- vector-0.12.3.1@sha256:fffbd00912d69ed7be9bc7eeb09f4f475e0d243ec43f916a9fd5bbd219ce7f3e,8238 diff --git a/test-inspection/Spec/Inspection.hs b/test-inspection/Spec/Inspection.hs index 45109a6b..0e0b07bd 100644 --- a/test-inspection/Spec/Inspection.hs +++ b/test-inspection/Spec/Inspection.hs @@ -1,3 +1,4 @@ +{-# LANGUAGE CPP #-} {-# LANGUAGE DeriveAnyClass #-} {-# LANGUAGE DeriveGeneric #-} {-# LANGUAGE TemplateHaskell #-} @@ -43,7 +44,15 @@ inspectionTests = testGroup "Inspection" $ [ $(inspectObligations [(`doesNotUse` 'StateGenM), hasNoGenerics, hasNoTypeClasses] 'uniform_Word8) , $(inspectObligations [(`doesNotUse` 'StateGenM), hasNoGenerics, hasNoTypeClasses] 'uniform_Int8) , $(inspectObligations [(`doesNotUse` 'StateGenM), hasNoGenerics, hasNoTypeClasses] 'uniform_Char) - , $(inspectObligations [(`doesNotUse` 'StateGenM), hasNoGenerics, hasNoTypeClasses] 'uniform_MyAction) + , $(inspectObligations [(`doesNotUse` 'StateGenM), hasNoTypeClasses] 'uniform_MyAction) + +#if !MIN_VERSION_base(4,17,0) + -- Starting from GHC 9.4 and base-4.17 + -- 'error' :: M1 C ('MetaCons "Never" 'PrefixI 'False) .. + -- survives. This does not really matter, because Never is uninhabited, + -- but fails inspection testing. + , $(inspectTest $ hasNoGenerics 'uniform_MyAction) +#endif , $(inspectObligations [(`doesNotUse` 'StateGenM), hasNoGenerics, hasNoTypeClasses] 'uniformR_Word8) , $(inspectObligations [(`doesNotUse` 'StateGenM), hasNoGenerics, hasNoTypeClasses] 'uniformR_Int8)