Skip to content

Commit 0a1a344

Browse files
committed
Merge branch 'fix-damn-ci'
2 parents e7d2ceb + cea4432 commit 0a1a344

File tree

4 files changed

+186
-81
lines changed

4 files changed

+186
-81
lines changed

.github/scripts/brew.sh

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
#!/bin/sh
2+
3+
set -eux
4+
5+
. .github/scripts/env.sh
6+
7+
if [ -e "$HOME/.brew" ] ; then
8+
(
9+
cd "$HOME/.brew"
10+
git fetch --depth 1
11+
git reset --hard origin/master
12+
)
13+
else
14+
git clone --depth=1 https://github.com/Homebrew/brew "$HOME/.brew"
15+
fi
16+
export PATH="$HOME/.brew/bin:$HOME/.brew/sbin:$PATH"
17+
18+
mkdir -p $CI_PROJECT_DIR/.brew_cache
19+
export HOMEBREW_CACHE=$CI_PROJECT_DIR/.brew_cache
20+
mkdir -p $CI_PROJECT_DIR/.brew_logs
21+
export HOMEBREW_LOGS=$CI_PROJECT_DIR/.brew_logs
22+
mkdir -p /private/tmp/.brew_tmp
23+
export HOMEBREW_TEMP=/private/tmp/.brew_tmp
24+
25+
brew update
26+
brew install ${1+"$@"}
27+
28+
29+
set -eux
30+
31+
. .github/scripts/env.sh
32+
33+
if [ -e "$HOME/.brew" ] ; then
34+
(
35+
cd "$HOME/.brew"
36+
git fetch --depth 1
37+
git reset --hard origin/master
38+
)
39+
else
40+
git clone --depth=1 https://github.com/Homebrew/brew "$HOME/.brew"
41+
fi
42+
export PATH="$HOME/.brew/bin:$HOME/.brew/sbin:$PATH"
43+
44+
mkdir -p $CI_PROJECT_DIR/.brew_cache
45+
export HOMEBREW_CACHE=$CI_PROJECT_DIR/.brew_cache
46+
mkdir -p $CI_PROJECT_DIR/.brew_logs
47+
export HOMEBREW_LOGS=$CI_PROJECT_DIR/.brew_logs
48+
mkdir -p /private/tmp/.brew_tmp
49+
export HOMEBREW_TEMP=/private/tmp/.brew_tmp
50+
51+
brew update
52+
brew install ${1+"$@"}
53+

.github/scripts/env.sh

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
#!/bin/sh
2+
3+
if [ "${RUNNER_OS}" = "Windows" ] ; then
4+
ext=".exe"
5+
else
6+
ext=''
7+
fi
8+
9+
export DEBIAN_FRONTEND=noninteractive
10+
export TZ=Asia/Singapore
11+
12+
export OS="$RUNNER_OS"
13+
export PATH="$HOME/.local/bin:$PATH"
14+
15+
if [ "${RUNNER_OS}" = "Windows" ] ; then
16+
# on windows use pwd to get unix style path
17+
CI_PROJECT_DIR="$(pwd)"
18+
export CI_PROJECT_DIR
19+
export GHCUP_INSTALL_BASE_PREFIX="/c"
20+
export GHCUP_BIN="$GHCUP_INSTALL_BASE_PREFIX/ghcup/bin"
21+
export PATH="$GHCUP_BIN:$PATH"
22+
export CABAL_DIR="C:\\Users\\runneradmin\\AppData\\Roaming\\cabal"
23+
else
24+
export CI_PROJECT_DIR="${GITHUB_WORKSPACE}"
25+
export GHCUP_INSTALL_BASE_PREFIX="$CI_PROJECT_DIR"
26+
export GHCUP_BIN="$GHCUP_INSTALL_BASE_PREFIX/.ghcup/bin"
27+
export PATH="$GHCUP_BIN:$PATH"
28+
export CABAL_DIR="$CI_PROJECT_DIR/cabal"
29+
export CABAL_CACHE="$CI_PROJECT_DIR/cabal-cache"
30+
fi

.github/workflows/test.yaml

Lines changed: 94 additions & 81 deletions
Original file line numberDiff line numberDiff line change
@@ -13,73 +13,47 @@ jobs:
1313
strategy:
1414
fail-fast: false
1515
matrix:
16-
os: [ubuntu-latest, macOS-latest, windows-latest]
17-
ghc: ['8.0.2', '8.2.2', '8.4.4', '8.6.5', '8.8.4', '8.10.7', '9.0.2', '9.2.5']
18-
cabal: ['3.6.2.0']
16+
os: [ubuntu-latest]
17+
ghc: ['8.0.2', '8.2.2', '8.4.4', '8.6.5', '8.8.4', '8.10.7', '9.0.2', '9.2.5', '9.2.6', '9.4.4']
18+
cabal: ['3.8.1.0']
1919
include:
20-
- os: ubuntu-latest
21-
ghc: 'HEAD'
22-
cabal: 3.6.2.0
23-
- os: ubuntu-latest
24-
ghc: 'recommended'
25-
- os: ubuntu-latest
26-
ghc: 'latest'
27-
cabal: 3.6.2.0
28-
exclude:
2920
- os: macOS-latest
30-
ghc: '8.0.2'
21+
ghc: '9.2.6'
22+
cabal: '3.8.1.0'
3123
- os: macOS-latest
32-
ghc: '8.2.2'
33-
- os: macOS-latest
34-
ghc: '8.4.4'
35-
- os: macOS-latest
36-
ghc: '8.6.5'
37-
- os: macOS-latest
38-
ghc: '8.8.4'
39-
- os: macOS-latest
40-
ghc: '9.0.2'
41-
- os: windows-latest
42-
ghc: '8.0.2'
24+
ghc: '9.4.4'
25+
cabal: '3.8.1.0'
4326
- os: windows-latest
44-
ghc: '8.2.2'
27+
ghc: '9.2.6'
28+
cabal: '3.8.1.0'
4529
- os: windows-latest
46-
ghc: '8.4.4'
47-
- os: windows-latest
48-
ghc: '8.6.5'
49-
- os: windows-latest
50-
ghc: '8.8.4'
51-
- os: windows-latest
52-
ghc: '9.0.2'
53-
30+
ghc: '9.4.4'
31+
cabal: '3.8.1.0'
5432
steps:
55-
- uses: actions/checkout@v2
33+
- uses: actions/checkout@v3
34+
35+
- name: Workaround runner image issue
36+
if: runner.os == 'Linux'
37+
# https://github.com/actions/runner-images/issues/7061
38+
run: sudo chown -R $USER /usr/local/.ghcup
5639

5740
- name: Install dependencies (Ubuntu)
58-
if: runner.os == "Linux"
41+
if: runner.os == 'Linux'
5942
run: |
60-
apt-get -y update
61-
apt-get -y install libtinfo5 libtinfo6 libncurses5 libncurses6
43+
sudo apt-get -y update
44+
sudo apt-get -y install libtinfo5 libtinfo6 libncurses5 libncurses6
6245
6346
- name: Install ghc/cabal
6447
run: |
6548
set -eux
66-
if [ "${{ matrix.ghc }}" == 'HEAD' ] ; then
67-
ghcup install ghc -u 'https://gitlab.haskell.org/api/v4/projects/1/jobs/artifacts/master/raw/ghc-x86_64-linux-deb10-unreg-validate.tar.xz?job=x86_64-linux-deb10-unreg-validate' head
68-
ghcup set ghc head
69-
else
70-
ghcup install ghc ${{ matrix.ghc }}
71-
ghcup set ghc ${{ matrix.ghc }}
72-
fi
49+
ghcup install ghc --set ${{ matrix.ghc }}
7350
ghcup install cabal ${{ matrix.cabal }}
7451
shell: bash
7552

7653
- name: Build
7754
run: |
7855
set -eux
79-
[ "${{ matrix.ghc }}" == 'HEAD' ] ||
80-
[ "${{ matrix.ghc }}" == 'recommended' ] ||
81-
[ "${{ matrix.ghc }}" == 'latest' ] ||
82-
[ "$(ghc --numeric-version)" = "${{ matrix.ghc }}" ]
56+
[ "$(ghc --numeric-version)" = "${{ matrix.ghc }}" ]
8357
cabal update
8458
cabal build --enable-tests --enable-benchmarks
8559
cabal test
@@ -97,43 +71,82 @@ jobs:
9771
make all
9872
git diff --exit-code
9973
100-
emulated:
101-
needs: build
102-
runs-on: ubuntu-latest
103-
strategy:
104-
fail-fast: true
105-
matrix:
106-
arch: ['s390x', 'ppc64le', 'armv7', 'aarch64']
107-
steps:
108-
- uses: actions/checkout@v2
109-
- uses: uraimo/[email protected]
110-
timeout-minutes: 60
111-
with:
112-
arch: ${{ matrix.arch }}
113-
distro: ubuntu20.04
114-
githubToken: ${{ github.token }}
115-
install: |
116-
apt-get update -y
117-
apt-get install -y ghc libghc-quickcheck2-dev cpphs git make
118-
run: |
119-
ghc --version
120-
ghc --make -o Main tests/filepath-tests/Test.hs -itests/ -itests/filepath-tests/ +RTS -s
121-
./Main +RTS -s
122-
123-
emulated-i386:
74+
i386:
12475
runs-on: ubuntu-latest
12576
container:
12677
image: i386/ubuntu:bionic
12778
steps:
128-
- name: install
79+
- name: Install
12980
run: |
130-
apt-get update -y
131-
apt-get install -y ghc libghc-quickcheck2-dev cpphs git make
132-
shell: bash
81+
apt-get update -y
82+
apt-get install -y autoconf build-essential zlib1g-dev libgmp-dev curl libncurses5 libtinfo5 libncurses5-dev libtinfo-dev
83+
curl --proto '=https' --tlsv1.2 -sSf https://get-ghcup.haskell.org | BOOTSTRAP_HASKELL_NONINTERACTIVE=1 BOOTSTRAP_HASKELL_INSTALL_NO_STACK=1 sh
13384
- uses: actions/checkout@v1
134-
- name: test
85+
- name: Test
13586
run: |
136-
ghc --version
137-
ghc --make -o Main tests/filepath-tests/Test.hs -itests/ -itests/filepath-tests/ +RTS -s
138-
./Main +RTS -s
139-
shell: bash
87+
. ~/.ghcup/env
88+
cabal update
89+
cabal test
90+
91+
# We use github.com/haskell self-hosted runners for ARM testing.
92+
# If they become unavailable in future, put ['armv7', 'aarch64']
93+
# back to emulation jobs above.
94+
arm:
95+
runs-on: [self-hosted, Linux, ARM64]
96+
strategy:
97+
fail-fast: true
98+
matrix:
99+
arch: [arm32v7, arm64v8]
100+
steps:
101+
- uses: docker://hasufell/arm64v8-ubuntu-haskell:focal
102+
name: Cleanup
103+
with:
104+
args: "find . -mindepth 1 -maxdepth 1 -exec rm -rf -- {} +"
105+
106+
- name: Checkout code
107+
uses: actions/checkout@v3
108+
109+
- if: matrix.arch == 'arm32v7'
110+
uses: docker://hasufell/arm32v7-ubuntu-haskell:focal
111+
name: Run build (arm32v7 linux)
112+
with:
113+
args: sh -c "cabal update && ghcup install ghc --isolate=/usr --force 9.2.2 && cabal test -w ghc-9.2.2"
114+
115+
- if: matrix.arch == 'arm64v8'
116+
uses: docker://hasufell/arm64v8-ubuntu-haskell:focal
117+
name: Run build (arm64v8 linux)
118+
with:
119+
args: sh -c "cabal update && ghcup install ghc --isolate=/usr --force 9.2.2 && cabal test -w ghc-9.2.2"
120+
121+
darwin_arm:
122+
runs-on: ${{ matrix.os }}
123+
env:
124+
MACOSX_DEPLOYMENT_TARGET: 10.13
125+
strategy:
126+
fail-fast: false
127+
matrix:
128+
include:
129+
- os: [self-hosted, macOS, ARM64]
130+
ghc: 8.10.7
131+
- os: [self-hosted, macOS, ARM64]
132+
ghc: 9.2.6
133+
- os: [self-hosted, macOS, ARM64]
134+
ghc: 9.4.4
135+
steps:
136+
- name: Checkout code
137+
uses: actions/checkout@v3
138+
139+
- name: Run build
140+
run: |
141+
bash .github/scripts/brew.sh git coreutils llvm@11 autoconf automake
142+
export PATH="$HOME/.brew/bin:$HOME/.brew/sbin:$HOME/.brew/opt/llvm@11/bin:$PATH"
143+
export CC="$HOME/.brew/opt/llvm@11/bin/clang"
144+
export CXX="$HOME/.brew/opt/llvm@11/bin/clang++"
145+
export LD=ld
146+
export AR="$HOME/.brew/opt/llvm@11/bin/llvm-ar"
147+
export RANLIB="$HOME/.brew/opt/llvm@11/bin/llvm-ranlib"
148+
. .github/scripts/env.sh
149+
curl --proto '=https' --tlsv1.2 -sSf https://get-ghcup.haskell.org | BOOTSTRAP_HASKELL_NONINTERACTIVE=1 BOOTSTRAP_HASKELL_INSTALL_NO_STACK=1 BOOTSTRAP_HASKELL_GHC_VERSION=${{ matrix.ghc }} BOOTSTRAP_HASKELL_ADJUST_BASHRC=yes sh
150+
cabal test
151+
env:
152+
HOMEBREW_CHANGE_ARCH_TO_ARM: 1

tests/abstract-filepath/EncodingSpec.hs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
{-# LANGUAGE CPP #-}
12
{-# LANGUAGE ScopedTypeVariables #-}
23
{-# LANGUAGE ViewPatterns #-}
34
{-# LANGUAGE TypeApplications #-}
@@ -38,7 +39,11 @@ tests =
3839
let str = [toEnum 55296, toEnum 55297]
3940
encoded = encodeWithTE utf16le str
4041
decoded = decodeWithTE utf16le =<< encoded
42+
#if __GLASGOW_HASKELL__ >= 904
43+
in decoded === Left (EncodingError ("recoverEncode: invalid argument (cannot encode character " <> show (head str) <> ")") Nothing))
44+
#else
4145
in decoded === Left (EncodingError "recoverEncode: invalid argument (invalid character)" Nothing))
46+
#endif
4247
, ("ucs2 handles invalid surrogate pairs",
4348
property $
4449
let str = [toEnum 55296, toEnum 55297]
@@ -64,7 +69,11 @@ tests =
6469
let str = [toEnum 0xDFF0, toEnum 0xDFF2]
6570
encoded = encodeWithTE (mkUTF8 RoundtripFailure) str
6671
decoded = decodeWithTE (mkUTF8 RoundtripFailure) =<< encoded
72+
#if __GLASGOW_HASKELL__ >= 904
73+
in decoded === Left (EncodingError ("recoverEncode: invalid argument (cannot encode character " <> show (head str) <> ")") Nothing))
74+
#else
6775
in decoded === Left (EncodingError "recoverEncode: invalid argument (invalid character)" Nothing))
76+
#endif
6877

6978
, ("cannot roundtrip arbitrary bytes through utf-16 (with RoundtripFailure)",
7079
property $

0 commit comments

Comments
 (0)