Skip to content

fix workflow : problem with tests(delete smoke test) #31

fix workflow : problem with tests(delete smoke test)

fix workflow : problem with tests(delete smoke test) #31

Workflow file for this run

name: Test Suite
on:
workflow_dispatch:
push:
branches: [ main, develop ]
pull_request:
branches: [ main, develop ]
env:
CI: true
jobs:
test:
name: Run Tests (${{ matrix.os }}, ${{ matrix.compiler }})
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:
- os: ubuntu-22.04
compiler: gcc
version: 11
- os: ubuntu-22.04
compiler: clang
version: 14
- os: windows-2022
compiler: msvc
version: 2022
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
submodules: recursive
fetch-depth: 0
- name: Setup ccache
uses: actions/cache@v3
with:
path: |
~/.ccache
C:\ccache
key: ccache-test-${{ matrix.os }}-${{ matrix.compiler }}-${{ github.sha }}
restore-keys: |
ccache-test-${{ matrix.os }}-${{ matrix.compiler }}-
ccache-test-${{ matrix.os }}-
- name: Setup dependency cache
uses: actions/cache@v3
with:
path: |
.deps
~/.deps
key: deps-test-${{ matrix.os }}-${{ matrix.compiler }}-${{ hashFiles('**/CMakeLists.txt') }}
restore-keys: |
deps-test-${{ matrix.os }}-${{ matrix.compiler }}-
deps-test-${{ matrix.os }}-
- name: Set up build environment
shell: bash
id: build-env
run: |
echo "build-output-dir=${{ github.workspace }}/build" >> "$GITHUB_OUTPUT"
# ---------------- Linux (Ubuntu) setup ----------------
- name: Install dependencies (Ubuntu)
if: startsWith(matrix.os, 'ubuntu')
run: |
sudo apt-get update
sudo apt-get install -y build-essential cmake ninja-build \
libgl1-mesa-dev libx11-dev libxrandr-dev libxinerama-dev \
libxcursor-dev libxi-dev libasound2-dev libglu1-mesa-dev \
libwayland-dev libxkbcommon-dev libegl1-mesa-dev \
pkg-config ccache
- name: Set up GCC (Ubuntu)
if: matrix.compiler == 'gcc' && startsWith(matrix.os, 'ubuntu')
run: |
echo "CC=gcc-${{ matrix.version }}" >> "$GITHUB_ENV"
echo "CXX=g++-${{ matrix.version }}" >> "$GITHUB_ENV"
- name: Set up Clang (Ubuntu)
if: matrix.compiler == 'clang' && startsWith(matrix.os, 'ubuntu')
run: |
echo "CC=clang-${{ matrix.version }}" >> "$GITHUB_ENV"
echo "CXX=clang++-${{ matrix.version }}" >> "$GITHUB_ENV"
# ---------------- Windows setup ----------------
- name: Set up MSVC (Windows)
if: matrix.os == 'windows-2022'
uses: microsoft/setup-msbuild@v1.1
with:
vs-version: '[17.0,18.0)'
- name: Install dependencies (Windows)
if: matrix.os == 'windows-2022'
run: |
choco install cmake ninja ccache zip --no-progress
- name: Clear CMake cache
shell: bash
run: |
if [ "${{ matrix.os }}" = "windows-2022" ]; then
# Windows commands
rm -rf "${{ steps.build-env.outputs.build-output-dir }}" 2>/dev/null || echo "Build dir not found or already clean"
rm -rf ".deps" 2>/dev/null || echo "Deps dir not found or already clean"
rm -f CMakeCache.txt cmake_install.cmake 2>/dev/null || echo "Cache files not found or already clean"
# Remove any remaining CMakeFiles directories
find . -name "CMakeFiles" -type d -exec rm -rf {} + 2>/dev/null || echo "No CMakeFiles dirs found"
else
# Unix/Linux commands
rm -rf "${{ steps.build-env.outputs.build-output-dir }}"
rm -rf ".deps"
rm -f CMakeCache.txt cmake_install.cmake CMakeFiles/
fi
- name: Create build directory
run: mkdir -p "${{ steps.build-env.outputs.build-output-dir }}"
- name: Configure CMake for testing
shell: bash
run: |
cmake -B "${{ steps.build-env.outputs.build-output-dir }}" \
-DCMAKE_BUILD_TYPE=Debug \
-DCMAKE_C_COMPILER_LAUNCHER=ccache \
-DCMAKE_CXX_COMPILER_LAUNCHER=ccache \
-DBUILD_TESTS=ON \
-DBUILD_BENCHMARKS=ON \
-DENABLE_COVERAGE=OFF \
-DENABLE_WARNINGS=OFF \
-DENABLE_UNITY_BUILD=OFF \
-DENABLE_SANITIZERS=OFF \
-DCMAKE_EXPORT_COMPILE_COMMANDS=ON \
-DENABLE_DEV_TOOLS=OFF \
-DENABLE_DEBUG_INFO=ON \
-S "${{ github.workspace }}"
- name: Build tests and benchmarks
shell: bash
run: |
cmake --build "${{ steps.build-env.outputs.build-output-dir }}" \
--config Debug \
--target ChainedDecos ChainedDecosMapEditor ChainedDecosTests benchmarks \
--parallel $(nproc 2>/dev/null || sysctl -n hw.ncpu 2>/dev/null || echo 8)
- name: Run smoke tests
shell: bash
run: |
echo "🧪 Running smoke tests..."
# Test that executables exist and are runnable
if [ "${{ matrix.os }}" = "windows-2022" ]; then
[ -f "${{ steps.build-env.outputs.build-output-dir }}/bin/Debug/ChainedDecos.exe" ] && echo "✅ Main executable built successfully" || (echo "❌ Main executable not found" && exit 1)
[ -f "${{ steps.build-env.outputs.build-output-dir }}/bin/Debug/ChainedDecosMapEditor.exe" ] && echo "✅ Map editor executable built successfully" || (echo "❌ Map editor executable not found" && exit 1)
else
[ -f "${{ steps.build-env.outputs.build-output-dir }}/bin/ChainedDecos" ] && echo "✅ Main executable built successfully" || (echo "❌ Main executable not found" && exit 1)
[ -f "${{ steps.build-env.outputs.build-output-dir }}/bin/ChainedDecosMapEditor" ] && echo "✅ Map editor executable built successfully" || (echo "❌ Map editor executable not found" && exit 1)
fi
- name: Run static analysis
shell: bash
if: matrix.os == 'ubuntu-22.04' && matrix.compiler == 'gcc'
run: |
echo "🔍 Running static analysis..."
# Count warnings in build output
echo "📊 Build completed successfully"
# Check for potential memory leaks or issues
echo "🔍 Checking for common C++ issues..."
find src -name "*.cpp" -o -name "*.h" | wc -l | xargs echo "Found files to analyze:"
- name: Generate coverage report (Ubuntu GCC only)
if: matrix.os == 'ubuntu-22.04' && matrix.compiler == 'gcc'
shell: bash
run: |
echo "📊 Generating coverage report..."
# Coverage would be generated here if we had tests with coverage instrumentation
echo "ℹ️ Coverage report generation skipped (no tests with coverage)"
- name: Upload test results
uses: actions/upload-artifact@v4
if: always()
with:
name: test-results-${{ matrix.os }}-${{ matrix.compiler }}
path: |
${{ steps.build-env.outputs.build-output-dir }}/Testing/
${{ steps.build-env.outputs.build-output-dir }}/compile_commands.json
retention-days: 7
- name: Upload coverage report (Ubuntu GCC only)
uses: actions/upload-artifact@v4
if: matrix.os == 'ubuntu-22.04' && matrix.compiler == 'gcc' && always()
with:
name: coverage-report-${{ matrix.os }}-${{ matrix.compiler }}
path: |
${{ steps.build-env.outputs.build-output-dir }}/coverage/
retention-days: 30