Skip to content

Commit 1f64598

Browse files
authored
Merge pull request #75 from Bodigrim/s390x
Add big-endian configuration for CI
2 parents 459b5ce + 492847d commit 1f64598

File tree

3 files changed

+43
-1
lines changed

3 files changed

+43
-1
lines changed

.github/workflows/s390x.yml

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
name: s390x
2+
on:
3+
push:
4+
branches:
5+
- master
6+
pull_request: {} # Validate all PRs
7+
8+
defaults:
9+
run:
10+
shell: bash
11+
12+
jobs:
13+
# Emulation on s390x platform is incredibly slow and memory demanding.
14+
# It seems that any executable with GHC RTS takes at least 7-8 Gb of RAM, so we can
15+
# run `cabal` or `ghc` on their own, but cannot run them both at the same time, striking
16+
# out `cabal test`. Instead we rely on system packages and invoke `ghc --make` manually,
17+
# and even so `ghc -O` is prohibitively expensive.
18+
build:
19+
runs-on: ubuntu-latest
20+
steps:
21+
- uses: actions/checkout@v2
22+
- uses: uraimo/[email protected]
23+
timeout-minutes: 60
24+
with:
25+
arch: s390x
26+
distro: ubuntu20.04
27+
githubToken: ${{ github.token }}
28+
install: |
29+
apt-get update -y
30+
apt-get install -y ghc libghc-quickcheck2-dev libghc-hspec-dev libghc-getopt-generics-dev libghc-split-dev curl
31+
run: |
32+
ghc --version
33+
curl -s -L https://hackage.haskell.org/package/unicode-data-0.3.0.tar.gz | tar xz
34+
ghc --make -XMagicHash -XBangPatterns -XUnboxedTuples -itest:unicode-data-0.3.0/lib -o extras test/Extra.hs
35+
./extras
36+
ghc --make -XMagicHash -XBangPatterns -XUnboxedTuples -itest:unicode-data-0.3.0/lib -o quickcheck test/Properties.hs
37+
./quickcheck
38+
ghc --make -XMagicHash -XBangPatterns -XUnboxedTuples -itest:unicode-data-0.3.0/lib -o ucd test/NormalizationTest.hs
39+
./ucd

test/NormalizationTest.hs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
--
1313

1414
import Control.Monad (when)
15+
import qualified Data.ByteString as B
1516
import Data.Char (chr, isSpace, ord, toUpper)
1617
#if MIN_VERSION_base(4,8,0)
1718
import Data.Function ((&))
@@ -20,6 +21,7 @@ import Data.List (intercalate, isPrefixOf)
2021
import Data.List.Split (splitOn)
2122
import Data.Text (Text)
2223
import qualified Data.Text as T
24+
import qualified Data.Text.Encoding as T
2325
import Data.Text.Normalize (NormalizationMode(NFD, NFKD, NFC, NFKC), normalize)
2426
import Text.Printf (printf)
2527

@@ -109,7 +111,7 @@ checkLine (lineno, line) = do
109111

110112
testNormalize :: FilePath -> IO ()
111113
testNormalize file = do
112-
contents <- readFile file
114+
contents <- T.unpack . T.decodeUtf8 <$> B.readFile file
113115
let ls = lines contents -- split into lines
114116
& map (dropWhile isSpace) -- trim leading spaces
115117
& zip [1..] -- add numbering

unicode-transforms.cabal

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -156,6 +156,7 @@ test-suite ucd
156156
ghc-options: -Wall -fwarn-identities -fwarn-incomplete-record-updates -fwarn-incomplete-uni-patterns -fwarn-tabs
157157
build-depends:
158158
base >=4.7 && <5
159+
, bytestring
159160
, split >=0.1 && <0.3
160161
, text
161162
, unicode-transforms

0 commit comments

Comments
 (0)