-
Notifications
You must be signed in to change notification settings - Fork 42
135 lines (119 loc) · 4.38 KB
/
cabal-mac-win.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
name: CI for macOS and Windows building with cabal
on:
push:
branches:
- master
pull_request:
branches:
- master
jobs:
cabal:
name: Cabal
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [macOS-latest, windows-latest]
ghc:
- 9.2.8
- 9.4.8
- 9.6.6
- 9.8.2
- 9.10.1
fail-fast: false
steps:
# Andreas, 2023-02-12:
# Putting the MSYS2 /usr/bin (and thus 'tar') into the PATH destroys the Cache action v3.
# See: https://github.com/actions/cache/issues/1073
# However the /mingw64/bin PATH for the MSYS2-installed 'pkg-config' is fine.
#
- name: Setup MSYS path for pkg-config
if: ${{ runner.os == 'Windows' }}
run: |
echo "C:\msys64\mingw64\bin" | Out-File -FilePath "$env:GITHUB_PATH" -Append
- name: Install the ICU library (Windows)
if: ${{ runner.os == 'Windows' }}
shell: pwsh
## Even though pwsh is default for windows, keep this for sake of actionlint/shellcheck!
run: |
$env:PATH = "C:\msys64\usr\bin;$env:PATH"
pacman --noconfirm -S mingw-w64-x86_64-pkg-config mingw-w64-x86_64-icu
# Installing ICU is not necessary, macOS-latest already has v69.1
# - name: Install the ICU library (macOS)
# shell: bash
# run: |
# brew install icu4c
# Let `pkg-config` find the ICU libs.
# Also test whether it actually works, and print some debug information.
- name: Set up pkg-config for the ICU library (macOS)
if: ${{ runner.os == 'macOS' }}
run: |
PKG_CONFIG_PATH=$(brew --prefix)/opt/icu4c/lib/pkgconfig
echo "PKG_CONFIG_PATH=${PKG_CONFIG_PATH}" >> "${GITHUB_ENV}"
## The rest is debug info:
echo "$ ls -l ${PKG_CONFIG_PATH}/"
ls -l "${PKG_CONFIG_PATH}/"
export PKG_CONFIG_PATH
echo "$ pkg-config --modversion icu-i18n"
pkg-config --modversion icu-i18n
echo "$ pkg-config --libs --static icu-i18n"
pkg-config --libs --static icu-i18n
# # Test of `pkg-config --list-all` in connection with macOS-11/12 env bug:
# # https://github.com/actions/runner-images/issues/6364
# # This was fixed upstream 2022-10-10.
# - name: Check integrity of pkg-config database
# if: ${{ runner.os == 'macOS' }}
# run: |
# echo "$ pkg-config --list-all"
# pkg-config --list-all
# echo "========================================================================"
# echo "$ pkg-config --list-all | cut -f 1 -d ' '"
# pkg-config --list-all | cut -f 1 -d ' '
# echo "========================================================================"
# echo "$ pkg-config --list-all | cut -f 1 -d ' ' | xargs pkg-config --modversion"
# pkg-config --list-all | cut -f 1 -d ' ' | xargs pkg-config --modversion
- name: Determine the ICU version
shell: bash
run: |
ICU_VER=$(pkg-config --modversion icu-i18n)
echo "ICU_VER=${ICU_VER}"
echo "ICU_VER=${ICU_VER}" >> "${GITHUB_ENV}"
- name: Checkout
uses: actions/checkout@v4
- name: Setup Haskell
uses: haskell-actions/setup@v2
id: setup
with:
ghc-version: ${{ matrix.ghc }}
cabal-update: true
- name: Configure
run: |
cabal configure --enable-tests
cabal build --dry-run
# cabal build --dry-run creates dist-newstyle/cache/plan.json
- name: Restore cached build products
uses: actions/cache/restore@v4
id: cache
with:
path: |
${{ steps.setup.outputs.cabal-store }}
dist-newstyle
key: ${{ env.key }}-cabal-${{ steps.setup.outputs.cabal-version }}-plan-${{ hashFiles('dist-newstyle/cache/plan.json') }}
restore-keys: |
${{ env.key }}-cabal-${{ steps.setup.outputs.cabal-version }}-
${{ env.key }}-
env:
key: ${{ runner.os }}-ghc-${{ steps.setup.outputs.ghc-version }}-icu-${{ env.ICU_VER }}-
- name: Build
run: |
cabal build all
- name: Test
run: |
cabal test all --test-show-details=direct
- name: Cache build products
uses: actions/cache/save@v4
if: always() && steps.cache.outputs.cache-hit != 'true'
with:
path: |
${{ steps.setup.outputs.cabal-store }}
dist-newstyle
key: ${{ steps.cache.outputs.cache-primary-key }}