C++ CI Workflow #371
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: C++ CI Workflow | |
on: | |
push: | |
pull_request: | |
schedule: | |
# * is a special character in YAML so you have to quote this string | |
# Execute a "nightly" build at 2 AM UTC | |
- cron: '0 2 * * *' | |
env: | |
manif_TAG: 78cc83d8292736b26a3a4f6d302057a6b80056a4 | |
# Test with different operating systems | |
jobs: | |
build: | |
name: '[${{ matrix.os }}@${{ matrix.build_type }}]' | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
build_type: [Debug, Release] | |
os: [ubuntu-latest, macOS-latest, windows-latest] | |
fail-fast: false | |
# operating system dependences | |
steps: | |
- uses: actions/checkout@master | |
# Print environment variables to simplify development and debugging | |
- name: Environment Variables | |
shell: bash | |
run: env | |
# ============ | |
# DEPENDENCIES | |
# ============ | |
# Remove apt repos that are known to break from time to time | |
# See https://github.com/actions/virtual-environments/issues/323 | |
- name: Remove broken apt repos [Ubuntu] | |
if: matrix.os == 'ubuntu-latest' | |
run: | | |
for apt_file in `grep -lr microsoft /etc/apt/sources.list.d/`; do sudo rm $apt_file; done | |
- name: Dependencies [Windows] | |
if: matrix.os == 'windows-latest' | |
run: | | |
vcpkg install --triplet x64-windows eigen3 | |
- name: Dependencies [macOS] | |
if: matrix.os == 'macOS-latest' | |
run: | | |
brew install eigen | |
- name: Dependencies [Ubuntu] | |
if: matrix.os == 'ubuntu-latest' | |
run: | | |
sudo apt-get update | |
sudo apt-get install git build-essential cmake libeigen3-dev valgrind | |
- name: Cache Source-based Dependencies | |
id: cache-source-deps | |
uses: actions/cache@v1 | |
with: | |
path: ${{ github.workspace }}/install/deps | |
key: source-deps-${{ runner.os }}-manif-${{ env.manif_TAG }} | |
- name: Source-based Dependencies [Windows] | |
if: steps.cache-source-deps.outputs.cache-hit != 'true' && matrix.os == 'windows-latest' | |
shell: bash | |
run: | | |
# manif | |
cd ${GITHUB_WORKSPACE} | |
git clone https://github.com/artivis/manif | |
cd manif | |
git checkout ${manif_TAG} | |
mkdir -p build | |
cd build | |
cmake -A x64 -DCMAKE_TOOLCHAIN_FILE=${VCPKG_INSTALLATION_ROOT}/scripts/buildsystems/vcpkg.cmake \ | |
-DCMAKE_INSTALL_PREFIX=${GITHUB_WORKSPACE}/install/deps .. | |
cmake --build . --config ${{ matrix.build_type }} --target INSTALL | |
- name: Source-based Dependencies [Ubuntu/macOS] | |
if: steps.cache-source-deps.outputs.cache-hit != 'true' && (matrix.os == 'ubuntu-latest' || matrix.os == 'macOS-latest') | |
shell: bash | |
run: | | |
# manif | |
cd ${GITHUB_WORKSPACE} | |
git clone https://github.com/artivis/manif | |
cd manif | |
git checkout ${manif_TAG} | |
mkdir -p build | |
cd build | |
cmake -DCMAKE_INSTALL_PREFIX=${GITHUB_WORKSPACE}/install/deps .. | |
cmake --build . --config ${{ matrix.build_type }} --target install | |
# =================== | |
# CMAKE-BASED PROJECT | |
# =================== | |
- name: Configure [Windows] | |
if: matrix.os == 'windows-latest' | |
shell: bash | |
run: | | |
mkdir -p build | |
cd build | |
cmake -A x64 -DCMAKE_TOOLCHAIN_FILE=${VCPKG_INSTALLATION_ROOT}/scripts/buildsystems/vcpkg.cmake \ | |
-DCMAKE_PREFIX_PATH=${GITHUB_WORKSPACE}/install/deps \ | |
-DCMAKE_BUILD_TYPE=${{ matrix.build_type }} -DCMAKE_INSTALL_PREFIX=${GITHUB_WORKSPACE}/install \ | |
-DBUILD_TESTING:BOOL=ON .. | |
- name: Configure [Ubuntu] | |
if: matrix.os == 'ubuntu-latest' | |
shell: bash | |
run: | | |
mkdir -p build | |
cd build | |
cmake -DCMAKE_PREFIX_PATH=${GITHUB_WORKSPACE}/install/deps \ | |
-DCMAKE_INSTALL_PREFIX=${GITHUB_WORKSPACE}/install \ | |
-DCMAKE_BUILD_TYPE=${{ matrix.build_type }} \ | |
-DBUILD_TESTING:BOOL=ON \ | |
-DLIEGROUPCONTROLLERS_RUN_Valgrind_tests:BOOL=ON .. | |
- name: Configure [macOS] | |
if: matrix.os == 'macOS-latest' | |
shell: bash | |
run: | | |
mkdir -p build | |
cd build | |
cmake -DCMAKE_PREFIX_PATH=${GITHUB_WORKSPACE}/install/deps \ | |
-DCMAKE_INSTALL_PREFIX=${GITHUB_WORKSPACE}/install \ | |
-DCMAKE_BUILD_TYPE=${{ matrix.build_type }} \ | |
-DBUILD_TESTING:BOOL=ON .. | |
- name: Build | |
shell: bash | |
run: | | |
cd build | |
export PATH=$PATH:/d/a/lie-group-controllers/lie-group-controllers/install/bin:/d/a/lie-group-controllers/lie-group-controllers/install/deps/bin | |
cmake --build . --config ${{ matrix.build_type }} | |
- name: Test | |
shell: bash | |
run: | | |
cd build | |
export PATH=$PATH:/d/a/lie-group-controllers/lie-group-controllers/install/bin:/d/a/lie-group-controllers/lie-group-controllers/install/deps/bin | |
ctest --output-on-failure -C ${{ matrix.build_type }} . |