Upgrade actions/cache to from ver. 3 to 4 #3
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: Coverage | |
| on: | |
| push: | |
| branches: [ master ] | |
| paths: | |
| - '**/*.cpp' | |
| - '**/*.hpp' | |
| - 'CMakeLists.txt' | |
| - 'cmake/Coverage.cmake' | |
| - '.github/workflows/coverage.yml' | |
| jobs: | |
| coverage: | |
| name: Coverage Report | |
| runs-on: ubuntu-latest | |
| env: | |
| CMAKE_C_COMPILER_LAUNCHER: ccache | |
| CMAKE_CXX_COMPILER_LAUNCHER: ccache | |
| CCACHE_DIR: ${{ github.workspace }}/.ccache | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| with: { fetch-depth: 0 } | |
| - name: Install CMake and Ninja | |
| uses: lukka/get-cmake@latest | |
| with: | |
| cmakeVersion: ^3.28.0 | |
| ninjaVersion: ^1.11.0 | |
| - name: Install dependencies | |
| run: | | |
| sudo apt-get -qq update | |
| sudo apt install -y gcc g++ ccache gcovr lcov | |
| - name: Cache ccache | |
| uses: actions/cache@v4 | |
| with: | |
| path: $CACHE_DIR | |
| key: ${{ runner.os }}-ccache-${{ github.sha }} | |
| restore-keys: | | |
| ${{ runner.os }}-ccache- | |
| - name: Cache build directory | |
| uses: actions/cache@v4 | |
| with: | |
| path: build/ | |
| key: ${{ runner.os }}-build-${{ github.sha }} | |
| restore-keys: | | |
| ${{ runner.os }}-build- | |
| - name: Configure → Build → Test (Coverage) | |
| run: cmake --workflow --preset coverage-report | |
| - name: Generate coverage XML | |
| run: cmake --build --preset gcc-Coverage --target coverage | |
| - name: Upload coverage to Codecov | |
| uses: codecov/codecov-action@v3 | |
| with: | |
| files: build/gcc-Coverage/coverage.xml | |
| token: ${{ secrets.CODECOV_TOKEN }} | |
| fail_ci_if_error: true |