Skip to content

Clang format PR CI fix #620

Clang format PR CI fix

Clang format PR CI fix #620

Workflow file for this run

name: Build
on:
push:
branches: [master]
pull_request:
# Cancel in-progress runs when a new commit is pushed
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
build:
name: ${{ matrix.name }}
runs-on: ${{ matrix.os }}
timeout-minutes: 30
defaults:
run:
shell: ${{ matrix.shell || 'bash' }}
strategy:
fail-fast: false
matrix:
include:
- name: Linux
os: ubuntu-latest
shell: bash
- name: macOS
os: macos-latest
shell: bash
- name: Windows (MinGW)
os: windows-latest
shell: msys2 {0}
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
fetch-depth: 0
# Windows: Setup MSYS2
- name: Setup MSYS2
if: runner.os == 'Windows'
uses: msys2/setup-msys2@4f806de0a5a7294ffabaff804b38a9b435a73bda # v2.30.0
with:
msystem: MINGW64
update: true
install: base-devel mingw-w64-x86_64-gcc mingw-w64-x86_64-cmake mingw-w64-x86_64-ninja mingw-w64-x86_64-hidapi
# Linux/macOS: Setup CMake and Ninja
- name: Setup CMake and Ninja
if: runner.os != 'Windows'
uses: lukka/get-cmake@9e07ecdcee1b12e5037e42f410b67f03e2f626e1 # v4.2.1
# Linux: Install GCC 13 for C++20 support
- name: Install GCC 13 (Ubuntu)
if: runner.os == 'Linux'
run: |
sudo add-apt-repository -y ppa:ubuntu-toolchain-r/test
sudo apt-get update
sudo apt-get install -y gcc-13 g++-13 libhidapi-dev
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-13 100
sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-13 100
# macOS: Install dependencies
- name: Install dependencies (macOS)
if: runner.os == 'macOS'
run: brew install hidapi
# Linux/macOS: Build with CMake Presets
- name: Build and test (Unix)
if: runner.os != 'Windows'
uses: lukka/run-cmake@af1be47fd7c933593f687731bc6fdbee024d3ff4 # v10.8
with:
configurePreset: 'default'
buildPreset: 'default'
testPreset: 'default'
# Windows: Build with MSYS2
- name: Build and test (Windows)
if: runner.os == 'Windows'
run: |
mkdir build
cd build
cmake -G Ninja -DCMAKE_BUILD_TYPE=Release ..
ninja
ctest --output-on-failure
# Upload Windows artifact for testing
- name: Upload Windows artifact
if: runner.os == 'Windows'
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
with:
name: headsetcontrol-windows-mingw
path: build/headsetcontrol.exe
retention-days: 30