Skip to content

Refactored build behavior #113

Refactored build behavior

Refactored build behavior #113

name: Automated CMake Test Workflow
on:
workflow_dispatch: # Enables manual triggering
push:
branches:
- main
pull_request:
branches:
- main
permissions:
contents: read
issues: write
jobs:
build-and-test:
runs-on: ubuntu-latest
steps:
- name: Check out repository
uses: actions/checkout@v4
# 1) Install needed system packages (including ccache, cmake, etc.)
- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install -y \
ccache \
build-essential \
libncurses-dev \
bsdutils \
libboost-dev \
libboost-filesystem-dev \
libboost-thread-dev \
nlohmann-json3-dev \
libcurl4-openssl-dev \
expect \
bc \
software-properties-common \
wget \
apt-transport-https \
gnupg cmake libsfml-dev libasio-dev
########################################################################
# BUILD & TEST with Memory/Address/Undefined Sanitizers
########################################################################
- name: Configure (Memory/Address Sanitizers)
run: |
cmake -B build_msan -S . \
-D COMPILE_WITH_MEMORY_SANITIZERS=True \
-D COMPILE_WITH_THREAD_SANITIZERS=False \
-D CMAKE_BUILD_TYPE=Debug
- name: Build (Memory/Address Sanitizers)
run: |
cmake --build build_msan --parallel 16
- name: Test (Memory/Address Sanitizers)
env:
TERM: xterm-256color
run: |
ctest --test-dir build_msan --extra-verbose -LE "NotTestable"
########################################################################
# OPEN ISSUE IF ANY TEST FAILURE OCCURRED
########################################################################
- name: Open an Issue on Test Failure
# This step runs only if a previous step in the same job has failed
if: ${{ failure() }}
uses: actions/github-script@v6
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
github.rest.issues.create({
owner: context.repo.owner,
repo: context.repo.repo,
title: "Test Failure in Automated CMake Test Workflow",
body: "# One or more tests have failed!"
})