Skip to content

windows-build

windows-build #60

Workflow file for this run

name: windows-build
on:
pull_request:
workflow_dispatch:
jobs:
check-diff:
runs-on: ubuntu-latest
outputs:
handle: ${{ steps.check.outputs.run }}
steps:
- name: Checkout
uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.ref }}
repository: ${{ github.event.pull_request.head.repo.full_name }}
fetch-depth: 2
# The goal is to force this to pass if it does not need to run.
- name: Check the diff
id: check
run: |
echo "Here are the changed build/C files:"
echo "$(git --no-pager diff --name-only HEAD HEAD~1 | grep -E '\.(c|h)$|\.cmake|CMakeLists|Config\.cmake\.in')"
if git --no-pager diff --name-only HEAD HEAD~1 | grep -qE '\.(c|h)$|\.cmake|CMakeLists|Config\.cmake\.in'; then
echo "run=true" >> $GITHUB_OUTPUT
echo "Implementation and/or build files have changed, rebuilding..."
else
echo "run=false" >> $GITHUB_OUTPUT
echo "Implementation and/or build files have NOT changed, skipping build..."
fi
build:
runs-on: windows-latest
needs: check-diff
if: ${{ needs.check-diff.outputs.handle == 'true' }}
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup cl.exe
uses: ilammy/msvc-dev-cmd@v1
- name: Configure with CMake
run: cmake -S . -B build -DCMAKE_INSTALL_PREFIX=install/ -DCMAKE_BUILD_TYPE=Release -G "NMake Makefiles"
- name: Build with nmake
run: |
cmake --build build --config Release --target install
- name: Clean the Install
run: |
Remove-Item -Path install -Recurse
Remove-Item -Path build -Recurse
- name: Build Shared
run: |
cmake -S . -B build -DBUILD_SHARED_LIBS=ON -DCMAKE_INSTALL_PREFIX=install/ -DCMAKE_BUILD_TYPE=Release -G "NMake Makefiles"
cmake --build build --config Release --target install