build(deps): bump actions/cache from 3 to 4 (#3) #542
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: Linux | |
on: [push, pull_request] | |
jobs: | |
build: | |
name: ${{matrix.os}}-GCC-${{matrix.build_type}}-Python-${{matrix.python}} | |
runs-on: ${{matrix.os}} | |
defaults: | |
run: | |
shell: bash | |
strategy: | |
fail-fast: true | |
matrix: | |
build_type: | |
- Release | |
- Debug | |
os: | |
- ubuntu-20.04 | |
- ubuntu-22.04 | |
python: | |
- '3.8' | |
- '3.9' | |
- '3.10' | |
- '3.11' | |
- '3.12' | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Setup Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: ${{matrix.python}} | |
architecture: ${{matrix.arch}} | |
cache: 'pip' | |
cache-dependency-path: | | |
requirements_dev.txt | |
requirements_lint.txt | |
- name: Setup Dependencies | |
env: | |
DEBIAN_FRONTEND: noninteractive | |
run: | | |
sudo apt-get update | |
sudo apt-get install -y \ | |
build-essential \ | |
cmake \ | |
libboost-test-dev \ | |
libfmt-dev \ | |
libopencv-dev \ | |
libtbb-dev \ | |
ninja-build | |
pip install \ | |
-r requirements_dev.txt \ | |
-r requirements_lint.txt \ | |
'gcovr==6.0' | |
- name: Lint | |
run: | | |
autopep8 --exit-code --diff -r . | |
flake8 . | |
isort --check-only --diff . | |
- name: Cache Eigen | |
id: cache-eigen | |
uses: actions/cache@v4 | |
with: | |
path: eigen/ | |
key: ${{runner.os}}-eigen-3.4.0 | |
- name: Download Eigen | |
if: steps.cache-eigen.outputs.cache-hit != 'true' | |
run: | | |
wget 'https://gitlab.com/libeigen/eigen/-/archive/3.4.0/eigen-3.4.0.zip' | |
unzip eigen-3.4.0.zip | |
- name: Setup Eigen | |
if: steps.cache-eigen.outputs.cache-hit != 'true' | |
run: | | |
cmake -S eigen-3.4.0 -B build-eigen \ | |
-DBUILD_TESTING=OFF \ | |
-DCMAKE_BUILD_TYPE=${{matrix.build_type}} \ | |
-DCMAKE_INSTALL_PREFIX=${{github.workspace}}/eigen \ | |
-DEIGEN_BUILD_DOC=OFF \ | |
-G Ninja | |
cmake --build build-eigen --target install | |
- name: Setup Environment | |
run: | | |
echo 'Eigen3_ROOT=${{github.workspace}}/eigen' >> $GITHUB_ENV | |
echo "pybind11_ROOT=$(pybind11-config --cmakedir)" >> $GITHUB_ENV | |
- name: Setup Debug Environment | |
if: ${{matrix.build_type == 'Debug'}} | |
run: | | |
echo 'CXXFLAGS=--coverage' >> $GITHUB_ENV | |
- name: Configure | |
env: | |
CXXFLAGS: -Wall -Wextra -Wpedantic -Wsign-conversion -Wtautological-compare -Wundef -Wfloat-equal -Wno-attributes -Werror -Wl,-ltbb ${{env.CXXFLAGS}} | |
Python_ROOT: ${{env.pythonLocation}} | |
run: | | |
cmake -S . -B build_${{matrix.build_type}} \ | |
-DCMAKE_BUILD_TYPE=${{matrix.build_type}} \ | |
-DCMAKE_MODULE_LINKER_FLAGS_DEBUG=-ltbb \ | |
-DCMAKE_REQUIRE_FIND_PACKAGE_pybind11=ON \ | |
-G Ninja | |
- name: Build | |
run: | | |
cmake --build build_${{matrix.build_type}} \ | |
--config ${{matrix.build_type}} | |
- name: Test | |
run: | | |
ctest --test-dir build_${{matrix.build_type}} \ | |
--config ${{matrix.build_type}} \ | |
-j$(nproc) \ | |
--output-on-failure | |
- name: Generate Coverage | |
if: matrix.build_type == 'Debug' | |
run: | | |
cd build_${{matrix.build_type}} | |
gcovr -r .. . -s --cobertura coverage.xml | |
- name: Upload Coverage to Codecov | |
if: ${{matrix.build_type == 'Debug'}} | |
uses: codecov/codecov-action@v3 | |
with: | |
token: ${{ secrets.CODECOV_TOKEN }} | |
files: build_${{matrix.build_type}}/coverage.xml | |
fail_ci_if_error: true | |
verbose: true |