Code Coverage (Apollo tests) #167
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: Code Coverage (Apollo tests) | |
on: | |
workflow_dispatch: | |
schedule: | |
- cron: "0 20 * * 6" # Every Saturday at 8PM UTC | |
jobs: | |
build: | |
name: Code coverage for Apollo Tests | |
runs-on: ubuntu-18.04 | |
strategy: | |
fail-fast: false | |
steps: | |
- name: Cleanup pre-installed tools | |
run: | | |
# This is a fix for https://github.com/actions/virtual-environments/issues/1918 | |
sudo rm -rf /usr/share/dotnet | |
sudo rm -rf /opt/ghc | |
sudo rm -rf "/usr/local/share/boost" | |
sudo rm -rf "$AGENT_TOOLSDIRECTORY" | |
- name: Checkout repository code | |
uses: actions/checkout@v2 | |
- name: Create artifact directory | |
run: mkdir -p ${{ github.workspace }}/artifact | |
- name: Build and test | |
id: build_test | |
run: | | |
script -q -e -c "make pull" | |
sudo df -h | |
script -q -e -c "CONCORD_BFT_CONTAINER_CC=clang CONCORD_BFT_CONTAINER_CXX=clang++ \ | |
CONCORD_BFT_CMAKE_CODECOVERAGE=TRUE CONCORD_BFT_CMAKE_TRANSPORT=UDP \ | |
make build" && script -q -e -c "make test" | |
continue-on-error: true | |
- name: Generate code coverage report for apollo tests | |
if: always() | |
run: | | |
script -q -e -c "make codecoverage" | |
- name: Check for coveragereport directory | |
if: always() | |
run: | | |
./.github/success_action_if_codecoverage_reports_exist.sh ./build/tests/apollo/coveragereport | |
echo "indexfile_count=$(find build/tests/apollo/coveragereport -name index.html | wc -l)" > $GITHUB_ENV | |
- name: Prepare code coverage artifacts | |
if: ${{ env.indexfile_count > 0 }} | |
run: | | |
sudo chown -R ${USER}:${GROUP} ${PWD}/build | |
tar -czvf ${{ github.workspace }}/artifact/apollo-tests-codecoverage.tar.gz ./build/tests/apollo/coveragereport | |
du -h ${{ github.workspace }}/artifact | |
sudo df -h | |
- name: Upload code coverage artifacts | |
uses: actions/upload-artifact@v2 | |
if: ${{ env.indexfile_count > 0 }} | |
with: | |
name: artifacts-${{ github.sha }} | |
path: ${{ github.workspace }}/artifact/ |