Skip to content

Update c-cpp.yml (add windows build stage) #370

Update c-cpp.yml (add windows build stage)

Update c-cpp.yml (add windows build stage) #370

Workflow file for this run

name: C/C++ CI
on:
push:
branches: [ master ]
pull_request:
branches: [ master ]
jobs:
build:
permissions:
checks: write
pull-requests: write
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Checkout submodules
run: git submodule update --init --recursive
- name: apt-get update
run: sudo apt-get update
- name: Install packages
run: sudo apt-get install libcmocka-dev liburing-dev cmake ninja-build
- name: configure
run: |
mkdir build
echo 'add_compile_options(-fsanitize=address)' > build/local.cmake
echo 'add_link_options(-fsanitize=address)' >> build/local.cmake
cmake -B build -G Ninja -DCMAKE_BUILD_TYPE=Debug
- name: make
run: cmake --build build
- name: test
run: cmake --build build --target test
- name: test-log
if: failure()
run: cat build/Testing/Temporary/LastTest.log
- name: Publish Unit Test Results
uses: EnricoMi/publish-unit-test-result-action@v2
if: always()
with:
files: build/*.xml
check_name: Unit Test Results (Linux)
windows-build:
permissions:
checks: write
pull-requests: write
runs-on: windows-latest
steps:
- uses: actions/checkout@v3
- name: Checkout submodules
run: git submodule update --init --recursive
- name: Install Packages using MSYS2
run: |
choco install msys2 -y
- name: Install Additional Packages
run: |
$env:ChocolateyInstall = Convert-Path "$((Get-Command choco).Path)\..\.."
Import-Module "$env:ChocolateyInstall\helpers\chocolateyProfile.psm1"
setx PATH "%PATH%;C:\tools\msys64\mingw64\bin;C:\tools\msys64\usr\bin"
refreshenv
pacman -Syu --noconfirm
pacman -S --noconfirm mingw-w64-x86_64-cmake mingw-w64-x86_64-ninja mingw-w64-x86_64-cmocka
ls -l C:\tools\msys64\mingw64\bin
- name: Verify Installation
run: |
$env:ChocolateyInstall = Convert-Path "$((Get-Command choco).Path)\..\.."
Import-Module "$env:ChocolateyInstall\helpers\chocolateyProfile.psm1"
setx PATH "C:\tools\msys64\mingw64\bin;C:\tools\msys64\usr\bin;%PATH%"
refreshenv
echo %PATH%
gcc --version
cmake --version
ninja --version
- name: Configure with CMake and Build with Ninja
run: |
mkdir build
cd build
cmake .. -G "Ninja" -DCMAKE_BUILD_TYPE=Debug
ninja
- name: Run Tests
run: |
cd build
ctest -C Debug