-
Notifications
You must be signed in to change notification settings - Fork 9
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add GH Actions #9
Changes from 7 commits
c29f299
ce335f4
171720e
56b7dfa
db3b57e
0874ee3
3573051
c5e43bd
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,139 @@ | ||
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: | ||
# commit from vcpkg's master branch on 2020/10/06 | ||
vcpkg_TAG: 76a7e9248fb3c57350b559966dcaa2d52a5e4458 | ||
Catch2_TAG: v2.11.3 | ||
|
||
jobs: | ||
build: | ||
name: '[${{ matrix.os }}@${{ matrix.build_type }}]' | ||
runs-on: ${{ matrix.os }} | ||
strategy: | ||
matrix: | ||
build_type: [Release, Debug] | ||
os: [ubuntu-latest, windows-latest, macOS-latest] | ||
fail-fast: false | ||
|
||
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 | ||
|
||
|
||
# Restore from cache the previously built ports. If "cache miss" | ||
# then provision vcpkg, install desired ports, finally cache everything for the next run. | ||
- name: Dependencies [Windows] | ||
if: matrix.os == 'windows-latest' | ||
uses: lukka/run-vcpkg@v3 | ||
with: | ||
vcpkgArguments: '--triplet x64-windows matio catch2' | ||
vcpkgGitCommitId: ${{ env.vcpkg_TAG }} | ||
|
||
- name: Dependencies [macOS] | ||
if: matrix.os == 'macOS-latest' | ||
run: | | ||
brew update | ||
brew install libmatio catch2 | ||
|
||
- name: Dependencies [Ubuntu] | ||
if: matrix.os == 'ubuntu-latest' | ||
run: | | ||
sudo apt-get update | ||
sudo apt-get install libmatio-dev valgrind | ||
|
||
- name: Cache Source-based Dependencies | ||
id: cache-source-deps | ||
uses: actions/cache@v1 | ||
with: | ||
path: ${{ github.workspace }}/install/deps | ||
# Including ${{ runner.temp }} is a workaround taken from https://github.com/robotology/whole-body-estimators/pull/62 to fix macos configuration failure on https://github.com/dic-iit/bipedal-locomotion-framework/pull/45 | ||
key: source-deps-${{ runner.os }}-${{runner.temp}}-build-type-${{ matrix.build_type }}-vcpkg-${{ env.vcpkg_TAG }}-catch2-${{ env.Catch2_TAG }} | ||
|
||
|
||
- name: Source-based Dependencies [Ubuntu] | ||
if: steps.cache-source-deps.outputs.cache-hit != 'true' && matrix.os == 'ubuntu-latest' | ||
shell: bash | ||
run: | | ||
# Catch2 | ||
git clone -b ${Catch2_TAG} https://github.com/catchorg/Catch2.git | ||
cd Catch2 | ||
mkdir -p build | ||
cd build | ||
cmake -DCMAKE_PREFIX_PATH=${GITHUB_WORKSPACE}/install/deps \ | ||
-DCMAKE_INSTALL_PREFIX=${GITHUB_WORKSPACE}/install/deps \ | ||
-DBUILD_TESTING=OFF .. | ||
|
||
cmake --build . --config ${{ matrix.build_type }} --target install | ||
|
||
# =================== | ||
# CMAKE-BASED PROJECT | ||
# =================== | ||
|
||
- name: Configure [Windows] | ||
# Use bash also on Windows (otherwise cd, mkdir, ... do not work) | ||
if: matrix.os == 'windows-latest' | ||
shell: bash | ||
run: | | ||
mkdir -p build | ||
cd build | ||
cmake -A x64 -DCMAKE_TOOLCHAIN_FILE=${VCPKG_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 \ | ||
-DBUILD_TESTING:BOOL=ON \ | ||
-DFRAMEWORK_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 \ | ||
-DBUILD_TESTING:BOOL=ON .. | ||
|
||
- name: Build | ||
shell: bash | ||
run: | | ||
cd build | ||
cmake --build . --config ${{ matrix.build_type }} | ||
|
||
- name: Test | ||
shell: bash | ||
run: | | ||
cd build | ||
ctest --output-on-failure -C ${{ matrix.build_type }} . | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -58,6 +58,8 @@ set(CMAKE_POSITION_INDEPENDENT_CODE ON) | |
# extensions off. | ||
set(CMAKE_C_EXTENSIONS OFF) | ||
set(CMAKE_CXX_EXTENSIONS OFF) | ||
set(CMAKE_CXX_STANDARD 14) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why this is required? Please check this issue: robotology/how-to-export-cpp-library#44 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. On |
||
set(CMAKE_CXX_STANDARD_REQUIRED ON) | ||
|
||
list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake) | ||
|
||
|
@@ -121,6 +123,8 @@ target_include_directories(matioCpp PUBLIC "$<BUILD_INTERFACE:${CMAKE_CURRENT_SO | |
|
||
target_link_libraries(matioCpp PUBLIC MATIO::MATIO) | ||
|
||
target_compile_features(matioCpp PUBLIC cxx_constexpr) | ||
|
||
set_target_properties(matioCpp PROPERTIES | ||
OUTPUT_NAME matioCpp | ||
VERSION ${${PROJECT_NAME}_VERSION} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As far as I remember there is a time limit for the GitHub action when the repo is private. Probably we should avoid to periodically run the action every 2AM
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good point, I have removed it in c5e43bd