-
Notifications
You must be signed in to change notification settings - Fork 50
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add coverage and use reusable workflow from everest-ci (#858)
* Enable coverage generation * Use reusable workflow * Remove old install_and_test script * Set specific paths for ctest and coverage results * Exclude tests directory from code coverage --------- Signed-off-by: Kai-Uwe Hermann <[email protected]>
- Loading branch information
1 parent
af3d08e
commit 49e0596
Showing
9 changed files
with
112 additions
and
66 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,3 @@ | ||
# syntax=docker/dockerfile:1 | ||
ARG BASE_IMAGE_TAG=latest | ||
FROM ghcr.io/everest/everest-ci/build-kit-base:${BASE_IMAGE_TAG} |
This file was deleted.
Oops, something went wrong.
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,24 @@ | ||
#!/bin/sh | ||
|
||
cmake \ | ||
-B "$EXT_MOUNT/build" \ | ||
-S "$EXT_MOUNT/source" \ | ||
-G Ninja \ | ||
-DBUILD_TESTING=ON \ | ||
-DLIBOCPP16_BUILD_EXAMPLES=ON \ | ||
-DCMAKE_BUILD_TYPE=Debug \ | ||
-DCMAKE_INSTALL_PREFIX="$EXT_MOUNT/dist" \ | ||
-DCMAKE_EXPORT_COMPILE_COMMANDS=ON | ||
|
||
retVal=$? | ||
if [ $retVal -ne 0 ]; then | ||
echo "Configuring failed with return code $retVal" | ||
exit $retVal | ||
fi | ||
|
||
ninja -C "$EXT_MOUNT/build" | ||
retVal=$? | ||
if [ $retVal -ne 0 ]; then | ||
echo "Compiling failed with return code $retVal" | ||
exit $retVal | ||
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
#!/bin/sh | ||
|
||
ninja -C "$EXT_MOUNT/build" install | ||
retVal=$? | ||
|
||
if [ $retVal -ne 0 ]; then | ||
echo "Installation failed with return code $retVal" | ||
exit $retVal | ||
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
#!/bin/sh | ||
|
||
ninja \ | ||
-C "$EXT_MOUNT/build" \ | ||
ocpp_gcovr_coverage | ||
retValHTML=$? | ||
|
||
ninja \ | ||
-C "$EXT_MOUNT/build" \ | ||
ocpp_gcovr_coverage_xml | ||
retValXML=$? | ||
|
||
# Copy the generated coverage report and xml to the mounted directory in any case | ||
cp -R "$EXT_MOUNT/build/ocpp_gcovr_coverage" "$EXT_MOUNT/gcovr-coverage" | ||
cp "$EXT_MOUNT/build/ocpp_gcovr_coverage_xml.xml" "$EXT_MOUNT/gcovr-coverage-xml.xml" | ||
|
||
if [ $retValHTML -ne 0 ]; then | ||
echo "Coverage HTML report failed with return code $retValHTML" | ||
exit $retValHTML | ||
fi | ||
|
||
if [ $retValXML -ne 0 ]; then | ||
echo "Coverage XML report failed with return code $retValXML" | ||
exit $retValXML | ||
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
#!/bin/sh | ||
|
||
ninja -C "$EXT_MOUNT/build" test | ||
retVal=$? | ||
|
||
# Copy the LastTest.log file to the mounted directory in any case | ||
cp "$EXT_MOUNT/build/Testing/Temporary/LastTest.log" "$EXT_MOUNT/ctest-report" | ||
|
||
if [ $retVal -ne 0 ]; then | ||
echo "Unit tests failed with return code $retVal" | ||
exit $retVal | ||
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
name: Build and test libocpp | ||
on: | ||
name: Build, Lint and Test | ||
on: | ||
pull_request: {} | ||
workflow_dispatch: | ||
inputs: | ||
|
@@ -11,47 +11,24 @@ on: | |
options: | ||
- 'ubuntu-22.04' | ||
- 'large-ubuntu-22.04-xxl' | ||
jobs: | ||
lint: | ||
name: Lint | ||
runs-on: ${{ inputs.runner || 'ubuntu-22.04' }} | ||
steps: | ||
- name: Checkout libocpp | ||
uses: actions/checkout@v3 | ||
with: | ||
path: source | ||
- name: Run clang-format | ||
uses: everest/everest-ci/github-actions/[email protected] | ||
with: | ||
source-dir: source | ||
extensions: hpp,cpp | ||
exclude: cache | ||
install_and_test: | ||
name: Install and test | ||
runs-on: ${{ inputs.runner || 'ubuntu-22.04' }} | ||
steps: | ||
- name: Checkout libocpp | ||
uses: actions/checkout@v3 | ||
with: | ||
path: source | ||
- name: Setup run scripts | ||
run: | | ||
mkdir scripts | ||
rsync -a source/.ci/build-kit/ scripts | ||
- name: Pull docker container | ||
run: | | ||
docker pull --platform=linux/x86_64 --quiet ghcr.io/everest/everest-ci/build-kit-base:latest | ||
docker image tag ghcr.io/everest/everest-ci/build-kit-base:latest build-kit | ||
- name: Run install with tests | ||
run: | | ||
docker run \ | ||
--volume "$(pwd):/ext" \ | ||
--name test-container \ | ||
build-kit run-script install_and_test | ||
- name: Archive test results | ||
if: always() | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
name: ctest-report | ||
path: ${{ github.workspace }}/ctest-report | ||
schedule: | ||
- cron: '37 13,1 * * *' | ||
|
||
jobs: | ||
ci: | ||
name: Build, Lint and Test | ||
uses: everest/everest-ci/.github/workflows/[email protected] | ||
permissions: | ||
contents: read | ||
secrets: | ||
coverage_deploy_token: ${{ secrets.SA_GITHUB_PAT }} | ||
with: | ||
runner: ${{ inputs.runner || 'ubuntu-22.04' }} | ||
artifact_deploy_target_repo: EVerest/everest.github.io | ||
run_coverage: true | ||
do_not_run_coverage_badge_creation: false | ||
run_install_wheels: false | ||
run_integration_tests: false | ||
ctest_report_path: ctest-report | ||
coverage_report_path: gcovr-coverage | ||
coverage_xml_path: gcovr-coverage-xml.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
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