Untested WIP #4203
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
# Compile project on Windows | |
name: Windows | |
on: | |
# Branch pushes that do not only modify other workflow files | |
push: | |
branches: | |
- '**' | |
paths: | |
- "**" | |
- "!.github/**" | |
- ".github/scripts/install_cuda_windows.ps1" | |
- ".github/workflows/Windows.yml" | |
# Disabled for now. See https://github.com/FLAMEGPU/FLAMEGPU2/pull/644 | |
# pull_request: | |
# Allow manual invocation. | |
workflow_dispatch: | |
defaults: | |
run: | |
shell: bash | |
jobs: | |
build: | |
runs-on: ${{ matrix.cudacxx.os }} | |
strategy: | |
fail-fast: false | |
# Multiplicative build matrix | |
# optional exclude: can be partial, include: must be specific | |
matrix: | |
cudacxx: | |
- cuda: "12.6.0" | |
cuda_arch: "50" | |
hostcxx: "Visual Studio 17 2022" | |
os: windows-2022 | |
- cuda: "12.0.0" | |
cuda_arch: "50" | |
hostcxx: "Visual Studio 16 2019" | |
os: windows-2019 | |
- cuda: "11.8.0" | |
cuda_arch: "35" | |
hostcxx: "Visual Studio 16 2019" | |
os: windows-2019 | |
- cuda: "11.0.3" | |
cuda_arch: "35" | |
hostcxx: "Visual Studio 16 2019" | |
os: windows-2019 | |
python: | |
- "3.12" | |
config: | |
- name: "Release" | |
config: "Release" | |
SEATBELTS: "ON" | |
- name: "Beltsoff" | |
config: "Release" | |
SEATBELTS: "OFF" | |
VISUALISATION: | |
- "ON" | |
- "OFF" | |
exclude: | |
# Exclude VIS=ON for oldest cuda of each major version | |
- cudacxx: | |
cuda: "12.0.0" | |
VISUALISATION: "ON" | |
- cudacxx: | |
cuda: "11.0.3" | |
VISUALISATION: "ON" | |
# Exclude beltsoff builds for all but the most recent cuda | |
- cudacxx: | |
cuda: "12.0.0" | |
config: | |
name: "Beltsoff" | |
- cudacxx: | |
cuda: "11.8.0" | |
config: | |
name: "Beltsoff" | |
- cudacxx: | |
cuda: "11.0.3" | |
config: | |
name: "Beltsoff" | |
# Exclude beltsoff vis builds to keep the matrix lighter. | |
- config: | |
name: "Beltsoff" | |
VISUALISATION: "ON" | |
# Name the job based on matrix/env options | |
name: "build (${{ matrix.cudacxx.cuda }}, ${{matrix.python}}, ${{ matrix.VISUALISATION }}, ${{ matrix.config.name }}, ${{ matrix.cudacxx.os }})" | |
# Define job-wide env constants, and promote matrix elements to env constants for portable steps. | |
env: | |
# Workflow specific constants for building a specific example | |
# Note this assumes the example exists in cpp, rather than cpp_rtc subdirectory | |
# The individual example is only built for some built matrices, to spend less time in CI. | |
INDIVIDUAL_EXAMPLE: ${{ fromJSON('{true:"game_of_life",false:""}')[matrix.config.name == 'Release' && matrix.VISUALISATION == 'OFF'] }} | |
# Compute the wheelhouse name which should be unique within the matrix. This must be unique per build matrix/job combination | |
ARTIFACT_NAME: wheel-windows-${{ matrix.cudacxx.cuda }}-${{matrix.python}}-${{ matrix.VISUALISATION }}-${{ matrix.config.name }}-${{ matrix.cudacxx.os }} | |
# Define constants | |
BUILD_DIR: "build" | |
# Tests are off for regular builds, but if initiated by a workflow dispatch then they are enabled. Horribly json terriarry to achieve | |
FLAMEGPU_BUILD_TESTS: ${{ fromJSON('{true:"ON",false:"OFF"}')[github.event_name == 'workflow_dispatch' && matrix.VISUALISATION == 'OFF'] }} | |
# Conditional based on matrix via awkward almost ternary | |
FLAMEGPU_BUILD_PYTHON: ${{ fromJSON('{true:"ON",false:"OFF"}')[matrix.python != ''] }} | |
# Port matrix options to environment, for more portability. | |
CUDA: ${{ matrix.cudacxx.cuda }} | |
CUDA_ARCH: ${{ matrix.cudacxx.cuda_arch }} | |
HOSTCXX: ${{ matrix.cudacxx.hostcxx }} | |
OS: ${{ matrix.cudacxx.os }} | |
CONFIG: ${{ matrix.config.config }} | |
FLAMEGPU_SEATBELTS: ${{ matrix.config.SEATBELTS }} | |
PYTHON: ${{ matrix.python}} | |
VISUALISATION: ${{ matrix.VISUALISATION }} | |
# Ensure MSVC >= 1940 works with CUDA <= 12.3 | |
CUDAFLAGS: -allow-unsupported-compiler | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Install CUDA (Windows) | |
if: ${{ runner.os == 'Windows' && env.CUDA != '' }} | |
shell: powershell | |
env: | |
cuda: ${{ env.CUDA }} | |
visual_studio: ${{ env.HOSTCXX }} | |
run: .github\scripts\install_cuda_windows.ps1 | |
- name: Select Python | |
if: ${{ env.PYTHON != '' && env.FLAMEGPU_BUILD_PYTHON == 'ON' }} | |
uses: actions/setup-python@v4 | |
with: | |
python-version: ${{ env.PYTHON }} | |
- name: Install python dependencies | |
if: ${{ env.PYTHON != '' && env.FLAMEGPU_BUILD_PYTHON == 'ON' }} | |
run: | | |
python3 -m pip install --upgrade wheel build setuptools | |
- name: Add custom problem matchers for annotations | |
run: echo "::add-matcher::.github/problem-matchers.json" | |
# This pre-emptively patches a bug from ManyLinux where git dir is owned by diff user, blocking buildnumber generation | |
- name: Enable git safe-directory | |
run: git config --global --add safe.directory $GITHUB_WORKSPACE | |
# Must pass -G -A for windows, and -DPython3_ROOT_DIR/-DPYTHON3_EXECUTABLE as a github action workaround | |
- name: Configure cmake | |
run: > | |
cmake . -B "${{ env.BUILD_DIR }}" | |
-G "${{ env.HOSTCXX }}" -A x64 | |
-Werror=dev | |
-DCMAKE_WARN_DEPRECATED="OFF" | |
-DFLAMEGPU_WARNINGS_AS_ERRORS="ON" | |
-DFLAMEGPU_SEATBELTS="${{ env.FLAMEGPU_SEATBELTS }}" | |
-DCMAKE_CUDA_ARCHITECTURES="${{ env.CUDA_ARCH }}" | |
-DFLAMEGPU_BUILD_TESTS="${{ env.FLAMEGPU_BUILD_TESTS }}" | |
-DFLAMEGPU_BUILD_PYTHON="${{ env.FLAMEGPU_BUILD_PYTHON }}" | |
-DPython3_ROOT_DIR="$(dirname $(which python))" | |
-DPython3_EXECUTABLE="$(which python)" | |
-DFLAMEGPU_VISUALISATION="${{ env.VISUALISATION }}" | |
-DFLAMEGPU_ENABLE_NVTX="ON" | |
# Check for bugs when cmake is reconfigured, i.e. fetch content patching | |
- name: Re-configure cmake | |
run: > | |
cmake . -B "${{ env.BUILD_DIR }}" | |
- name: Build static library | |
working-directory: ${{ env.BUILD_DIR }} | |
run: cmake --build . --config ${{ env.CONFIG }} --target flamegpu --verbose -j `nproc` | |
- name: Build python wheel | |
if: ${{ env.FLAMEGPU_BUILD_PYTHON == 'ON' }} | |
working-directory: ${{ env.BUILD_DIR }} | |
run: cmake --build . --config ${{ env.CONFIG }} --target pyflamegpu --verbose -j `nproc` | |
# Upload wheel artifacts to the job on GHA, with a short retention | |
# Use a unique name per job matrix run, to avoid a risk of corruption according to the docs (although it should work with unique filenames) | |
- name: Upload Wheel Artifacts | |
if: ${{env.FLAMEGPU_BUILD_PYTHON == 'ON' }} | |
uses: actions/upload-artifact@v3 | |
with: | |
name: ${{ env.ARTIFACT_NAME }} | |
path: ${{ env.BUILD_DIR }}/lib/${{ env.CONFIG }}/python/dist/*.whl | |
if-no-files-found: error | |
retention-days: 5 | |
- name: Build tests | |
if: ${{ env.FLAMEGPU_BUILD_TESTS == 'ON' }} | |
working-directory: ${{ env.BUILD_DIR }} | |
run: cmake --build . --config ${{ env.CONFIG }} --target tests --verbose -j `nproc` | |
- name: Build all remaining targets | |
working-directory: ${{ env.BUILD_DIR }} | |
run: cmake --build . --config ${{ env.CONFIG }} --target ALL_BUILD --verbose -j `nproc` | |
- name: Configure Individual example | |
if: ${{ env.INDIVIDUAL_EXAMPLE != '' }} | |
working-directory: examples/cpp/${{ env.INDIVIDUAL_EXAMPLE }} | |
run: > | |
cmake . -B "${{ env.BUILD_DIR }}" | |
-G "${{ env.HOSTCXX }}" -A x64 | |
-Werror=dev | |
-DCMAKE_WARN_DEPRECATED="OFF" | |
-DFLAMEGPU_WARNINGS_AS_ERRORS="ON" | |
-DFLAMEGPU_SEATBELTS="${{ env.FLAMEGPU_SEATBELTS }}" | |
-DCMAKE_CUDA_ARCHITECTURES="${{ env.CUDA_ARCH }}" | |
-DFLAMEGPU_VISUALISATION="${{ env.VISUALISATION }}" | |
-DFLAMEGPU_ENABLE_NVTX="ON" | |
- name: Build Individual example | |
if: ${{ env.INDIVIDUAL_EXAMPLE != '' }} | |
working-directory: examples/cpp/${{ env.INDIVIDUAL_EXAMPLE }}/${{ env.BUILD_DIR }} | |
run: cmake --build . --config ${{ env.CONFIG }} --target ${{ env.INDIVIDUAL_EXAMPLE }} --verbose -j `nproc` | |