correct path #33
Workflow file for this run
This file contains hidden or 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: Run on Zinal | |
| on: | |
| push: | |
| branches: | |
| - 'fc-*' | |
| jobs: | |
| build: | |
| if: github.actor == 'fcruzcscs' | |
| runs-on: zinal | |
| steps: | |
| - name: Setup temporary dir | |
| run: | | |
| TMP_DIR=$(mktemp -d) | |
| echo "TMP_DIR=$TMP_DIR" >> $GITHUB_ENV | |
| echo "Using temp directory: $TMP_DIR" | |
| - name: Manually clone repo within tmp dir | |
| run: git clone --depth 1 --branch "${GITHUB_REF_NAME}" https://github.com/${GITHUB_REPOSITORY}.git | |
| working-directory: ${{ env.TMP_DIR }} | |
| - name: List contents of TMP_DIR | |
| run: ls -la | |
| working-directory: ${{ env.TMP_DIR }} | |
| - name: Run build inside Podman container | |
| run: | | |
| podman run --rm \ | |
| -v "$PWD":"$PWD":Z \ | |
| -v "$TMP_DIR":"$TMP_DIR":Z \ | |
| -w "$PWD" \ | |
| --env TMP_DIR="$TMP_DIR" \ | |
| --env GITHUB_REF_NAME="$GITHUB_REF_NAME" \ | |
| ghcr.io/sarus-suite/sarus-hooks/ci-runner:latest \ | |
| bash -euxc ' | |
| # Building hooks | |
| cd $TMP_DIR/sarus-hooks | |
| ## ensure dependencies are pulled (including libsarus) | |
| git submodule update --init --recursive --depth 1 | |
| cmake -S . -B build \ | |
| -DCMAKE_BUILD_TYPE=Release \ | |
| -DCMAKE_PREFIX_PATH=/opt/static \ | |
| -DBoost_ROOT=/opt/static \ | |
| -DBoost_DIR=/opt/static/lib/cmake/Boost-1.82.0 \ | |
| -DBoost_USE_STATIC_LIBS=ON \ | |
| -DCMAKE_FIND_USE_SYSTEM_PACKAGE_REGISTRY=OFF \ | |
| -DCMAKE_FIND_PACKAGE_PREFER_CONFIG=ON \ | |
| -DCMAKE_EXE_LINKER_FLAGS="-static-libstdc++ -static-libgcc" \ | |
| -DBUILD_DROPBEAR=0 \ | |
| -DENABLE_UNIT_TESTS=0 \ | |
| -DBUILD_SHARED_LIBS=OFF \ | |
| -DCMAKE_INSTALL_PREFIX=$TMP_DIR/podman-hooks | |
| cmake --build build --parallel | |
| cmake --install build | |
| ' | |
| working-directory: ${{ env.TMP_DIR }}/sarus-hooks | |
| - name: Verify hook runtime dependencies | |
| run: | | |
| set -euo pipefail | |
| echo "ldd for ldcache_hook:" | |
| ldd "$TMP_DIR/podman-hooks/bin/ldcache_hook" | tee "$TMP_DIR/ldd_ldcache_hook.txt" | |
| - name: Install Bats locally | |
| run: | | |
| git clone --depth 1 https://github.com/bats-core/bats-core.git "$TMP_DIR/bats-core" | |
| "$TMP_DIR/bats-core/install.sh" "$TMP_DIR/bats" | |
| working-directory: ${{ env.TMP_DIR }} | |
| - name: Export built hooks path and check | |
| run: | | |
| HOOKS_BIN=$TMP_DIR/podman-hooks/bin | |
| echo "HOOKS_BIN=$HOOKS_BIN" >> $GITHUB_ENV | |
| echo "Using hooks from: $HOOKS_BIN" | |
| ls -l "$HOOKS_BIN" | |
| - name: Patch ldcache test to use locally installed hook | |
| run: | | |
| # patch test with hook path | |
| sed -i "s#/opt/sarus/bin/ldcache_hook#${HOOKS_BIN}/ldcache_hook#g" tests/test_ldcache_hook.bats | |
| # Sanity check | |
| grep -n 'ldcache_hook' tests/test_ldcache_hook.bats | |
| working-directory: ${{ env.TMP_DIR }}/sarus-hooks | |
| - name: Run Bats test for ldcache_hook | |
| run: | | |
| $TMP_DIR/bats/bin/bats -t tests/test_ldcache_hook.bats | |
| working-directory: ${{ env.TMP_DIR }}/sarus-hooks | |