CI-windows.yml: also run tests in Windows Server (Core) Docker container #1200
Workflow file for this run
This file contains hidden or 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
| # Some convenient links: | |
| # - https://github.com/actions/virtual-environments/blob/master/images/win/Windows2019-Readme.md | |
| # | |
| name: CI-windows | |
| on: [push,pull_request] | |
| permissions: | |
| contents: read | |
| defaults: | |
| run: | |
| shell: cmd | |
| jobs: | |
| build: | |
| strategy: | |
| matrix: | |
| os: [windows-2025] | |
| config: [Release, Debug] | |
| fail-fast: false | |
| runs-on: ${{ matrix.os }} | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| persist-credentials: false | |
| - name: Setup msbuild.exe | |
| uses: microsoft/setup-msbuild@v2 | |
| - name: Set up Python 3.13 | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: '3.13' | |
| check-latest: true | |
| - name: Install missing Python packages | |
| run: | | |
| python -m pip install pip --upgrade || exit /b !errorlevel! | |
| python -m pip install pytest || exit /b !errorlevel! | |
| - name: Run CMake | |
| run: | | |
| cmake -G "Visual Studio 17 2022" -A x64 -Werror=dev --warn-uninitialized -DCMAKE_COMPILE_WARNING_AS_ERROR=On . || exit /b !errorlevel! | |
| - name: Build | |
| run: | | |
| msbuild -m simplecpp.sln /p:Configuration=${{ matrix.config }} /p:Platform=x64 || exit /b !errorlevel! | |
| - name: Test | |
| run: | | |
| .\${{ matrix.config }}\testrunner.exe || exit /b !errorlevel! | |
| # TODO: does not actually fail on errors | |
| - name: Selfcheck | |
| run: | | |
| .\${{ matrix.config }}\simplecpp.exe simplecpp.cpp -e || exit /b !errorlevel! | |
| - name: integration test | |
| run: | | |
| set SIMPLECPP_EXE_PATH=.\${{ matrix.config }}\simplecpp.exe | |
| python -m pytest integration_test.py -vv || exit /b !errorlevel! | |
| - name: Cache Binaries | |
| if: matrix.os == 'windows-2025' | |
| uses: actions/cache@v4 | |
| with: | |
| path: | | |
| .\${{ matrix.config }}\testrunner.exe | |
| .\${{ matrix.config }}\simplecpp.exe | |
| key: simplecpp-${{ matrix.config }}-${{ github.sha }} | |
| test-core: | |
| needs: build | |
| runs-on: windows-2025 | |
| strategy: | |
| matrix: | |
| image: [ "mcr.microsoft.com/windows/server:ltsc2025", "mcr.microsoft.com/windows/servercore:ltsc2025" ] | |
| config: [Release, Debug] | |
| fail-fast: false | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| persist-credentials: false | |
| - name: Restore Binaries | |
| uses: actions/cache@v4 | |
| with: | |
| path: | | |
| .\${{ matrix.config }}\testrunner.exe | |
| .\${{ matrix.config }}\simplecpp.exe | |
| key: simplecpp-${{ matrix.config }}-${{ github.sha }} | |
| fail-on-cache-miss: true | |
| # TODO: only do this once per image | |
| # TODO: cache this as it takes several minutes for it to complete | |
| - name: Pull Image | |
| run: | | |
| docker image pull ${{ matrix.image }} || exit /b !errorlevel! | |
| docker image ls || exit /b !errorlevel! | |
| # TODO: how to share the following steps | |
| - name: Test | |
| run: | | |
| docker run -v %%GITHUB_WORKSPACE%%\${{ matrix.config }}:C:\${{ matrix.config }} ${{ matrix.image }} C:\${{ matrix.config }}\testrunner.exe || exit /b !errorlevel! | |
| # TODO: does not actually fail on errors | |
| - name: Selfcheck | |
| run: | | |
| docker run -v %%GITHUB_WORKSPACE%%\${{ matrix.config }}:C:\${{ matrix.config }} ${{ matrix.image }} C:\${{ matrix.config }}\simplecpp.exe simplecpp.cpp -e || exit /b !errorlevel! | |
| - name: integration test | |
| run: | | |
| docker run -v %%GITHUB_WORKSPACE%%\${{ matrix.config }}:C:\${{ matrix.config }} ${{ matrix.image }} -e SIMPLECPP_EXE_PATH=C:\${{ matrix.config }}\simplecpp.exe python -m pytest integration_test.py -vv || exit /b !errorlevel! | |