Skip to content

Commit

Permalink
Merge pull request #167 from haskell/lehins/fix-ci
Browse files Browse the repository at this point in the history
Upgrade CI dependencies
  • Loading branch information
lehins authored Oct 27, 2024
2 parents 4b45e3a + 6fcb4f5 commit c0fc74c
Show file tree
Hide file tree
Showing 7 changed files with 71 additions and 62 deletions.
83 changes: 51 additions & 32 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,9 @@ jobs:
- { os: ubuntu-latest, ghc: "9.0.2" }
- { os: ubuntu-latest, ghc: "9.2.8" }
- { os: ubuntu-latest, ghc: "9.4.8" }
- { os: ubuntu-latest, ghc: "9.6.4" }
- { os: ubuntu-latest, ghc: "9.8.1" }
- { os: ubuntu-latest, ghc: "9.6.6" }
- { os: ubuntu-latest, ghc: "9.8.2" }
- { os: ubuntu-latest, ghc: "9.10.1" }
# MacOS
- { os: macOS-latest, ghc: "8.0.2" }
- { os: macOS-latest, ghc: "8.2.2" }
Expand All @@ -43,8 +44,9 @@ jobs:
- { os: macOS-latest, ghc: "9.0.2" }
- { os: macOS-latest, ghc: "9.2.8" }
- { os: macOS-latest, ghc: "9.4.8" }
- { os: macOS-latest, ghc: "9.6.4" }
- { os: macOS-latest, ghc: "9.8.1" }
- { os: macOS-latest, ghc: "9.6.6" }
- { os: macOS-latest, ghc: "9.8.2" }
- { os: macOS-latest, ghc: "9.10.1" }
# Windows
- { os: windows-latest, ghc: "8.0.2" }
- { os: windows-latest, ghc: "8.2.2" }
Expand All @@ -55,10 +57,11 @@ jobs:
- { os: windows-latest, ghc: "9.0.2" }
- { os: windows-latest, ghc: "9.2.8" }
- { os: windows-latest, ghc: "9.4.8" }
- { os: windows-latest, ghc: "9.6.4" }
- { os: windows-latest, ghc: "9.8.1" }
- { os: windows-latest, ghc: "9.6.6" }
- { os: windows-latest, ghc: "9.8.2" }
- { os: windows-latest, ghc: "9.10.1" }
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- uses: haskell-actions/setup@v2
id: setup-haskell-cabal
Expand All @@ -69,7 +72,7 @@ jobs:
- name: Update cabal package database
run: cabal update

- uses: actions/cache@v3
- uses: actions/cache@v4
name: Cache cabal stuff
with:
path: |
Expand All @@ -85,6 +88,12 @@ jobs:
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
- name: Doctest
run: |
cabal install doctest --ignore-project --overwrite-policy=always
cabal repl --build-depends=unliftio --with-compiler=doctest --repl-options='-w -Wdefault'
build-stack:
name: CI-stack
runs-on: ${{ matrix.os }}
Expand Down Expand Up @@ -119,39 +128,58 @@ jobs:
ghc: '9.4.8'
stack-yaml: stack.yaml
- resolver: lts-22
ghc: '9.6.4'
ghc: '9.6.6'
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
# MacOS-latest
- resolver: lts-20
os: macos-13
ghc: '9.2.8'
stack-yaml: stack.yaml
- resolver: lts-21
os: macos-13
ghc: '9.4.8'
stack-yaml: stack.yaml
- resolver: lts-22
os: macos-13
ghc: '9.6.6'
stack-yaml: stack.yaml
# Windows-latest
- resolver: lts-14
os: windows-latest
ghc: '8.6.5'
stack-yaml: stack-old.yaml
- resolver: lts-20
os: windows-latest
ghc: '9.2.8'
stack-yaml: stack.yaml
- resolver: lts-21
os: windows-latest
ghc: '9.4.8'
stack-yaml: stack.yaml
- resolver: lts-22
os: windows-latest
ghc: '9.6.6'
stack-yaml: stack.yaml
env:
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:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- 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.10'
stack-version: ${{ matrix.resolver == 'lts-11' && '2.15.5' || 'latest' }}

- name: Cache
id: cache
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: |
~/.stack
Expand All @@ -160,18 +188,9 @@ jobs:
restore-keys: |
${{ runner.os }}-${{ matrix.resolver }}-${{ env.cache-version }}
# Executable files somehow become incompatible after restoring on MacOS from a
# previous build, so it needs to be cleaned up. This is very inconvenient and will
# need to be fixed.
- name: MacOS workaround for failure due to setup-exe-cache
if: steps.cache.outputs.cache-hit == 'true' && matrix.os == 'macos-latest'
run: |
rm -r ~/.stack/setup-exe-cache
rm -r .stack-work
- name: Windows Cache
id: cache-windows
uses: actions/cache@v3
uses: actions/cache@v4
if: matrix.os == 'windows-latest'
with:
path: |
Expand Down Expand Up @@ -243,7 +262,7 @@ jobs:
args: "find . -mindepth 1 -maxdepth 1 -exec rm -rf -- {} +"

- name: Checkout code
uses: actions/checkout@v3
uses: actions/checkout@v4

- if: matrix.arch == 'arm32v7'
uses: docker://hasufell/arm32v7-ubuntu-haskell:focal
Expand All @@ -265,8 +284,8 @@ jobs:
s390x:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: uraimo/run-on-arch-action@v2.5.0
- uses: actions/checkout@v4
- uses: uraimo/run-on-arch-action@v2.8.1
timeout-minutes: 60
with:
arch: s390x
Expand Down
18 changes: 0 additions & 18 deletions .github/workflows/doctest.yml

This file was deleted.

1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# 1.3.0

* Add `Uniform` instance for `Maybe` and `Either`
* Add `SplitGen` and `splitGen`
* Add `shuffleList` and `shuffleListM`: [#140](https://github.com/haskell/random/pull/140)
* Add `mkStdGen64`: [#155](https://github.com/haskell/random/pull/155)
Expand Down
7 changes: 5 additions & 2 deletions random.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,9 @@ tested-with: GHC == 8.0.2
, GHC == 9.0.2
, GHC == 9.2.8
, GHC == 9.4.8
, GHC == 9.6.4
, GHC == 9.8.1
, GHC == 9.6.6
, GHC == 9.8.2
, GHC == 9.10.1

source-repository head
type: git
Expand Down Expand Up @@ -160,6 +161,8 @@ test-suite spec-inspection
random,
tasty >=1.0 && <1.6,
tasty-inspection-testing
if impl(ghc >=9.10)
buildable: False

benchmark legacy-bench
type: exitcode-stdio-1.0
Expand Down
12 changes: 6 additions & 6 deletions src/System/Random.hs
Original file line number Diff line number Diff line change
Expand Up @@ -340,11 +340,11 @@ class Random a where
-- closed interval /[lo,hi]/, together with a new generator. It is unspecified
-- what happens if /lo>hi/, but usually the values will simply get swapped.
--
-- >>> let gen = mkStdGen 2021
-- >>> let gen = mkStdGen 26
-- >>> fst $ randomR ('a', 'z') gen
-- 't'
-- >>> fst $ randomR ('z', 'a') gen
-- 't'
-- 'z'
-- >>> fst $ randomR ('a', 'z') gen
-- 'z'
--
-- For continuous types there is no requirement that the values /lo/ and /hi/ are ever
-- produced, but they may be, depending on the implementation and the interval.
Expand All @@ -353,8 +353,8 @@ class Random a where
-- defined on per type basis. For example product types will treat their values
-- independently:
--
-- >>> fst $ randomR (('a', 5.0), ('z', 10.0)) $ mkStdGen 2021
-- ('t',6.240232662366564)
-- >>> fst $ randomR (('a', 5.0), ('z', 10.0)) $ mkStdGen 26
-- ('z',7.27305019146949)
--
-- In case when a lawful range is desired `uniformR` should be used
-- instead.
Expand Down
6 changes: 5 additions & 1 deletion src/System/Random/Internal.hs
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ import GHC.ST (ST(..))
import GHC.Word
import Numeric.Natural (Natural)
import System.IO.Unsafe (unsafePerformIO)
import System.Random.GFinite (Cardinality(..), GFinite(..))
import System.Random.GFinite (Cardinality(..), GFinite(..), Finite)
import qualified System.Random.SplitMix as SM
import qualified System.Random.SplitMix32 as SM32
import Data.Kind
Expand Down Expand Up @@ -1474,6 +1474,10 @@ instance UniformRange Bool where
{-# INLINE uniformRM #-}
isInRange = isInRangeOrd

instance (Finite a, Uniform a) => Uniform (Maybe a)

instance (Finite a, Uniform a, Finite b, Uniform b) => Uniform (Either a b)

-- | See [Floating point number caveats](System-Random-Stateful.html#fpcaveats).
instance UniformRange Double where
uniformRM (l, h) g
Expand Down
6 changes: 3 additions & 3 deletions src/System/Random/Stateful.hs
Original file line number Diff line number Diff line change
Expand Up @@ -299,16 +299,16 @@ withMutableGen_ fg action = thawGen fg >>= action
-- ====__Examples__
--
-- >>> import System.Random.Stateful
-- >>> let pureGen = mkStdGen 137
-- >>> let pureGen = mkStdGen 139
-- >>> g <- newIOGenM pureGen
-- >>> randomM g :: IO Double
-- 0.5728354935654512
-- 0.33775117339631733
--
-- You can use type applications to disambiguate the type of the generated numbers:
--
-- >>> :seti -XTypeApplications
-- >>> randomM @Double g
-- 0.6268211351114488
-- 0.9156875994165681
--
-- @since 1.2.0
randomM :: forall a g m. (Random a, RandomGen g, FrozenGen g m) => MutableGen g m -> m a
Expand Down

0 comments on commit c0fc74c

Please sign in to comment.