CI: Switch to actions/setup-python@v5
#75
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: Build, test and deploy | |
on: | |
push: | |
branches: | |
- master | |
- ci | |
pull_request: | |
branches: | |
- master | |
jobs: | |
build-test-deploy: | |
strategy: | |
matrix: | |
include: | |
- {os: "ubuntu-20.04", cc: "gcc", cxx: "g++-10"} | |
- {os: "ubuntu-20.04", cc: "clang", cxx: "clang++"} | |
- {os: "macos-12", cc: "gcc", cxx: "g++-11"} | |
- {os: "macos-12", cc: "clang", cxx: "clang++"} | |
runs-on: ${{ matrix.os }} | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Install Eigen 3 | |
run: | | |
if [[ "${{ matrix.os }}" == ubuntu-* ]]; then | |
sudo apt-get update -q | |
sudo apt-get install libeigen3-dev | |
else | |
brew update | |
brew install eigen | |
fi | |
- name: Set up Python 3.8 | |
if: startsWith(matrix.cxx, 'clang') | |
uses: actions/setup-python@v5 | |
with: | |
python-version: 3.8 | |
- name: Install cppcheck | |
if: startsWith(matrix.os, 'ubuntu') | |
run: sudo apt-get install cppcheck | |
- name: Install Sphinx and Read the Docs Sphinx Theme | |
if: startsWith(matrix.cxx, 'clang') | |
run: | | |
python -m pip install --upgrade pip | |
pip install sphinx sphinx-rtd-theme myst-parser | |
- name: Build libcommute | |
run: | | |
mkdir installed | |
mkdir build && cd build | |
if [[ "${{ matrix.os }}" == ubuntu* ]]; then | |
STATIC_ANALYSIS=ON | |
else | |
STATIC_ANALYSIS=OFF | |
fi | |
if [[ "${{ matrix.cxx }}" == clang* ]]; then | |
DOCS=ON | |
else | |
DOCS=OFF | |
fi | |
CXX="${{ matrix.cxx }}" cmake .. \ | |
-DCMAKE_BUILD_TYPE=Debug \ | |
-DCMAKE_INSTALL_PREFIX=${GITHUB_WORKSPACE}/installed \ | |
-DCMAKE_CXX_FLAGS="-march=native" \ | |
-DSTATIC_ANALYSIS=${STATIC_ANALYSIS} \ | |
-DTESTS=ON \ | |
-DEXAMPLES=ON \ | |
-DDOCUMENTATION=${DOCS} | |
make -j3 VERBOSE=1 | |
- name: Test libcommute | |
run: | | |
cd ${GITHUB_WORKSPACE}/build | |
CTEST_OUTPUT_ON_FAILURE=1 make test | |
- name: Install libcommute | |
run: | | |
cd ${GITHUB_WORKSPACE}/build | |
make install | |
- name: Deploy documentation | |
if: | | |
github.ref == 'refs/heads/master' && | |
startsWith(matrix.os, 'ubuntu') && | |
startsWith(matrix.cxx, 'clang') | |
uses: JamesIves/github-pages-deploy-action@v4 | |
with: | |
branch: gh-pages | |
token: ${{ secrets.GITHUB_TOKEN }} | |
folder: installed/share/doc/libcommute | |