Skip to content

Continuous Integration Tests #41

Continuous Integration Tests

Continuous Integration Tests #41

Workflow file for this run

# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
name: Continuous Integration Tests
on:
push:
pull_request:
workflow_dispatch:
schedule:
- cron: "30 15 * * *"
jobs:
preset-test:
permissions:
actions: read
strategy:
fail-fast: false
matrix:
presets:
- preset: "gcc-debug"
compiler: "gcc:14"
- preset: "gcc-release"
compiler: "gcc:14"
- preset: "llvm-debug"
compiler: "clang:19"
- preset: "llvm-release"
compiler: "clang:19"
# - preset: "appleclang-debug"
# platform: "macos-latest"
# - preset: "appleclang-release"
# platform: "macos-latest"
- preset: "msvc-debug"
platform: "windows-latest"
- preset: "msvc-release"
platform: "windows-latest"
name: "Preset: ${{ matrix.presets.preset }} on ${{ matrix.presets.platform || matrix.presets.compiler }}"
runs-on: ${{ matrix.presets.platform || 'ubuntu-latest' }}
container:
image: ${{ matrix.presets.compiler && 'ghcr.io/bemanproject/testingcontainers-' }}${{ matrix.presets.compiler }}
steps:
- uses: actions/checkout@v4
- name: Setup Environment
if: ${{ !matrix.presets.compiler }}
uses: ./.github/actions/setup-environment
- name: Get vcpkg deps
shell: bash
if: ${{ !contains(runner.os, 'Windows') }}
run: |
sudo apt-get install -y pkg-config zip
- name: Restore vcpkg cache
id: vcpkg-cache
uses: TAServers/vcpkg-cache@v3
with:
token: ${{ secrets.GITHUB_TOKEN }}
- name: Run preset
env:
VCPKG_BINARY_SOURCES: "clear;files,${{ steps.vcpkg-cache.outputs.path }},readwrite"
run: cmake --workflow --preset ${{ matrix.presets.preset }}
catch-test:
permissions:
actions: read
strategy:
fail-fast: false
matrix:
platform:
- description: "GNU 14"
compiler: "gcc:14"
toolchain: "cmake/gnu-toolchain.cmake"
- description: "LLVM 19"
compiler: "clang:19"
toolchain: "cmake/llvm-toolchain.cmake"
- description: "Windows MSVC"
os: windows-latest
toolchain: "cmake/msvc-toolchain.cmake"
#- description: "Macos Appleclang"
# os: macos-latest
# toolchain: "cmake/appleclang-toolchain.cmake"
cpp_version: [20, 23, 26]
cmake_args:
- description: "Default"
- description: "TSan"
args: "-DBEMAN_BUILDSYS_SANITIZER=TSan"
- description: "MaxSan"
args: "-DBEMAN_BUILDSYS_SANITIZER=MaxSan"
include:
- platform:
description: "GCC 14"
compiler: "gcc:14"
toolchain: "cmake/gnu-toolchain.cmake"
cpp_version: 20
cmake_args:
description: "Werror"
args: "-DCMAKE_CXX_FLAGS='-Werror=all -Werror=extra'"
- platform:
description: "GCC 14"
compiler: "gcc:14"
toolchain: "cmake/gnu-toolchain.cmake"
cpp_version: 20
cmake_args:
description: "Dynamic"
args: "-DBUILD_SHARED_LIBS=on"
exclude:
# MSVC does not support thread sanitizer
- platform:
description: "Windows MSVC"
cmake_args:
description: "TSan"
name: "Unit:
${{ matrix.platform.description }}
${{ matrix.cpp_version }}
${{ matrix.cmake_args.description }}"
runs-on: ${{ matrix.platform.os || 'ubuntu-latest' }}
container:
image: ${{ matrix.platform.compiler && 'ghcr.io/bemanproject/testingcontainers-' }}${{ matrix.platform.compiler }}
steps:
- uses: actions/checkout@v4
- name: Setup Environment
if: ${{ !matrix.platform.compiler }}
uses: ./.github/actions/setup-environment
- name: Build and Test
uses: ./.github/actions/cmake-build-test
with:
cpp_version: ${{ matrix.cpp_version }}
toolchain_file: ${{ matrix.platform.toolchain }}
cmake_extra_args: ${{ matrix.cmake_args.args }}
configuration-test:
permissions:
actions: read
runs-on: ubuntu-latest
container:
image: ghcr.io/bemanproject/testingcontainers-gcc:14
strategy:
fail-fast: false
matrix:
args:
- name: "Disable build testing"
arg: "-DBEMAN_BOUNDS_TEST_BUILD_TESTS=OFF"
- name: "Disable example building"
arg: "-DBEMAN_BOUNDS_TEST_BUILD_EXAMPLES=OFF"
- name: "Disable config-file package creation"
arg: "-DBEMAN_BOUNDS_TEST_INSTALL_CONFIG_FILE_PACKAGE=OFF"
name: "CMake: ${{ matrix.args.name }}"
steps:
- uses: actions/checkout@v4
- name: Build and Test
uses: ./.github/actions/cmake-build-test
with:
cpp_version: 20
toolchain_file: "cmake/gnu-toolchain.cmake"
cmake_extra_args: ${{ matrix.args.arg }}
disable_test: true
compiler-test:
permissions:
actions: read
strategy:
fail-fast: false
matrix:
compilers:
- class: gcc
version: 14
toolchain: "cmake/gnu-toolchain.cmake"
- class: clang
version: 20
toolchain: "cmake/llvm-toolchain.cmake"
- class: clang
version: 19
toolchain: "cmake/llvm-toolchain.cmake"
- class: clang
version: 18
toolchain: "cmake/llvm-toolchain.cmake"
- class: clang
version: 17
toolchain: "cmake/llvm-toolchain.cmake"
name: "Compiler: ${{ matrix.compilers.class }} ${{ matrix.compilers.version }}"
runs-on: ubuntu-24.04
container:
image: ghcr.io/bemanproject/testingcontainers-${{ matrix.compilers.class }}:${{ matrix.compilers.version }}
steps:
- uses: actions/checkout@v4
- name: Build and Test
uses: ./.github/actions/cmake-build-test
with:
cpp_version: 20
toolchain_file: ${{ matrix.compilers.toolchain }}
create-issue-when-fault:
runs-on: ubuntu-latest
needs: [preset-test, catch-test, configuration-test, compiler-test]
if: failure() && github.event_name == 'schedule'
steps:
# See https://github.com/cli/cli/issues/5075
- uses: actions/checkout@v4
- name: Create issue
run: |
issue_num=$(gh issue list -s open -S "[SCHEDULED-BUILD] Build & Test failure" -L 1 --json number | jq 'if length == 0 then -1 else .[0].number end')
body="**Build-and-Test Failure Report**
- **Time of Failure**: $(date -u '+%B %d, %Y, %H:%M %Z')
- **Commit**: [${{ github.sha }}](${{ github.server_url }}/${{ github.repository }}/commit/${{ github.sha }})
- **Action Run**: [View logs](${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }})
The scheduled build-and-test triggered by cron has failed.
Please investigate the logs and recent changes associated with this commit or rerun the workflow if you believe this is an error."
if [[ $issue_num -eq -1 ]]; then
gh issue create --repo ${{ github.repository }} --title "[SCHEDULED-BUILD] Build & Test failure" --body "$body"
else
gh issue comment --repo ${{ github.repository }} $issue_num --body "$body"
fi
env:
GH_TOKEN: ${{ github.token }}