Skip to content

Commit 4b22981

Browse files
sgraf812andreasabel
authored andcommitted
Add a CI workflow for big endian architectures
This is in order to test the WORDS_BIGENDIAN code path.
1 parent fffec3e commit 4b22981

File tree

1 file changed

+49
-0
lines changed

1 file changed

+49
-0
lines changed

.github/workflows/emulated.yml

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
name: emulated
2+
on:
3+
- push
4+
- pull_request
5+
6+
defaults:
7+
run:
8+
shell: bash
9+
10+
jobs:
11+
# Emulation is incredibly slow and memory demanding. It seems that any
12+
# executable with GHC RTS takes at least 7-8 Gb of RAM, so we can run
13+
# `cabal` or `ghc` on their own, but cannot run them both at the same time,
14+
# striking out `cabal test`. Instead we rely on system packages and invoke
15+
# `ghc --make` manually, and even so `ghc -O` is prohibitively expensive.
16+
emulated:
17+
runs-on: ubuntu-latest
18+
strategy:
19+
fail-fast: true
20+
matrix:
21+
arch: ['s390x', 'ppc64le']
22+
steps:
23+
- uses: actions/checkout@v3
24+
- uses: uraimo/[email protected]
25+
timeout-minutes: 60
26+
with:
27+
arch: ${{ matrix.arch }}
28+
distro: ubuntu_rolling
29+
githubToken: ${{ github.token }}
30+
install: |
31+
apt-get update -y
32+
apt-get install -y ghc alex happy
33+
run: |
34+
(cd src/; alex -g Scan.x; happy -ag Parser.y)
35+
# Need to remove mention of the Cabal path module, and then substitutes
36+
# getDataDir |-> return "/pwd/data/"
37+
# version |-> undefined
38+
sed -i '/^import Paths_alex.*$/d' src/Main.hs #
39+
# The nested sed here escapes / into \/ so that the outer sed doesn't
40+
# interpret the forward slashes. You're welcome.
41+
sed -i "s/getDataDir/\(return \"$(pwd | sed 's/\//\\\//g')\\/data\"\)/g" src/Main.hs
42+
sed -i "s/version/undefined/g" src/Main.hs
43+
ghc -XHaskell2010 -XPatternSynonyms -XFlexibleContexts -XMagicHash -XCPP -XNondecreasingIndentation -XScopedTypeVariables -XTupleSections \
44+
-package array -package containers -package directory \
45+
-isrc src/Main.hs \
46+
-o alex
47+
./alex -g tests/simple.x
48+
ghc -package array tests/simple.hs -o simple
49+
./simple +RTS -s

0 commit comments

Comments
 (0)