Skip to content

Commit 6b30bd9

Browse files
authored
Merge pull request #170 from haskell/lehins/improve-ci
Improve CI
2 parents ff595fa + d5eba95 commit 6b30bd9

File tree

7 files changed

+55
-22
lines changed

7 files changed

+55
-22
lines changed

.github/workflows/ci.yaml

Lines changed: 19 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@ name: random-CI
22

33
on:
44
push:
5-
branches: [ '*' ]
5+
branches: [ "master", "release/**" ]
66
pull_request:
7-
branches: [ master ]
7+
branches: [ "**" ]
88

99
defaults: { run: { shell: bash } }
1010

@@ -22,8 +22,9 @@ jobs:
2222
matrix:
2323
include:
2424
# Linux
25-
- { os: ubuntu-latest, ghc: "8.0.2" }
26-
- { os: ubuntu-latest, ghc: "8.2.2" }
25+
# haskell-actions/setup is having trouble installing from hvr/ppa for ghc-8.0 and 8.2
26+
# - { os: ubuntu-latest, ghc: "8.0.2" }
27+
# - { os: ubuntu-latest, ghc: "8.2.2" }
2728
- { os: ubuntu-latest, ghc: "8.4.4" }
2829
- { os: ubuntu-latest, ghc: "8.6.5" }
2930
- { os: ubuntu-latest, ghc: "8.8.4" }
@@ -35,8 +36,8 @@ jobs:
3536
- { os: ubuntu-latest, ghc: "9.8.2" }
3637
- { os: ubuntu-latest, ghc: "9.10.1" }
3738
# MacOS
38-
- { os: macOS-latest, ghc: "8.0.2" }
39-
- { os: macOS-latest, ghc: "8.2.2" }
39+
# - { os: macOS-latest, ghc: "8.0.2" }
40+
# - { os: macOS-latest, ghc: "8.2.2" }
4041
- { os: macOS-latest, ghc: "8.4.4" }
4142
- { os: macOS-latest, ghc: "8.6.5" }
4243
- { os: macOS-latest, ghc: "8.8.4" }
@@ -48,8 +49,8 @@ jobs:
4849
- { os: macOS-latest, ghc: "9.8.2" }
4950
- { os: macOS-latest, ghc: "9.10.1" }
5051
# Windows
51-
- { os: windows-latest, ghc: "8.0.2" }
52-
- { os: windows-latest, ghc: "8.2.2" }
52+
# - { os: windows-latest, ghc: "8.0.2" }
53+
# - { os: windows-latest, ghc: "8.2.2" }
5354
- { os: windows-latest, ghc: "8.4.4" }
5455
- { os: windows-latest, ghc: "8.6.5" }
5556
- { os: windows-latest, ghc: "8.8.4" }
@@ -101,11 +102,12 @@ jobs:
101102
fail-fast: false
102103
matrix:
103104
os: [ubuntu-latest]
104-
resolver: [nightly, lts-22, lts-21, lts-20, lts-19, lts-18, lts-16, lts-14, lts-12, lts-11]
105+
resolver: [nightly, lts-22, lts-21, lts-20, lts-19, lts-18, lts-16, lts-14, lts-12, lts-11, lts-9]
105106
include:
107+
- resolver: lts-9
108+
stack-yaml: stack-custom.yaml
106109
- resolver: lts-11
107-
ghc: '8.2.2'
108-
stack-yaml: stack-old.yaml
110+
stack-yaml: stack-custom.yaml
109111
- resolver: lts-12
110112
ghc: '8.4.4'
111113
stack-yaml: stack-old.yaml
@@ -164,7 +166,7 @@ jobs:
164166
stack-yaml: stack.yaml
165167
env:
166168
STACK_YAML: '${{ matrix.stack-yaml }}'
167-
STACK_ARGS: '--resolver ${{ matrix.resolver }} --system-ghc'
169+
STACK_ARGS: '--resolver ${{ matrix.resolver }}'
168170
cache-version: v5 # bump up this version to invalidate currently stored cache
169171
steps:
170172
- uses: actions/checkout@v4
@@ -175,7 +177,7 @@ jobs:
175177
with:
176178
ghc-version: ${{ matrix.ghc }}
177179
enable-stack: true
178-
stack-version: ${{ matrix.resolver == 'lts-11' && '2.15.5' || 'latest' }}
180+
stack-version: ${{ (matrix.resolver == 'lts-9' || matrix.resolver == 'lts-11') && '2.15.5' || 'latest' }}
179181

180182
- name: Cache
181183
id: cache
@@ -239,8 +241,10 @@ jobs:
239241
- name: Install
240242
run: |
241243
apt-get update -y
242-
apt-get install -y autoconf build-essential zlib1g-dev libgmp-dev curl libncurses5 libtinfo5 libncurses5-dev libtinfo-dev
243-
curl --proto '=https' --tlsv1.2 -sSf https://get-ghcup.haskell.org | BOOTSTRAP_HASKELL_NONINTERACTIVE=1 BOOTSTRAP_HASKELL_INSTALL_NO_STACK=1 sh
244+
apt-get install -y autoconf build-essential zlib1g-dev libgmp-dev curl libncurses5 libtinfo5 libncurses5-dev libtinfo-dev wget
245+
wget https://get-ghcup.haskell.org -O ghcup.sh -t 10 --retry-connrefused
246+
chmod a+x ghcup.sh
247+
BOOTSTRAP_HASKELL_NONINTERACTIVE=1 BOOTSTRAP_HASKELL_INSTALL_NO_STACK=1 ./ghcup.sh
244248
- uses: actions/checkout@v1
245249
- name: Test
246250
run: |

bench/Main.hs

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
{-# LANGUAGE BangPatterns #-}
2+
{-# LANGUAGE CPP #-}
23
{-# LANGUAGE FlexibleContexts #-}
34
{-# LANGUAGE ScopedTypeVariables #-}
45
module Main (main) where
@@ -13,9 +14,11 @@ import Foreign.C.Types
1314
import Numeric.Natural (Natural)
1415
import System.Random.SplitMix as SM
1516
import Test.Tasty.Bench
17+
#if MIN_VERSION_primitive(0,7,1)
1618
import Control.Monad.Primitive
17-
import Data.Primitive.PrimArray
1819
import Data.Primitive.Types
20+
import Data.Primitive.PrimArray
21+
#endif
1922

2023
import System.Random.Stateful
2124

@@ -200,7 +203,9 @@ main = do
200203
in pureUniformRBench (Proxy :: Proxy Natural) range sz
201204
]
202205
, bgroup "floating"
203-
[ bgroup "IO"
206+
[
207+
#if MIN_VERSION_primitive(0,7,1)
208+
bgroup "IO"
204209
[ env ((,) <$> getStdGen <*> newAlignedPinnedPrimArray sz) $ \ ~(gen, ma) ->
205210
bench "uniformFloat01M" $
206211
nfIO (runStateGenT gen (fillMutablePrimArrayM uniformFloat01M ma))
@@ -214,7 +219,9 @@ main = do
214219
bench "uniformDoublePositive01M" $
215220
nfIO (runStateGenT gen (fillMutablePrimArrayM uniformDoublePositive01M ma))
216221
]
217-
, bgroup "State"
222+
,
223+
#endif
224+
bgroup "State"
218225
[ env getStdGen $
219226
bench "uniformFloat01M" . nf (`runStateGen` (replicateM_ sz . uniformFloat01M))
220227
, env getStdGen $
@@ -329,7 +336,7 @@ genMany f g0 n = go 0 $ f g0
329336
| i < n = go (i + 1) $ f g
330337
| otherwise = y
331338

332-
339+
#if MIN_VERSION_primitive(0,7,1)
333340
fillMutablePrimArrayM ::
334341
(Prim a, PrimMonad m)
335342
=> (gen -> m a)
@@ -343,3 +350,4 @@ fillMutablePrimArrayM f ma g = do
343350
| otherwise = pure ()
344351
go 0
345352
unsafeFreezePrimArray ma
353+
#endif

random.cabal

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,7 @@ library
102102
bytestring >=0.10.4 && <0.13,
103103
deepseq >=1.1 && <2,
104104
mtl >=2.2 && <2.4,
105+
transformers >=0.4 && <0.7,
105106
splitmix >=0.1 && <0.2
106107
if impl(ghc < 9.4)
107108
build-depends: data-array-byte
@@ -123,7 +124,7 @@ test-suite legacy-test
123124
-Wno-deprecations
124125
build-depends:
125126
base,
126-
containers >=0.5 && <0.7,
127+
containers >=0.5 && <0.8,
127128
random
128129

129130
test-suite spec
@@ -192,7 +193,7 @@ benchmark bench
192193
build-depends:
193194
base,
194195
mtl,
195-
primitive >= 0.7.1,
196+
primitive,
196197
random,
197198
splitmix >=0.1 && <0.2,
198199
tasty-bench

src/System/Random/Internal.hs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,10 +98,10 @@ import Control.Arrow
9898
import Control.DeepSeq (NFData)
9999
import Control.Monad (replicateM, when, (>=>))
100100
import Control.Monad.Cont (ContT, runContT)
101-
import Control.Monad.Identity (IdentityT (runIdentityT))
102101
import Control.Monad.ST
103102
import Control.Monad.State.Strict (MonadState(..), State, StateT(..), execStateT, runState)
104103
import Control.Monad.Trans (lift, MonadTrans)
104+
import Control.Monad.Trans.Identity (IdentityT (runIdentityT))
105105
import Data.Array.Byte (ByteArray(..), MutableByteArray(..))
106106
import Data.Bits
107107
import Data.ByteString (ByteString)

stack-custom.yaml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
resolver: lts-11.22
2+
packages:
3+
- .
4+
extra-deps:
5+
- splitmix-0.1@sha256:d50c4d0801a35be7875a040470c09863342514930c82a7d25780a6c2efc4fda9,5249
6+
- rdtsc-1.3.0.1@sha256:0a6e8dc715ba82ad72c7e2b1c2f468999559bec059d50540719a80b00dcc4e66,1557
7+
- smallcheck-1.2.0@sha256:8b431572e6a0503223e0e52014d41084c1b01f2aeea3bd499f6f529b3f6dfa89,1482
8+
- tasty-1.3.1@sha256:01e35c97f7ee5ccbc28f21debea02a38cd010d53b4c3087f5677c5d06617a507,2520
9+
- tasty-hunit-0.10.2@sha256:22bc1122e8256664d7cb1e44c6bcace95676c523179947bf2403db71af43dc6d,1473
10+
- ansi-wl-pprint-0.6.8.2@sha256:a890b713942c1aa0109fb632e9fee581ceb5b0763fd936ae8cae22e5f91a0877,2178
11+
- ansi-terminal-0.9.1@sha256:48f53532d0f365ffa568c8cf0adc84c66f800a7d80d3329e4f04fa75392f4af1,3225
12+
- wcwidth-0.0.2@sha256:77531eb6683c505c22ab3fa11bbc43d3ce1e7dac21401d4d5a19677d348bb5f3,1998
13+
- tasty-bench-0.2.3@sha256:daa2221a1b1c65990633a51236f1cb4a52cba8ef0f0731f653e712a8bab07616,1319
14+
- inspection-testing-0.4.5.0@sha256:938e7ce2ef42033071a5e60198c6e19ab61c411f5879b85821247a504f131768,8058
15+
- tasty-inspection-testing-0.1@sha256:9c5e76345168fd3a59b43d305eebf8df3c792ce324c66bbdee45b54aa7d2c0ad,1214
16+
- vector-0.12.3.1@sha256:fffbd00912d69ed7be9bc7eeb09f4f475e0d243ec43f916a9fd5bbd219ce7f3e,8238
17+
- data-array-byte-0.1.0.1@sha256:ad89e28b2b046175698fbf542af2ce43e5d2af50aae9f48d12566b1bb3de1d3c,1989
18+
- optparse-applicative-0.14.2.0@sha256:cfbc2df0d9e144d343ccea6d25ab27543c15ea17d2abcbabcdf76030a2236383,4359

stack-old.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
resolver: lts-12.26
2+
system-ghc: true
23
packages:
34
- .
45
extra-deps:

stack.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
resolver: lts-21.25
2+
system-ghc: true
23
packages:
34
- .
45
extra-deps: []

0 commit comments

Comments
 (0)