Merge pull request #868 from DrTimothyAldenDavis/dev2 #9
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |