Skip to content

seperate test.cc into BoxTest and Fuzz #292

seperate test.cc into BoxTest and Fuzz

seperate test.cc into BoxTest and Fuzz #292

Workflow file for this run

name: test
env:
DOWNLOAD_CACHE_VERSION: 8
on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]
jobs:
ubuntu:
permissions:
actions: write
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
- name: Install dependencies
run: |
sudo add-apt-repository ppa:ubuntu-toolchain-r/test
sudo apt update
sudo apt-get install -y tree clang clang-format ccache freeglut3-dev libasound2-dev libcurl4-openssl-dev libfreetype6-dev libjack-jackd2-dev libx11-dev libxcomposite-dev libxcursor-dev libxinerama-dev libxrandr-dev mesa-common-dev ladspa-sdk webkit2gtk-4.0 libgtk-3-dev xvfb libwebkit2gtk-4.1-dev
- name: Check format
run: |
clang-format --dry-run --Werror src/**/*.cc include/**/*.hh
- name: mkdir ~/.ccache
run: mkdir /home/runner/.ccache
- name: Restore cache
uses: actions/cache/restore@v4
id: restore-cache
with:
path: /home/runner/.ccache
key: ${{ runner.os }}-ccache-${{ hashFiles('**/CMakeLists.txt') }}-${{ env.DOWNLOAD_CACHE_VERSION }}
restore-keys: |
${{ runner.os }}-ccache-
- name: Configure CMake
run: >
cmake -B build
-D CMAKE_C_COMPILER_LAUNCHER=ccache
-D CMAKE_CXX_COMPILER_LAUNCHER=ccache
-D CMAKE_BUILD_TYPE=Debug
-S ${{ github.workspace }}
- name: Build
run: cmake --build build --parallel $(nproc)
- name: list
run: |
ls
ls build
tree build
- name: Print ccache stats
run: |
ccache -s
ccache -p
- name: Always save cache
if: always() && steps.restore-cache.outputs.cache-hit != 'true'
uses: actions/cache/save@v4
with:
key: ${{ steps.restore-cache.outputs.cache-primary-key }}
path: /home/runner/.ccache
- name: Run Unit tests
id: unit-test
continue-on-error: true
run: |
set -o pipefail
xvfb-run -a --server-args="-screen 0 1920x1080x24" ./build/UnitTests 2>&1 | tee unit_test_log.txt
- name: Run Fuzz test
id: fuzz-test
continue-on-error: true # Allows next steps to run even if this fails
run: |
set -o pipefail
xvfb-run -a --server-args="-screen 0 1920x1080x24" ./build/Fuzz_artefacts/Debug/Fuzz 2>&1 | tee fuzz_test_log.txt
- name: Upload test log
if: always()
uses: actions/upload-artifact@v4
with:
name: test-logs
path: "*test_log.txt"
- name: Check test result
if: always()
run: |
if [ "${{ steps.unit-test.outcome }}" != "success" ]; then
echo "Unit Tests failed"
exit 1
fi
if [ "${{ steps.fuzz-test.outcome }}" != "success" ]; then
echo "Fuzz Tests failed"
exit 1
fi
mac:
runs-on: macos-latest
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
- name: Install dependencies
run: |
brew install clang-format ccache cmake tree
- name: Check format
run: |
clang-format --dry-run --Werror src/**/*.cc include/**/*.hh
- name: mkdir ~/.ccache
run: mkdir ~/.ccache
- name: Restore cache
uses: actions/cache/restore@v4
id: restore-cache
with:
path: ~/.ccache
key: ${{ runner.os }}-ccache-${{ hashFiles('**/CMakeLists.txt') }}-${{ env.DOWNLOAD_CACHE_VERSION }}
restore-keys: |
${{ runner.os }}-ccache-
- name: Configure CMake
run: >
cmake -B build
-D CMAKE_C_COMPILER_LAUNCHER=ccache
-D CMAKE_CXX_COMPILER_LAUNCHER=ccache
-D CMAKE_BUILD_TYPE=Debug
-S ${{ github.workspace }}
- name: Build
run: cmake --build build --parallel $(sysctl -n hw.ncpu)
- name: Print ccache stats
run: |
ccache -s
ccache -p
- name: Always save cache
if: always() && steps.restore-cache.outputs.cache-hit != 'true'
uses: actions/cache/save@v4
with:
key: ${{ steps.restore-cache.outputs.cache-primary-key }}
path: ~/.ccache