-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #23 from ethz-asl/feature/coverage
Added code coverage in CI
- Loading branch information
Showing
5 changed files
with
158 additions
and
14 deletions.
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,58 @@ | ||
name: Generate coverage report | ||
on: | ||
pull_request: | ||
branches: | ||
- "master" | ||
push: | ||
branches: | ||
- "master" | ||
|
||
jobs: | ||
build: | ||
runs-on: [self-hosted, linux] | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
rosdistro: ['noetic'] | ||
gcc: ['10'] | ||
cxx: ['17'] | ||
container: ros:${{ matrix.rosdistro }}-ros-base-focal | ||
steps: | ||
- uses: actions/checkout@v3 | ||
name: Checkout lpp | ||
with: | ||
repository: ethz-asl/lpp | ||
token: ${{ secrets.PAT }} | ||
path: catkin_ws/src/lpp | ||
|
||
- name: Install newest git version | ||
run: sudo apt update && sudo apt-get install -y software-properties-common && sudo add-apt-repository -y ppa:git-core/ppa && sudo apt-get update && sudo apt-get install -y git | ||
|
||
- name: Install GCC version ${{ matrix.gcc }} | ||
run: sudo add-apt-repository ppa:ubuntu-toolchain-r/ppa -y && sudo apt update && sudo apt install -y gcc-${{ matrix.gcc }} g++-${{ matrix.gcc }} && sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-${{ matrix.gcc }} 100 --slave /usr/bin/g++ g++ /usr/bin/g++-${{ matrix.gcc }} | ||
|
||
- name: Install catkin tools | ||
run: sudo apt install -y python3-rosdep python3-rosinstall python3-rosinstall-generator python3-wstool build-essential python3-catkin-tools | ||
|
||
- name: Install system dependencies | ||
run: sudo apt install -y libgoogle-glog-dev | ||
|
||
- name: Install gcovr | ||
run: sudo apt install -y gcovr | ||
|
||
- name: Build lpp | ||
run: source /opt/ros/${{ matrix.rosdistro }}/setup.bash && mkdir build && cd build && cmake .. -DCMAKE_BUILD_TYPE="Debug" -DENABLE_COVERAGE=1 && make | ||
working-directory: catkin_ws/src/lpp | ||
shell: bash | ||
|
||
- name: Run unittests | ||
run: source /opt/ros/${{ matrix.rosdistro }}/setup.bash && ./test_default && ./test_glog && ./test_lpp && ./test_lpp_custom && ./test_nolog && ./test_roslog | ||
working-directory: catkin_ws/src/lpp/build/devel/lib/lpp | ||
shell: bash | ||
|
||
- name: Print coverage | ||
run: gcovr | ||
working-directory: catkin_ws/src/lpp | ||
|
||
|
||
|
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,71 @@ | ||
name: Coverage report | ||
on: | ||
push: | ||
branches: | ||
- "master" | ||
|
||
jobs: | ||
deploy: | ||
name: Deploy coverage report | ||
environment: | ||
name: github-pages | ||
url: ${{ steps.deployment.outputs.url }} | ||
runs-on: [self-hosted, linux] | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
rosdistro: ['noetic'] | ||
gcc: ['10'] | ||
cxx: ['17'] | ||
container: ros:${{ matrix.rosdistro }}-ros-base-focal | ||
permissions: | ||
pages: write # to deploy to Pages | ||
id-token: write # to verify the deployment originates from an appropriate source | ||
steps: | ||
- uses: actions/checkout@v3 | ||
name: Checkout lpp | ||
with: | ||
repository: ethz-asl/lpp | ||
token: ${{ secrets.PAT }} | ||
path: catkin_ws/src/lpp | ||
|
||
- name: Install newest git version | ||
run: sudo apt update && sudo apt-get install -y software-properties-common && sudo add-apt-repository -y ppa:git-core/ppa && sudo apt-get update && sudo apt-get install -y git | ||
|
||
- name: Install GCC version ${{ matrix.gcc }} | ||
run: sudo add-apt-repository ppa:ubuntu-toolchain-r/ppa -y && sudo apt update && sudo apt install -y gcc-${{ matrix.gcc }} g++-${{ matrix.gcc }} && sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-${{ matrix.gcc }} 100 --slave /usr/bin/g++ g++ /usr/bin/g++-${{ matrix.gcc }} | ||
|
||
- name: Install catkin tools | ||
run: sudo apt install -y python3-rosdep python3-rosinstall python3-rosinstall-generator python3-wstool build-essential python3-catkin-tools | ||
|
||
- name: Install system dependencies | ||
run: sudo apt install -y libgoogle-glog-dev | ||
|
||
- name: Install gcovr | ||
run: sudo apt install -y gcovr | ||
|
||
- name: Build lpp | ||
run: source /opt/ros/${{ matrix.rosdistro }}/setup.bash && mkdir build && cd build && cmake .. -DCMAKE_BUILD_TYPE="Debug" -DENABLE_COVERAGE=1 && make | ||
working-directory: catkin_ws/src/lpp | ||
shell: bash | ||
|
||
- name: Run unittests | ||
run: source /opt/ros/${{ matrix.rosdistro }}/setup.bash && ./test_default && ./test_glog && ./test_lpp && ./test_lpp_custom && ./test_nolog && ./test_roslog | ||
working-directory: catkin_ws/src/lpp/build/devel/lib/lpp | ||
shell: bash | ||
|
||
- name: Generate coverage report | ||
run: make coverage | ||
working-directory: catkin_ws/src/lpp/build | ||
|
||
- name: Upload artifact | ||
uses: actions/upload-pages-artifact@v3 | ||
with: | ||
path: ./catkin_ws/src/lpp/build/coverage | ||
|
||
- name: Deploy to Github pages | ||
uses: actions/deploy-pages@v4 | ||
id: deployment | ||
|
||
|
||
|
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