Update c-cpp.yml (add windows build stage) #361
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 MinGW and Tools | |
run: | | |
choco install mingw -y | |
choco install cmake --installargs 'ADD_CMAKE_TO_PATH=System' -y | |
choco install ninja -y | |
choco install cmocka -y | |
- name: Set PATH for MinGW | |
run: setx PATH "%PATH%;C:\Program Files\mingw-w64\mingw64\bin" | |
- name: Verify Installation | |
run: | | |
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 | |
- name: Publish Unit Test Results (Windows) | |
uses: EnricoMi/publish-unit-test-result-action@v2 | |
if: always() | |
with: | |
files: build/*.xml | |
check_name: Unit Test Results (Windows) | |