arithmetic #154
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
name: "Windows" | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
branches: | |
- main | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.head_ref || github.ref }} | |
cancel-in-progress: false | |
jobs: | |
build-and-test: | |
name: x64-windows | |
# https://github.com/actions/virtual-environments/blob/main/images/win/Windows2022-Readme.md | |
runs-on: windows-2022 | |
env: | |
DEBUG_BUILD_DIR: ${{github.workspace}}\out\build\x64-windows\Debug | |
RELEASE_BUILD_DIR: ${{github.workspace}}\out\build\x64-windows\Release | |
INSTALL_DIR: ${{github.workspace}}\out\install | |
defaults: | |
run: | |
shell: cmd | |
steps: | |
- name: Checkout Code | |
uses: actions/checkout@v4 | |
with: | |
submodules: recursive | |
- name: Setup Visual Studio Developer Command Prompt | |
uses: ilammy/msvc-dev-cmd@v1 | |
- name: Get vcpkg commit id | |
working-directory: vcpkg | |
run: git rev-parse HEAD >commit.txt | |
- name: Install vcpkg | |
working-directory: vcpkg | |
run: .\bootstrap-vcpkg.bat | |
- name: Create vcpkg cache | |
working-directory: vcpkg | |
run: mkdir binary-sources | |
- name: Restore vcpkg binary-cache | |
id: restore-vcpkg-cache | |
uses: actions/cache/restore@v4 | |
with: | |
path: vcpkg\binary-sources\**\*.zip | |
key: vcpkg-cache-windows-${{hashFiles('vcpkg.json', 'vcpkg\commit.txt')}} | |
- name: CMake - Configure | |
run: cmake --preset=x64-windows . | |
- name: Save vcpkg binary-cache | |
uses: actions/cache/save@v4 | |
id: save-vcpkg-cache | |
if: always() && steps.restore-vcpkg-cache.outputs.cache-hit != 'true' | |
with: | |
path: vcpkg\binary-sources\**\*.zip | |
key: ${{steps.restore-vcpkg-cache.outputs.cache-primary-key}} | |
- name: CMake - Build (Debug) | |
run: cmake --build --preset=x64-windows-dbg --parallel 1 . | |
- name: CMake - Build (Release) | |
run: cmake --build --preset=x64-windows-rel --parallel 1 . | |
- name: Run tests (Debug) | |
working-directory: ${{env.DEBUG_BUILD_DIR}} | |
run: .\hktests-dbg.exe --gtest_output=xml:hktests-dbg.xml | |
- name: Run tests (Release) | |
working-directory: ${{env.RELEASE_BUILD_DIR}} | |
run: .\hktests-rel.exe --gtest_output=xml:hktests-rel.xml | |
- name: Publish Test Results to github | |
uses: EnricoMi/publish-unit-test-result-action/windows@v2 | |
if: always() && github.event_name == 'push' && github.ref == 'refs/heads/main' | |
with: | |
files: | | |
${{env.DEBUG_BUILD_DIR}}\hktests-dbg.xml | |
${{env.RELEASE_BUILD_DIR}}\hktests-rel.xml | |
- name: Publish Test Results to Codecov | |
if: always() && github.event_name == 'push' && github.ref == 'refs/heads/main' | |
uses: codecov/test-results-action@v1 | |
with: | |
token: ${{secrets.CODECOV_TOKEN}} | |
files: ${{env.DEBUG_BUILD_DIR}}\hktests-dbg.xml | |
- name: Generate CodeCoverage Report | |
if: github.event_name == 'push' && github.ref == 'refs/heads/main' | |
run: | | |
curl -L -O https://github.com/OpenCppCoverage/OpenCppCoverage/releases/download/release-0.9.9.0/OpenCppCoverageSetup-x64-0.9.9.0.exe | |
OpenCppCoverageSetup-x64-0.9.9.0.exe /VERYSILENT /DIR=.\bin\coverage | |
.\bin\coverage\OpenCppCoverage.exe ^ | |
--sources=src ^ | |
--excluded_sources=src\*_tests.cpp ^ | |
--excluded_sources=src\*\*_tests.cpp ^ | |
--excluded_sources=out ^ | |
--export_type=cobertura:hikolang_coverage.xml ^ | |
--working_dir=${{env.DEBUG_BUILD_DIR}} ^ | |
-- ${{env.DEBUG_BUILD_DIR}}\hktests-dbg | |
- name: Upload CodeCoverage Report to codecov | |
if: github.event_name == 'push' && github.ref == 'refs/heads/main' | |
uses: codecov/codecov-action@v5 | |
with: | |
files: ./hikolang_coverage.xml | |
token: ${{secrets.CODECOV_TOKEN}} |