use cpm as cache #62
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
name: ci | |
on: | |
pull_request: | |
release: | |
types: [published] | |
push: | |
tags: | |
branches: | |
- main | |
- master | |
env: | |
CPM_SOURCE_CACHE: ${{ github.workspace }}/cpm_modules | |
CCACHE_BASEDIR: ${GITHUB_WORKSPACE} | |
CCACHE_DIR: ${GITHUB_WORKSPACE}/.ccache | |
CCACHE_COMPRESS: true | |
CCACHE_COMPRESSLEVEL: 6 | |
CCACHE_MAXSIZE: 400M | |
jobs: | |
Test: | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
os: | |
- ubuntu-latest | |
#- macos-latest | |
#- windows-2022 | |
compiler: | |
# you can specify the version after `-` like "llvm-15.0.2". | |
- llvm-17 | |
- gcc-13 | |
build_type: | |
- Release | |
include: | |
# Windows msvc builds | |
- os: windows-latest | |
compiler: msvc | |
build_type: Release | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Cache | |
uses: actions/cache@v3 | |
with: | |
path: | | |
"cpm_modules/**" | |
".cache/ | |
${{ matrix.os == 'windows-latest' && 'C:/Users/runneradmin/AppData/Local/Temp/OpenCV' || '' }} | |
key: ${{ runner.os }}-${{ matrix.compiler }}-${{ hashFiles('**/CMakeLists.txt') }} | |
restore-keys: | | |
${{ runner.os }}-${{ matrix.compiler }} | |
- name: Install dependencies (linux) | |
run: sudo apt update && sudo apt install ninja-build libopencv-dev libpoco-dev | |
if: matrix.os == 'ubuntu-latest' | |
- name: Install dependencies (windows) | |
run: | | |
choco install opencv --version 4.10.0 -y --package-parameters '/InstallationPath:C:\opencv /Environment' | |
echo "C:\opencv\opencv\build\x64\vc16\bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append | |
if: matrix.os == 'windows-latest' | |
- name: Setup Cpp | |
uses: aminya/setup-cpp@v1 | |
with: | |
compiler: ${{ matrix.compiler }} | |
vcvarsall: ${{ contains(matrix.os, 'windows' )}} | |
ninja: true | |
ccache: true | |
- name: Configure CMake | |
run: cmake -S . -B ./build -G "Ninja Multi-Config" | |
-DCMAKE_BUILD_TYPE:STRING=${{matrix.build_type}} | |
-DCMAKE_C_COMPILER_LAUNCHER=ccache | |
-DCMAKE_CXX_COMPILER_LAUNCHER=ccache | |
${{ matrix.os == 'windows-latest' && '-DOpenCV_DIR="C:/opencv/opencv/build/"' || '' }} | |
- name: Build | |
# Execute the build. You can specify a specific target with "--target <NAME>" | |
run: | | |
cmake --build ./build --config ${{matrix.build_type}} | |
- name: Test | |
working-directory: ${{github.workspace}}/build | |
run: ctest -C ${{matrix.build_type}} --output-on-failure | |
- name: Ccache stats | |
run: | | |
ccache -p | |
ccache -s |