| 1 |
name: CMake libfswatch on Windows MinGW |
| 2 |
|
| 3 |
on: |
| 4 |
push: |
| 5 |
branches: [ master ] |
| 6 |
pull_request: |
| 7 |
branches: [ master ] |
| 8 |
|
| 9 |
env: |
| 10 |
# Customize the CMake build type here (Release, Debug, RelWithDebInfo, etc.) |
| 11 |
BUILD_TYPE: Release |
| 12 |
|
| 13 |
jobs: |
| 14 |
build: |
| 15 |
# The CMake configure and build commands are platform agnostic and should work equally |
| 16 |
# well on Windows or Mac. You can convert this to a matrix build if you need |
| 17 |
# cross-platform coverage. |
| 18 |
# See: https://docs.github.com/en/free-pro-team@latest/actions/learn-github-actions/managing-complex-workflows#using-a-build-matrix |
| 19 |
runs-on: windows-latest |
| 20 |
|
| 21 |
steps: |
| 22 |
- uses: actions/checkout@v6 |
| 23 |
|
| 24 |
- name: Install MSYS2 MinGW toolchain |
| 25 |
shell: pwsh |
| 26 |
run: | |
| 27 |
$ErrorActionPreference = 'Stop' |
| 28 |
$msys2 = 'C:\msys64' |
| 29 |
|
| 30 |
if (-not (Test-Path "$msys2\usr\bin\bash.exe")) { |
| 31 |
choco install msys2 --no-progress -y |
| 32 |
} |
| 33 |
|
| 34 |
& "$msys2\usr\bin\bash.exe" -lc 'pacman --noconfirm -Sy --needed mingw-w64-ucrt-x86_64-cmake mingw-w64-ucrt-x86_64-gcc mingw-w64-ucrt-x86_64-ninja' |
| 35 |
|
| 36 |
if ($LASTEXITCODE -ne 0) { |
| 37 |
exit $LASTEXITCODE |
| 38 |
} |
| 39 |
|
| 40 |
"$msys2\ucrt64\bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append |
| 41 |
"$msys2\usr\bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append |
| 42 |
|
| 43 |
- name: Configure CMake |
| 44 |
# Configure CMake in a 'build' subdirectory. `CMAKE_BUILD_TYPE` is only required if you are using a single-configuration generator such as make. |
| 45 |
# See https://cmake.org/cmake/help/latest/variable/CMAKE_BUILD_TYPE.html?highlight=cmake_build_type |
| 46 |
shell: pwsh |
| 47 |
run: | |
| 48 |
cmake ` |
| 49 |
-G Ninja ` |
| 50 |
-B "${{ github.workspace }}/build" ` |
| 51 |
-DCMAKE_BUILD_TYPE=${{ env.BUILD_TYPE }} ` |
| 52 |
-DBUILD_LIBS_ONLY=1 |
| 53 |
|
| 54 |
- name: Build |
| 55 |
# Build your program with the given configuration |
| 56 |
shell: pwsh |
| 57 |
run: | |
| 58 |
cmake ` |
| 59 |
--build "${{ github.workspace }}/build" ` |
| 60 |
--config "${{ env.BUILD_TYPE }}" |
| 61 |
|
| 62 |
- name: Test |
| 63 |
# Execute tests defined by the CMake configuration. |
| 64 |
# See https://cmake.org/cmake/help/latest/manual/ctest.1.html for more detail |
| 65 |
shell: pwsh |
| 66 |
run: | |
| 67 |
ctest ` |
| 68 |
--test-dir "${{ github.workspace }}/build" ` |
| 69 |
-C "${{ env.BUILD_TYPE }}" |