Skip to content

implemented compile time lookup table to retrieve attackers for a giv… #25

implemented compile time lookup table to retrieve attackers for a giv…

implemented compile time lookup table to retrieve attackers for a giv… #25

name: Linux Build Test
on:
push:
workflow_dispatch:
permissions:
contents: read
packages: read
jobs:
linux-build:
runs-on: ubuntu-latest
strategy:
matrix:
preset: [ clang_debug, clang_release ]
steps:
- uses: actions/checkout@v4
- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install -y \
build-essential \
clang \
clang-tidy \
gcc \
g++ \
git \
curl \
zip \
unzip \
pkg-config \
ninja-build \
cmake
- name: Setup vcpkg
run: |
git clone https://github.com/microsoft/vcpkg.git /tmp/vcpkg
/tmp/vcpkg/bootstrap-vcpkg.sh
echo "VCPKG_ROOT=/tmp/vcpkg" >> $GITHUB_ENV
echo "/tmp/vcpkg" >> $GITHUB_PATH
- name: Cache VCPKG
uses: actions/cache@v4
with:
path: |
/tmp/vcpkg/downloads
/tmp/vcpkg/installed
~/.cache/vcpkg
key: ${{ runner.os }}-vcpkg-${{ matrix.preset }}-${{ hashFiles('vcpkg.json') }}
restore-keys: ${{ runner.os }}-vcpkg-
- name: Cache build
uses: actions/cache@v4
with:
path: build
key: ${{ runner.os }}-cmake-${{ matrix.preset }}-${{ hashFiles('CMakeLists.txt', '**/*.cmake') }}
restore-keys: ${{ runner.os }}-cmake-
- name: Configure (${{ matrix.preset }})
shell: bash
run: |
set +e
cmake --preset ${{ matrix.preset }} 2>&1 | tee configure_output.txt
CONFIGURE_EXIT_CODE=${PIPESTATUS[0]} # Capture CMake exit code, not tee
set -e
if [ $CONFIGURE_EXIT_CODE -eq 0 ]; then
echo "<details><summary>🟢 Configure Results (click to expand)</summary>" >> $GITHUB_STEP_SUMMARY
else
echo "## 🔴 Configure Results" >> $GITHUB_STEP_SUMMARY
fi
echo '' >> $GITHUB_STEP_SUMMARY
echo '```' >> $GITHUB_STEP_SUMMARY
cat configure_output.txt >> $GITHUB_STEP_SUMMARY
echo '```' >> $GITHUB_STEP_SUMMARY
if [ $CONFIGURE_EXIT_CODE -eq 0 ]; then
echo "</details>" >> $GITHUB_STEP_SUMMARY
fi
exit $CONFIGURE_EXIT_CODE
- name: Build (${{ matrix.preset }})
shell: bash
run: |
set +e
cmake --build --preset ${{ matrix.preset }} 2>&1 | tee build_output.txt
BUILD_EXIT_CODE=${PIPESTATUS[0]} # Capture CMake exit code, not tee
set -e
if [ $BUILD_EXIT_CODE -eq 0 ]; then
echo "<details><summary>🟢 Build Results (click to expand)</summary>" >> $GITHUB_STEP_SUMMARY
else
echo "## 🔴 Build Results" >> $GITHUB_STEP_SUMMARY
fi
echo '' >> $GITHUB_STEP_SUMMARY
echo '```' >> $GITHUB_STEP_SUMMARY
cat build_output.txt >> $GITHUB_STEP_SUMMARY
echo '```' >> $GITHUB_STEP_SUMMARY
if [ $BUILD_EXIT_CODE -eq 0 ]; then
echo "</details>" >> $GITHUB_STEP_SUMMARY
fi
exit $BUILD_EXIT_CODE
- name: Test (${{ matrix.preset }})
shell: bash
run: |
set +e
ctest --preset ${{ matrix.preset }} --output-on-failure 2>&1 | tee test_output.txt
TEST_EXIT_CODE=${PIPESTATUS[0]} # Capture CMake exit code, not tee
set -e
if [ $TEST_EXIT_CODE -eq 0 ]; then
echo "<details><summary>🟢 Test Results (click to expand)</summary>" >> $GITHUB_STEP_SUMMARY
else
echo "## 🔴 Test Results" >> $GITHUB_STEP_SUMMARY
fi
echo '' >> $GITHUB_STEP_SUMMARY
echo '```' >> $GITHUB_STEP_SUMMARY
cat test_output.txt >> $GITHUB_STEP_SUMMARY
echo '```' >> $GITHUB_STEP_SUMMARY
if [ $TEST_EXIT_CODE -eq 0 ]; then
echo "</details>" >> $GITHUB_STEP_SUMMARY
fi
exit $TEST_EXIT_CODE