-
Notifications
You must be signed in to change notification settings - Fork 68
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 GitHub Action job to run MATLAB tests #917
Merged
Merged
Changes from 3 commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,93 @@ | ||
name: MATLAB Tests 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 * * *' | ||
|
||
jobs: | ||
build-matlab-tests: | ||
name: '[matlab:${{ matrix.matlab_version }}:${{ matrix.os }}]' | ||
runs-on: ${{ matrix.os }} | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
build_type: [Release] | ||
os: [ubuntu-20.04] | ||
matlab_version: [R2020a, R2020b, R2021a, latest] | ||
|
||
steps: | ||
- uses: actions/checkout@v2 | ||
|
||
- uses: conda-incubator/setup-miniconda@v2 | ||
with: | ||
miniforge-variant: Mambaforge | ||
miniforge-version: latest | ||
channels: conda-forge,robotology | ||
|
||
- name: Setup MATLAB | ||
uses: matlab-actions/setup-matlab@v1 | ||
with: | ||
release: ${{ matrix.matlab_version }} | ||
|
||
# workaround for https://github.com/robotology/robotology-superbuild/issues/64 | ||
- name: Do not use MATLAB's stdc++ to avoid incompatibilities with other libraries | ||
if: contains(matrix.os, 'ubuntu') | ||
run: | ||
echo 'LD_PRELOAD=/usr/lib/x86_64-linux-gnu/libstdc++.so.6' >> $GITHUB_ENV | ||
|
||
- name: Dependencies | ||
shell: bash -l {0} | ||
run: | | ||
# Workaround for https://github.com/conda-incubator/setup-miniconda/issues/186 | ||
conda config --remove channels defaults | ||
# Compilation related dependencies | ||
mamba install cmake compilers make ninja pkg-config | ||
# Actual dependencies | ||
mamba install eigen libxml2 assimp ipopt qt irrlicht osqp-eigen | ||
|
||
# Additional dependencies useful only on Linux | ||
- name: Dependencies [Conda/Linux] | ||
if: contains(matrix.os, 'ubuntu') | ||
shell: bash -l {0} | ||
run: | | ||
# Additional dependencies only useful on Linux | ||
# See https://github.com/robotology/robotology-superbuild/issues/477 | ||
mamba install expat-cos6-x86_64 freeglut libselinux-cos6-x86_64 libxau-cos6-x86_64 libxcb-cos6-x86_64 libxdamage-cos6-x86_64 libxext-cos6-x86_64 libxfixes-cos6-x86_64 libxxf86vm-cos6-x86_64 mesalib mesa-libgl-cos6-x86_64 | ||
|
||
- name: Configure | ||
if: contains(matrix.os, 'macos') || contains(matrix.os, 'ubuntu') | ||
shell: bash -l {0} | ||
run: | | ||
mkdir build | ||
cd build | ||
cmake -GNinja -DCMAKE_INSTALL_PREFIX=${CONDA_PREFIX} -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} -DMATLAB_FIND_DEBUG:BOOL=ON -DIDYNTREE_USES_MATLAB:BOOL=ON -DIDYNTREE_COMPILE_TESTS:BOOL=ON -DIDYNTREE_USES_QT5:BOOL=ON -DIDYNTREE_USES_ASSIMP:BOOL=ON -DIDYNTREE_USES_IPOPT:BOOL=ON -DIDYNTREE_USES_IRRLICHT:BOOL=ON -DIDYNTREE_USES_YARP:BOOL=OFF -DIDYNTREE_USES_ICUB_MAIN:BOOL=OFF -DIDYNTREE_USES_OSQPEIGEN:BOOL=ON .. | ||
|
||
- name: Build | ||
shell: bash -l {0} | ||
run: | | ||
cd build | ||
cmake --build . --config ${{ matrix.build_type }} | ||
|
||
- name: Inspect libraries linked by iDynTreeMEX.mexa64 [Conda/Linux] | ||
if: contains(matrix.os, 'ubuntu') | ||
shell: bash -l {0} | ||
run: | | ||
cd build | ||
ldd ./lib/iDynTreeMEX.mexa64 | ||
|
||
- name: Test [Conda] | ||
shell: bash -l {0} | ||
run: | | ||
cd build | ||
# Only run matlab tests as the rest of tests are already run by other jobs | ||
ctest --output-on-failure -C ${{ matrix.build_type }} -R "matlab" -VV . | ||
|
||
- name: Install [Conda] | ||
shell: bash -l {0} | ||
run: | | ||
cd build | ||
cmake --install . --config ${{ matrix.build_type }} |
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
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
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
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
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
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
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
name: CI | ||
|
||
# Controls when the action will run. Triggers the workflow on push or pull request | ||
# events but only for the master branch | ||
on: | ||
push: | ||
branches: [ master ] | ||
pull_request: | ||
branches: [ master ] | ||
|
||
# A workflow run is made up of one or more jobs that can run sequentially or in parallel | ||
jobs: | ||
# This workflow contains a single job called "unit-tests" | ||
unit-tests: | ||
# The type of runner that the job will run on | ||
runs-on: ubuntu-latest | ||
|
||
# Steps represent a sequence of tasks that will be executed as part of the job | ||
steps: | ||
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it | ||
- uses: actions/checkout@v2 | ||
|
||
# Use A Github Action to perform tests | ||
- name: run unit tests and documentation tests, generate coverage report | ||
uses: joergbrech/moxunit-action@v1.1 | ||
with: | ||
tests: tests | ||
src: MOxUnit | ||
with_coverage: true | ||
doc_tests: true | ||
cover_xml_file: coverage.xml | ||
|
||
# Store the coverage report as an artifact | ||
- name: Store Coverage report as artifact | ||
uses: actions/upload-artifact@v1 | ||
with: | ||
name: coverage_xml_file | ||
path: coverage.xml | ||
|
||
## Use a Github Action to publish coverage reports | ||
#- name: Publish coverage report to codecov.io | ||
# uses: codecov/codecov-action@v1 | ||
# with: | ||
# file: ./coverage.xml |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
*.DS_Store | ||
*.swp | ||
*.css | ||
*.m~ | ||
data | ||
datadb | ||
datadb.zip | ||
.git.bfg-report | ||
*.md.sw? | ||
octave-workspace | ||
git_log.txt | ||
git_summary.txt | ||
*.pyc | ||
*.asv |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,82 @@ | ||
# vim ft=yaml | ||
# travis-ci.org definition for MOxUnit build (based on CoSMoMVPA, | ||
# which is based on PyMVPA, which is based on nipype configuration, | ||
# which in turn was based on nipy) | ||
|
||
language: minimal | ||
os: linux | ||
|
||
cache: | ||
- apt | ||
|
||
env: | ||
matrix: | ||
- WITH_COVERAGE= | ||
- WITH_COVERAGE=true | ||
- RUN_DOC_TEST=true | ||
|
||
before_install: | ||
# to prevent IPv6 being used for APT | ||
- sudo bash -c "echo 'Acquire::ForceIPv4 \"true\";' > /etc/apt/apt.conf.d/99force-ipv4" | ||
- travis_retry sudo apt-get -y -qq update | ||
- travis_retry sudo apt-get install -y -qq software-properties-common python-software-properties | ||
- travis_retry sudo apt-add-repository -y ppa:octave/stable | ||
- travis_retry sudo apt-get -y -qq update | ||
# get Octave 4,0 | ||
- travis_retry sudo apt-get -y -qq install octave liboctave-dev | ||
# install MOcov | ||
- cd .. | ||
- rm -rf MOcov | ||
- git clone https://github.com/MOcov/MOcov.git | ||
- make -C MOcov install | ||
# retrieve MOdox | ||
- rm -rf MOdox | ||
- travis_retry git clone -v git://github.com/MOdox/MOdox.git | ||
- make -C MOdox install | ||
# go back to original directory | ||
- cd MOxUnit | ||
# prevent shippable from re-using old test results | ||
- if [[ "$SHIPPABLE" == "true" ]]; then | ||
if [[ "$WITH_COVERAGE" != "true" ]]; then | ||
rm -f ${SHIPPABLE_BUILD_DIR}/shippable/testresults/*.xml; | ||
fi; | ||
fi | ||
|
||
script: | ||
- if [[ "$WITH_COVERAGE" == "true" ]]; then | ||
TEST_ARGS=WITH_COVERAGE=true; | ||
COVER_ARGS=COVER=`pwd`/MOxUnit; | ||
|
||
if [[ "$SHIPPABLE" == "true" ]]; then | ||
OUTPUT_ARGS=COVER_XML_FILE=${SHIPPABLE_BUILD_DIR}/shippable/codecoverage/coverage.xml; | ||
AFTER_SCRIPT="find ${SHIPPABLE_BUILD_DIR}/shippable/;cat ${SHIPPABLE_BUILD_DIR}/shippable/codecoverage/coverage.xml;which reports"; | ||
elif [[ "$TRAVIS" == "true" ]]; then | ||
OUTPUT_ARGS=COVER_JSON_FILE=`pwd`/coveralls.json; | ||
AFTER_SCRIPT="curl --verbose -F json_file=@`pwd`/coveralls.json https://coveralls.io/api/v1/jobs"; | ||
fi; | ||
elif [[ "$SHIPPABLE" == "true" ]]; then | ||
RESULT_ARGS=JUNIT_XML_FILE=${SHIPPABLE_BUILD_DIR}/shippable/testresults/test_results.xml; | ||
elif [[ "$RUN_DOC_TEST" == "true" ]]; then | ||
TEST_ARGS=RUN_DOC_TEST=true; | ||
fi; | ||
|
||
- echo Test arguments $TEST_ARGS $COVER_ARGS $OUTPUT_ARGS $RESULT_ARGS | ||
- make test $TEST_ARGS $COVER_ARGS $OUTPUT_ARGS $RESULT_ARGS | ||
- eval $AFTER_SCRIPT | ||
|
||
jobs: | ||
include: | ||
- language: matlab | ||
matlab: R2020a | ||
|
||
# No need to do anything, but the 'before_install' key is inherited from teh enclosing scope and has to be reset to something insubstantial | ||
before_install: | ||
- echo 'noop' | ||
# Could also clear 'env' but, as is, the only environment variable inhereted fromthe scope is $WITH_COVERAGE which does nothing here | ||
|
||
script: | ||
- if [[ "$SHIPPABLE" == "true" ]]; then | ||
echo 'No Matlab testing on Shippable'; | ||
else | ||
matlab -batch 'back=cd("./MOxUnit/"); moxunit_set_path(); cd(back); moxunit_runtests tests -verbose; exit(double(~ans))'; | ||
fi; |
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
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
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
To avoid specifying that each shell is login you can set a default shell.
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.
Done in 695d813 .