diff --git a/.github/workflows/windows-builds.yml b/.github/workflows/windows-builds.yml new file mode 100644 index 0000000..7cabc01 --- /dev/null +++ b/.github/workflows/windows-builds.yml @@ -0,0 +1,91 @@ +name: windows-builds + +on: [push, pull_request] + +env: + CMAKE_VERSION: 3.21.1 + NINJA_VERSION: 1.11.1 + CCACHE_VERSION: 4.8 + +jobs: + dev-build: + runs-on: windows-latest + strategy: + matrix: + generator: ['Ninja', 'NMake Makefiles', 'Visual Studio 17 2022'] + build_type: [Debug, Release] + include: + - build_type: Debug + examples: ON + tests: OFF # the template asap has no unit tests + - build_type: Release + examples: ON + tests: OFF # the template asap has no unit tests + + steps: + - name: Setup ninja (only if the generator is 'Ninja') + if: matrix.generator == 'Ninja' + uses: abdes/gha-setup-ninja@master + with: + version: ${{ env.NINJA_VERSION }} + + - name: Setup cmake + uses: jwlawson/actions-setup-cmake@v1 + with: + cmake-version: ${{ env.CMAKE_VERSION }} + + - name: Setup ccache + uses: Chocobo1/setup-ccache-action@v1 + with: + install_ccache: true + update_packager_index: false + prepend_symlinks_to_path: false + windows_compile_environment: msvc # this field is required + + - name: Set MSVC environment + uses: ilammy/msvc-dev-cmd@v1 + + - name: Log environment properties + run: | + echo "Build Type : ${{matrix.build_type}}" + echo "Generator : ${{matrix.generator}}" + if ('${{matrix.generator}}' -eq 'Ninja') { + ninja --version + } + cmake --version + ccache --version + + - uses: actions/checkout@v3 + with: + submodules: recursive + + - name: Configure build + working-directory: ${{runner.workspace}} + run: | + cmake -B build -S asap ` + -D CMAKE_BUILD_TYPE=${{matrix.build_type}} ` + -G "${{ matrix.generator }}" ` + -D USE_CCACHE=ON ` + -D ASAP_BUILD_TESTS=${{matrix.tests}} ` + -D ASAP_BUILD_EXAMPLES=${{matrix.examples}} ` + -D ASAP_BUILD_DOCS=OFF ` + -D CMAKE_INSTALL_PREFIX=install ` + -D CMAKE_VERBOSE_MAKEFILE=ON + dir build + + - name: Build main targets + working-directory: ${{runner.workspace}} + run: | + cmake --build build --config ${{matrix.build_type}} + + - name: Build test targets + working-directory: ${{runner.workspace}} + if: matrix.tests == true + run: | + cmake --build build --config ${{matrix.build_type}} --target build-all-tests + + - name: Run tests with ctest + working-directory: ${{runner.workspace}} + # Hardcode 2 cores we know are there + run: | + ctest --test-dir build -C ${{matrix.build_type}} -j 2 --output-on-failure