-
Notifications
You must be signed in to change notification settings - Fork 262
235 lines (201 loc) · 7.76 KB
/
macos.yaml
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
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
name: macos
on:
workflow_dispatch:
push:
branches-ignore:
- '**/dev2'
- '**/*dev2'
pull_request:
concurrency: ci-${{ github.ref }}
env:
# string with name of libraries to be built
BUILD_LIBS: "SuiteSparse_config:Mongoose:AMD:BTF:CAMD:CCOLAMD:COLAMD:CHOLMOD:CSparse:CXSparse:LDL:KLU:UMFPACK:ParU:RBio:SPQR:SPEX:GraphBLAS:LAGraph"
# string with name of libraries to be checked
CHECK_LIBS: "SuiteSparse_config:Mongoose:AMD:BTF:CAMD:CCOLAMD:COLAMD:CHOLMOD:CSparse:CXSparse:LDL:KLU:UMFPACK:ParU:RBio:SPQR:SPEX:GraphBLAS:LAGraph"
CHECK_LIBS_MAC: "SuiteSparse_config:Mongoose:AMD:BTF:CAMD:CCOLAMD:COLAMD:CHOLMOD:CSparse:CXSparse:LDL:KLU:UMFPACK:RBio:SPQR:SPEX:GraphBLAS:LAGraph"
jobs:
macos:
# For available GitHub-hosted runners, see:
# https://docs.github.com/en/actions/using-github-hosted-runners/about-github-hosted-runners
runs-on: macos-latest
steps:
- name: checkout repository
uses: actions/checkout@v3
- name: install dependencies
# Homebrew's Python conflicts with the Python that comes pre-installed
# on the GitHub runners. Some of SuiteSparse's dependencies depend on
# different versions of Homebrew's Python. Enforce using the ones from
# Homebrew to avoid errors on updates.
# See: https://github.com/orgs/Homebrew/discussions/3928
# It looks like "gfortran" isn't working correctly unless "gcc" is
# re-installed.
run: |
brew update
brew install --overwrite [email protected] [email protected]
brew reinstall gcc
brew install autoconf automake ccache cmake gmp lapack libomp mpfr openblas
- name: prepare ccache
# create key with human readable timestamp
# used in action/cache/restore and action/cache/save steps
id: ccache-prepare
run: |
echo "key=ccache:macos-latest:${{ github.ref }}:$(date +"%Y-%m-%d_%H-%M-%S"):${{ github.sha }}" >> $GITHUB_OUTPUT
- name: restore ccache
# setup the GitHub cache used to maintain the ccache from one job to the next
uses: actions/cache/restore@v3
with:
path: /Users/runner/Library/Caches/ccache
key: ${{ steps.ccache-prepare.outputs.key }}
# Prefer caches from the same branch. Fall back to caches from the dev branch.
restore-keys: |
ccache:macos-latest:${{ github.ref }}
ccache:macos-latest
- name: configure ccache
# Limit the maximum size to avoid exceeding the total cache limits.
run: |
test -d /Users/runner/Library/Preferences/ccache || mkdir /Users/runner/Library/Preferences/ccache
echo "max_size = 300M" >> /Users/runner/Library/Preferences/ccache/ccache.conf
ccache -s
- name: build
run: |
IFS=':' read -r -a libs <<< "${BUILD_LIBS}"
for lib in "${libs[@]}"; do
printf " \033[0;32m==>\033[0m Building library \033[0;32m${lib}\033[0m\n"
echo "::group::Configure $lib"
cd ${GITHUB_WORKSPACE}/${lib}/build
cmake -DCMAKE_BUILD_TYPE="Release" \
-DCMAKE_INSTALL_PREFIX="${GITHUB_WORKSPACE}" \
-DCMAKE_C_COMPILER_LAUNCHER="ccache" \
-DCMAKE_CXX_COMPILER_LAUNCHER="ccache" \
-DCMAKE_Fortran_COMPILER_LAUNCHER="ccache" \
-DBLA_VENDOR="OpenBLAS" \
-DCMAKE_PREFIX_PATH="/usr/local/opt/lapack;/usr/local/opt/openblas;/usr/local/opt/libomp" \
..
echo "::endgroup::"
echo "::group::Build $lib"
cmake --build . --config Release
echo "::endgroup::"
done
# - name: check
# timeout-minutes: 20
# run: |
# # this check seems to hang intermittently at this point, before
# # printing the IFS statement and before running any 'make demos'.
# # Adding some debug echo statements here:
# echo "::group::Starting check (1)"
# echo "::endgroup::"
# echo "::group::Starting check (2)"
# IFS=':' read -r -a libs <<< "${CHECK_LIBS_MAC}"
# echo "::endgroup::"
# for lib in "${libs[@]}"; do
# printf "::group:: \033[0;32m==>\033[0m Checking library \033[0;32m${lib}\033[0m\n"
# cd ${GITHUB_WORKSPACE}/${lib}
# make demos
# echo "::endgroup::"
# done
- name: check_Mongoose
run: |
cd ${GITHUB_WORKSPACE}/Mongoose/build
ctest .
- name: check_AMD
run: |
cd ${GITHUB_WORKSPACE}/AMD
make demos
- name: check_CAMD
run: |
cd ${GITHUB_WORKSPACE}/CAMD
make demos
- name: check_COLAMD
run: |
cd ${GITHUB_WORKSPACE}/COLAMD
make demos
- name: check_CCOLAMD
run: |
cd ${GITHUB_WORKSPACE}/CCOLAMD
make demos
- name: check_CHOLMOD
run: |
cd ${GITHUB_WORKSPACE}/CHOLMOD
make demos
cd ${GITHUB_WORKSPACE}/CHOLMOD/build
ctest .
- name: check_CSparse
run: |
cd ${GITHUB_WORKSPACE}/CSparse
make demos
- name: check_CXSparse
run: |
cd ${GITHUB_WORKSPACE}/CXSparse
make demos
- name: check_LDL
run: |
cd ${GITHUB_WORKSPACE}/LDL
make demos
- name: check_KLU
run: |
cd ${GITHUB_WORKSPACE}/KLU
make demos
- name: check_UMFPACK
run: |
cd ${GITHUB_WORKSPACE}/UMFPACK
make demos
- name: check_RBio
run: |
cd ${GITHUB_WORKSPACE}/RBio
make demos
- name: check_SPQR
run: |
cd ${GITHUB_WORKSPACE}/SPQR
make demos
- name: check_SPEX
run: |
cd ${GITHUB_WORKSPACE}/SPEX
make demos
- name: check_GraphBLAS
run: |
cd ${GITHUB_WORKSPACE}/GraphBLAS
make demos
- name: check_LAGraph
run: |
cd ${GITHUB_WORKSPACE}/LAGraph/build
ctest .
- name: ccache status
continue-on-error: true
run: ccache -s
- name: save ccache
# Save the cache after we are done (successfully) building
# This helps to retain the ccache even if the subsequent steps are failing.
uses: actions/cache/save@v3
with:
path: /Users/runner/Library/Caches/ccache
key: ${{ steps.ccache-prepare.outputs.key }}
- name: install
run: |
IFS=':' read -r -a libs <<< "${BUILD_LIBS}"
for lib in "${libs[@]}"; do
printf "::group::\033[0;32m==>\033[0m Installing library \033[0;32m${lib}\033[0m\n"
cd ${GITHUB_WORKSPACE}/${lib}/build
cmake --install .
echo "::endgroup::"
done
- name: build example
run: |
cd ${GITHUB_WORKSPACE}/Example/build
printf "::group::\033[0;32m==>\033[0m Configuring example\n"
cmake \
-DCMAKE_PREFIX_PATH="${GITHUB_WORKSPACE}/lib/cmake;/usr/local/opt/lapack;/usr/local/opt/openblas;/usr/local/opt/libomp" \
..
echo "::endgroup::"
printf "::group::\033[0;32m==>\033[0m Building example\n"
cmake --build .
echo "::endgroup::"
printf "::group::\033[0;32m==>\033[0m Executing example\n"
printf "\033[1;35m C binary with shared libraries\033[0m\n"
./my_demo
printf "\033[1;35m C++ binary with shared libraries\033[0m\n"
./my_cxx_demo
printf "\033[1;35m C binary with statically linked libraries\033[0m\n"
./my_demo_static
printf "\033[1;35m C++ binary with statically linked libraries\033[0m\n"
./my_cxx_demo_static
echo "::endgroup::"