-
-
Notifications
You must be signed in to change notification settings - Fork 322
178 lines (152 loc) · 6.22 KB
/
binaries-mac-arm64.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
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
# TRIGGER: Runs on any push to binaries-mac-arm64 or binaries branches.
# ACTION: Builds, tests and saves mac arm64 dynamic binaries with stack and the default ghc.
name: binaries-mac-arm64
on:
push:
branches: [ binaries-mac-arm64, binaries ]
workflow_dispatch:
jobs:
build:
# arm64
runs-on: macos-14
env:
stack: stack
steps:
- name: Show platform info
run: |
arch
uname -a
- name: Check out
uses: actions/checkout@v4
# have to fetch everything for git describe for --version
with:
fetch-depth: 0
- name: Check embedded files
run: |
brew install ripgrep
tools/checkembeddedfiles
# things to be cached/restored:
- name: process cache of stack global package db
id: stack-global
uses: actions/cache@v4
with:
path: ~/.stack
key: ${{ runner.os }}-arm64-stack-global-${{ hashFiles('**.yaml') }}
restore-keys: |
${{ runner.os }}-arm64-stack-global
- name: process cache of stack-installed programs in ~/.local/bin
id: stack-programs
uses: actions/cache@v4
with:
path: ~/.local/bin
key: ${{ runner.os }}-arm64-stack-programs-${{ hashFiles('**.yaml') }}
restore-keys: |
${{ runner.os }}-arm64-stack-programs
- name: process cache of .stack-work
uses: actions/cache@v4
with:
path: .stack-work
key: ${{ runner.os }}-arm64-stack-work-${{ hashFiles('**.yaml') }}
restore-keys: |
${{ runner.os }}-arm64-stack-work
- name: process cache of hledger-lib/.stack-work
uses: actions/cache@v4
with:
path: hledger-lib/.stack-work
key: ${{ runner.os }}-arm64-hledger-lib-stack-work-${{ hashFiles('hledger-lib/package.yaml') }}
restore-keys: |
${{ runner.os }}-arm64-hledger-lib-stack-work
- name: process cache of hledger/.stack-work
uses: actions/cache@v4
with:
path: hledger/.stack-work
key: ${{ runner.os }}-arm64-hledger-stack-work-${{ hashFiles('hledger/package.yaml') }}
restore-keys: |
${{ runner.os }}-arm64-hledger-stack-work
- name: process cache of hledger-ui/.stack-work
uses: actions/cache@v4
with:
path: hledger-ui/.stack-work
key: ${{ runner.os }}-arm64-hledger-ui-stack-work-${{ hashFiles('hledger-ui/package.yaml') }}
restore-keys: |
${{ runner.os }}-arm64-hledger-ui-stack-work
- name: process cache of hledger-web/.stack-work
uses: actions/cache@v4
with:
path: hledger-web/.stack-work
key: ${{ runner.os }}-arm64-hledger-web-stack-work-${{ hashFiles('hledger-web/package.yaml') }}
restore-keys: |
${{ runner.os }}-arm64-hledger-web-stack-work
# actions:
- name: Add .ghcup/bin to PATH for following steps
run: |
echo "$HOME/.ghcup/bin/" >> $GITHUB_PATH
- name: Install stack with ghcup if needed
run: |
if [[ ! -x ~/.ghcup/bin/ghcup ]]; then
mkdir -p ~/.ghcup/bin && curl https://downloads.haskell.org/~ghcup/aarch64-apple-darwin-ghcup > ~/.ghcup/bin/ghcup && chmod +x ~/.ghcup/bin/ghcup
fi
ghcup --version
if [[ ! -x ~/.ghcup/bin/stack ]]; then
~/.ghcup/bin/ghcup install stack 3.1.1 && ~/.ghcup/bin/ghcup set stack 3.1.1
fi
stack --version
- name: Install GHC (with stack)
run: |
$stack setup --install-ghc
# - name: Install GHC (with ghcup)
# run: |
# mkdir -p ~/.ghcup/bin && curl -sL https://downloads.haskell.org/~ghcup/arm64-apple-darwin-ghcup > ~/.ghcup/bin/ghcup && chmod +x ~/.ghcup/bin/ghcup
# ~/.ghcup/bin/ghcup install --set ghc 9.2.4 # && ~/.ghcup/bin/ghcup install stack
# echo "$HOME/.ghcup/bin/" >> $GITHUB_PATH
- name: Install haskell deps
run: |
$stack build --test --only-dependencies --dry-run
$stack build --test --only-dependencies
- name: List dep versions
run: |
$stack exec -- ghc-pkg list
- name: Build hledger and test unit tests, doc tests
run: |
$stack install --test --force-dirty --ghc-options=-fforce-recomp --ghc-options=-Werror
# --ghc-options=-split-sections doesn't work on mac
# --pedantic
- name: Install shelltestrunner
run: |
export PATH=~/.local/bin:$PATH
if [[ ! -x ~/.local/bin/shelltest ]]; then $stack install shelltestrunner-1.10; fi
shelltest --version
- name: Test functional tests (excluding addons)
run: |
export PATH=~/.local/bin:$PATH
COLUMNS=80 $stack exec -- shelltest --execdir -j16 hledger/test -x /_ -x /addons -x ledger-compat/ledger-baseline -x ledger-compat/ledger-regress -x ledger-compat/ledger-collected # bin
# This is tested here rather than in the regular CI because it's slow,
# doesn't fail too often, and the cost of late detection and fixing is low.
- name: Test haddock generation
run: |
printf "haddock: "; stack exec -- haddock --version
time $stack build --fast --haddock --no-haddock-deps --no-haddock-hyperlink-source --haddock-arguments="--no-print-missing-docs"
# --no-haddock-hyperlink-source is 25% faster
# --no-print-missing-docs is 600% quieter
# artifacts:
- name: Gather binaries
run: |
mkdir tmp
cp hledger/shell-completion/hledger-completion.bash hledger/embeddedfiles/*.{1,info} tmp
cd tmp
cp ~/.local/bin/hledger .
cp ~/.local/bin/hledger-ui .
cp ~/.local/bin/hledger-web .
strip hledger
strip hledger-ui
strip hledger-web
tar cvf hledger-mac-arm64.tar hledger hledger-ui hledger-web hledger-completion.bash
# upload-artifact loses execute permissions, so we tar the binaries to preserve them.
# github UI always zips artifacts when they are downloaded, so we don't bother compressing the tar.
# Unfortunately it means users must both unzip and untar.
# https://github.com/actions/upload-artifact?tab=readme-ov-file#limitations
- name: Upload binaries artifact
uses: actions/upload-artifact@v4
with:
name: hledger-mac-arm64
path: tmp/hledger-mac-arm64.tar