|
| 1 | +name: arch-emu |
| 2 | +on: |
| 3 | + workflow_dispatch: |
| 4 | + push: |
| 5 | + branches-ignore: |
| 6 | + - '**/dev2' |
| 7 | + - '**/*dev2' |
| 8 | + pull_request: |
| 9 | + |
| 10 | +concurrency: ci-arch-emu-${{ github.ref }} |
| 11 | + |
| 12 | +env: |
| 13 | + # string with name of libraries to be built |
| 14 | + BUILD_LIBS: "SuiteSparse_config:AMD:COLAMD:SPEX" |
| 15 | + # string with name of libraries to be checked |
| 16 | + CHECK_LIBS: "SuiteSparse_config:AMD:COLAMD:SPEX" |
| 17 | + # string with name of libraries that are installed |
| 18 | + INSTALLED_LIBS: "SuiteSparse_config:AMD::COLAMD:SPEX" |
| 19 | + |
| 20 | + |
| 21 | +jobs: |
| 22 | + |
| 23 | + alpine: |
| 24 | + runs-on: ubuntu-latest |
| 25 | + |
| 26 | + defaults: |
| 27 | + run: |
| 28 | + # Use emulated shell as default |
| 29 | + shell: alpine.sh {0} |
| 30 | + |
| 31 | + strategy: |
| 32 | + # Allow other runners in the matrix to continue if some fail |
| 33 | + fail-fast: false |
| 34 | + |
| 35 | + matrix: |
| 36 | + # For available CPU architectures, see: |
| 37 | + # https://github.com/marketplace/actions/setup-alpine-linux-environment |
| 38 | + arch: [x86, aarch64, armv7, ppc64le, s390x] |
| 39 | + include: |
| 40 | + - arch: x86 |
| 41 | + ccache-max: 80M |
| 42 | + extra-build-libs: ":GraphBLAS:LAGraph" |
| 43 | + extra-check-libs: ":GraphBLAS:LAGraph" |
| 44 | + - arch: aarch64 |
| 45 | + ccache-max: 42M |
| 46 | + - arch: armv7 |
| 47 | + ccache-max: 42M |
| 48 | + - arch: ppc64le |
| 49 | + ccache-max: 45M |
| 50 | + - arch: s390x |
| 51 | + ccache-max: 42M |
| 52 | + |
| 53 | + name: alpine (${{ matrix.arch }}) |
| 54 | + |
| 55 | + steps: |
| 56 | + - name: get CPU information (host) |
| 57 | + shell: bash |
| 58 | + run: lscpu |
| 59 | + |
| 60 | + - name: checkout repository |
| 61 | + uses: actions/checkout@v3 |
| 62 | + # shell: bash |
| 63 | + |
| 64 | + - name: install dependencies |
| 65 | + uses: jirutka/setup-alpine@v1 |
| 66 | + # shell: bash |
| 67 | + with: |
| 68 | + arch: ${{ matrix.arch }} |
| 69 | + packages: > |
| 70 | + build-base |
| 71 | + ccache |
| 72 | + cmake |
| 73 | + gfortran |
| 74 | + m4 |
| 75 | + gmp-dev |
| 76 | + mpfr-dev |
| 77 | + lapack-dev |
| 78 | + python3 |
| 79 | + valgrind |
| 80 | + util-linux-misc |
| 81 | + autoconf |
| 82 | + automake |
| 83 | + libtool |
| 84 | +
|
| 85 | + - name: get CPU information (emulated) |
| 86 | + run: lscpu |
| 87 | + |
| 88 | + - name: prepare ccache |
| 89 | + # create key with human readable timestamp |
| 90 | + # used in action/cache/restore and action/cache/save steps |
| 91 | + id: ccache-prepare |
| 92 | + run: | |
| 93 | + echo "key=ccache:alpine:${{ matrix.arch }}:${{ github.ref }}:$(date +"%Y-%m-%d_%H-%M-%S"):${{ github.sha }}" >> $GITHUB_OUTPUT |
| 94 | +
|
| 95 | + - name: restore ccache |
| 96 | + # setup the GitHub cache used to maintain the ccache from one job to the next |
| 97 | + uses: actions/cache/restore@v3 |
| 98 | + with: |
| 99 | + # location of the ccache of the chroot in the root file system |
| 100 | + path: /home/runner/rootfs/alpine-latest-${{ matrix.arch }}/home/runner/.ccache |
| 101 | + key: ${{ steps.ccache-prepare.outputs.key }} |
| 102 | + # Prefer caches from the same branch. Fall back to caches from the dev branch. |
| 103 | + restore-keys: | |
| 104 | + ccache:alpine:${{ matrix.arch }}:${{ github.ref }} |
| 105 | + ccache:alpine:${{ matrix.arch }} |
| 106 | +
|
| 107 | + - name: configure ccache |
| 108 | + env: |
| 109 | + CCACHE_MAX: ${{ matrix.ccache-max }} |
| 110 | + run: | |
| 111 | + test -d ~/.ccache || mkdir ~/.ccache |
| 112 | + echo "max_size = $CCACHE_MAX" >> ~/.ccache/ccache.conf |
| 113 | + echo "compression = true" >> ~/.ccache/ccache.conf |
| 114 | + ccache -s |
| 115 | + which ccache |
| 116 | + # echo "/usr/lib/ccache" >> $GITHUB_PATH |
| 117 | +
|
| 118 | + - name: build |
| 119 | + run: | |
| 120 | + echo "gcc --version" |
| 121 | + gcc --version |
| 122 | + echo "gcc -dumpmachine" |
| 123 | + gcc -dumpmachine |
| 124 | + IFS=: |
| 125 | + BUILD_LIBS="${BUILD_LIBS}${{ matrix.extra-build-libs }}" |
| 126 | + for lib in ${BUILD_LIBS}; do |
| 127 | + printf " \033[0;32m==>\033[0m Building library \033[0;32m${lib}\033[0m\n" |
| 128 | + echo "::group::Configure $lib" |
| 129 | + cd ${GITHUB_WORKSPACE}/${lib}/build |
| 130 | + cmake -DCMAKE_BUILD_TYPE="Release" \ |
| 131 | + -DCMAKE_INSTALL_PREFIX="${GITHUB_WORKSPACE}" \ |
| 132 | + -DCMAKE_C_COMPILER_LAUNCHER="ccache" \ |
| 133 | + -DCMAKE_CXX_COMPILER_LAUNCHER="ccache" \ |
| 134 | + -DCMAKE_Fortran_COMPILER_LAUNCHER="ccache" \ |
| 135 | + -DBUILD_SHARED_LIBS=ON \ |
| 136 | + -DBUILD_STATIC_LIBS=OFF \ |
| 137 | + -DBLA_VENDOR="Generic" \ |
| 138 | + -DGRAPHBLAS_COMPACT=ON \ |
| 139 | + -DSUITESPARSE_DEMOS=OFF \ |
| 140 | + -DBUILD_TESTING=OFF \ |
| 141 | + .. |
| 142 | + echo "::endgroup::" |
| 143 | + echo "::group::Build $lib" |
| 144 | + cmake --build . --config Release |
| 145 | + echo "::endgroup::" |
| 146 | + done |
| 147 | +
|
| 148 | + - name: check |
| 149 | + timeout-minutes: 60 |
| 150 | + run: | |
| 151 | + IFS=':' |
| 152 | + CHECK_LIBS="${CHECK_LIBS}${{ matrix.extra-check-libs }}" |
| 153 | + for lib in ${CHECK_LIBS}; do |
| 154 | + printf "::group:: \033[0;32m==>\033[0m Checking library \033[0;32m${lib}\033[0m\n" |
| 155 | + cd ${GITHUB_WORKSPACE}/${lib} |
| 156 | + make demos CMAKE_OPTIONS="-DSUITESPARSE_DEMOS=ON -DBUILD_TESTING=ON" |
| 157 | + echo "::endgroup::" |
| 158 | + done |
| 159 | +
|
| 160 | + - name: ccache status |
| 161 | + continue-on-error: true |
| 162 | + run: ccache -s |
| 163 | + |
| 164 | + - name: save ccache |
| 165 | + # Save the cache after we are done (successfully) building |
| 166 | + # This helps to retain the ccache even if the subsequent steps are failing. |
| 167 | + uses: actions/cache/save@v3 |
| 168 | + with: |
| 169 | + path: /home/runner/rootfs/alpine-latest-${{ matrix.arch }}/home/runner/.ccache |
| 170 | + key: ${{ steps.ccache-prepare.outputs.key }} |
| 171 | + |
| 172 | + - name: install |
| 173 | + run: | |
| 174 | + IFS=':' |
| 175 | + BUILD_LIBS="${BUILD_LIBS}${{ matrix.extra-build-libs }}" |
| 176 | + for lib in ${BUILD_LIBS}; do |
| 177 | + printf "::group::\033[0;32m==>\033[0m Installing library \033[0;32m${lib}\033[0m\n" |
| 178 | + cd ${GITHUB_WORKSPACE}/${lib}/build |
| 179 | + cmake --install . |
| 180 | + echo "::endgroup::" |
| 181 | + done |
| 182 | +
|
| 183 | + - name: build example using CMake |
| 184 | + run: | |
| 185 | + cd ${GITHUB_WORKSPACE}/Example/build |
| 186 | + printf "::group::\033[0;32m==>\033[0m Configuring example\n" |
| 187 | + cmake \ |
| 188 | + -DCMAKE_PREFIX_PATH="${GITHUB_WORKSPACE}/lib/cmake" \ |
| 189 | + -DBLA_VENDOR="Generic" \ |
| 190 | + .. |
| 191 | + echo "::endgroup::" |
| 192 | + printf "::group::\033[0;32m==>\033[0m Building example\n" |
| 193 | + cmake --build . |
| 194 | + echo "::endgroup::" |
| 195 | + printf "::group::\033[0;32m==>\033[0m Executing example\n" |
| 196 | + printf "\033[1;35m C binary with shared libraries\033[0m\n" |
| 197 | + ./my_demo |
| 198 | + printf "\033[1;35m C++ binary with shared libraries\033[0m\n" |
| 199 | + ./my_cxx_demo |
| 200 | + echo "::endgroup::" |
| 201 | +
|
| 202 | + - name: test Config |
| 203 | + run: | |
| 204 | + IFS=: |
| 205 | + INSTALLED_LIBS="${INSTALLED_LIBS}${{ matrix.extra-build-libs }}" |
| 206 | + for lib in ${INSTALLED_LIBS}; do |
| 207 | + printf "::group:: \033[0;32m==>\033[0m Building with Config.cmake with library \033[0;32m${lib}\033[0m\n" |
| 208 | + cd ${GITHUB_WORKSPACE}/TestConfig/${lib} |
| 209 | + cd build |
| 210 | + cmake \ |
| 211 | + -DCMAKE_PREFIX_PATH="${GITHUB_WORKSPACE}/lib/cmake" \ |
| 212 | + .. |
| 213 | + cmake --build . --config Release |
| 214 | + echo "::endgroup::" |
| 215 | + done |
| 216 | +
|
| 217 | + - name: build example using autotools |
| 218 | + run: | |
| 219 | + cd ${GITHUB_WORKSPACE}/Example |
| 220 | + printf "::group::\033[0;32m==>\033[0m Configuring example\n" |
| 221 | + autoreconf -fi |
| 222 | + mkdir build-autotools |
| 223 | + cd build-autotools |
| 224 | + PKG_CONFIG_PATH=${GITHUB_WORKSPACE}/lib/pkgconfig/ \ |
| 225 | + ../configure --enable-shared --disable-static |
| 226 | + echo "::endgroup::" |
| 227 | + printf "::group::\033[0;32m==>\033[0m Building example\n" |
| 228 | + make all |
| 229 | + echo "::endgroup::" |
| 230 | + printf "::group::\033[0;32m==>\033[0m Executing example\n" |
| 231 | + printf "\033[1;35m C binary\033[0m\n" |
| 232 | + LD_LIBRARY_PATH=${GITHUB_WORKSPACE}/lib ./my_demo |
| 233 | + printf "\033[1;35m C++ binary\033[0m\n" |
| 234 | + LD_LIBRARY_PATH=${GITHUB_WORKSPACE}/lib ./my_cxx_demo |
| 235 | + echo "::endgroup::" |
| 236 | + IFS=: |
| 237 | + INSTALLED_LIBS="${INSTALLED_LIBS}${{ matrix.extra-build-libs }}" |
| 238 | + for lib in ${INSTALLED_LIBS}; do |
| 239 | + printf "::group:: \033[0;32m==>\033[0m Building test with library \033[0;32m${lib}\033[0m\n" |
| 240 | + cd ${GITHUB_WORKSPACE}/TestConfig/${lib} |
| 241 | + autoreconf -fi |
| 242 | + mkdir build-autotools && cd build-autotools |
| 243 | + PKG_CONFIG_PATH=${GITHUB_WORKSPACE}/lib/pkgconfig/ \ |
| 244 | + ../configure --enable-shared --disable-static |
| 245 | + make all |
| 246 | + echo "::endgroup::" |
| 247 | + done |
0 commit comments