-
Notifications
You must be signed in to change notification settings - Fork 262
249 lines (225 loc) · 8.71 KB
/
build-arch-emu.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
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
name: arch-emu
on:
workflow_dispatch:
push:
branches-ignore:
- '**/dev2'
- '**/*dev2'
pull_request:
concurrency: ci-arch-emu-${{ 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"
# 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"
# string with name of libraries that are installed
INSTALLED_LIBS: "SuiteSparse_config:Mongoose:AMD:BTF:CAMD:CCOLAMD:COLAMD:CHOLMOD:CXSparse:LDL:KLU:UMFPACK:ParU:RBio:SPQR:SPEX"
jobs:
alpine:
runs-on: ubuntu-latest
defaults:
run:
# Use emulated shell as default
shell: alpine.sh {0}
strategy:
# Allow other runners in the matrix to continue if some fail
fail-fast: false
matrix:
# For available CPU architectures, see:
# https://github.com/marketplace/actions/setup-alpine-linux-environment
arch: [x86, aarch64, armv7, ppc64le, s390x, riscv64]
include:
- arch: x86
ccache-max: 64M
extra-build-libs: ":GraphBLAS:LAGraph"
extra-check-libs: ":GraphBLAS:LAGraph"
- arch: aarch64
ccache-max: 28M
- arch: armv7
ccache-max: 25M
- arch: ppc64le
ccache-max: 28M
- arch: s390x
ccache-max: 28M
- arch: riscv64
ccache-max: 28M
name: alpine (${{ matrix.arch }})
steps:
- name: get CPU information (host)
shell: bash
run: lscpu
- name: checkout repository
uses: actions/checkout@v4
# shell: bash
- name: install dependencies
uses: jirutka/setup-alpine@v1
# shell: bash
with:
arch: ${{ matrix.arch }}
packages: >
build-base
ccache
cmake
gfortran
m4
gmp-dev
mpfr-dev
lapack-dev
python3
util-linux-misc
autoconf
automake
libtool
# ${{ matrix.arch != 'riscv64' && 'valgrind' || '' }}
- name: get CPU information (emulated)
run: lscpu
- 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:alpine:${{ matrix.arch }}:${{ 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@v4
with:
# location of the ccache of the chroot in the root file system
path: /home/runner/rootfs/alpine-latest-${{ matrix.arch }}/home/runner/.ccache
key: ${{ steps.ccache-prepare.outputs.key }}
# Prefer caches from the same branch. Fall back to caches from the dev branch.
restore-keys: |
ccache:alpine:${{ matrix.arch }}:${{ github.ref }}
ccache:alpine:${{ matrix.arch }}
- name: configure ccache
env:
CCACHE_MAX: ${{ matrix.ccache-max }}
run: |
test -d ~/.ccache || mkdir ~/.ccache
echo "max_size = $CCACHE_MAX" >> ~/.ccache/ccache.conf
echo "compression = true" >> ~/.ccache/ccache.conf
ccache -s
which ccache
# echo "/usr/lib/ccache" >> $GITHUB_PATH
- name: build
run: |
echo "gcc --version"
gcc --version
echo "gcc -dumpmachine"
gcc -dumpmachine
IFS=:
BUILD_LIBS="${BUILD_LIBS}${{ matrix.extra-build-libs }}"
for lib in ${BUILD_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" \
-DBUILD_SHARED_LIBS=ON \
-DBUILD_STATIC_LIBS=OFF \
-DBLA_VENDOR="Generic" \
-DGRAPHBLAS_COMPACT=ON \
-DSUITESPARSE_DEMOS=OFF \
-DBUILD_TESTING=OFF \
..
echo "::endgroup::"
echo "::group::Build $lib"
cmake --build . --config Release
echo "::endgroup::"
done
- name: check
timeout-minutes: 60
run: |
IFS=':'
CHECK_LIBS="${CHECK_LIBS}${{ matrix.extra-check-libs }}"
for lib in ${CHECK_LIBS}; do
printf "::group:: \033[0;32m==>\033[0m Checking library \033[0;32m${lib}\033[0m\n"
cd ${GITHUB_WORKSPACE}/${lib}
make demos CMAKE_OPTIONS="-DSUITESPARSE_DEMOS=ON -DBUILD_TESTING=ON"
echo "::endgroup::"
done
- 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@v4
with:
path: /home/runner/rootfs/alpine-latest-${{ matrix.arch }}/home/runner/.ccache
key: ${{ steps.ccache-prepare.outputs.key }}
- name: install
run: |
IFS=':'
BUILD_LIBS="${BUILD_LIBS}${{ matrix.extra-build-libs }}"
for lib in ${BUILD_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 using CMake
run: |
cd ${GITHUB_WORKSPACE}/Example/build
printf "::group::\033[0;32m==>\033[0m Configuring example\n"
cmake \
-DCMAKE_PREFIX_PATH="${GITHUB_WORKSPACE}/lib/cmake" \
-DBLA_VENDOR="Generic" \
..
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
echo "::endgroup::"
- name: test Config
run: |
IFS=:
INSTALLED_LIBS="${INSTALLED_LIBS}${{ matrix.extra-build-libs }}"
for lib in ${INSTALLED_LIBS}; do
printf "::group:: \033[0;32m==>\033[0m Building with Config.cmake with library \033[0;32m${lib}\033[0m\n"
cd ${GITHUB_WORKSPACE}/TestConfig/${lib}
cd build
cmake \
-DCMAKE_PREFIX_PATH="${GITHUB_WORKSPACE}/lib/cmake" \
..
cmake --build . --config Release
echo "::endgroup::"
done
- name: build example using autotools
run: |
cd ${GITHUB_WORKSPACE}/Example
printf "::group::\033[0;32m==>\033[0m Configuring example\n"
autoreconf -fi
mkdir build-autotools
cd build-autotools
PKG_CONFIG_PATH=${GITHUB_WORKSPACE}/lib/pkgconfig/ \
../configure --enable-shared --disable-static
echo "::endgroup::"
printf "::group::\033[0;32m==>\033[0m Building example\n"
make all
echo "::endgroup::"
printf "::group::\033[0;32m==>\033[0m Executing example\n"
printf "\033[1;35m C binary\033[0m\n"
LD_LIBRARY_PATH=${GITHUB_WORKSPACE}/lib ./my_demo
printf "\033[1;35m C++ binary\033[0m\n"
LD_LIBRARY_PATH=${GITHUB_WORKSPACE}/lib ./my_cxx_demo
echo "::endgroup::"
IFS=:
INSTALLED_LIBS="${INSTALLED_LIBS}${{ matrix.extra-build-libs }}"
for lib in ${INSTALLED_LIBS}; do
printf "::group:: \033[0;32m==>\033[0m Building test with library \033[0;32m${lib}\033[0m\n"
cd ${GITHUB_WORKSPACE}/TestConfig/${lib}
autoreconf -fi
mkdir build-autotools && cd build-autotools
PKG_CONFIG_PATH=${GITHUB_WORKSPACE}/lib/pkgconfig/ \
../configure --enable-shared --disable-static
make all
echo "::endgroup::"
done