generated from EVerest/everest-template
-
Notifications
You must be signed in to change notification settings - Fork 6
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 coverage and use reusable workflow from everest-ci #97
Merged
Merged
Changes from all commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
9a65edf
Add coverage and use reusable workflow from everest-ci
hikinggrass 856f426
Make ci scripts executable
hikinggrass 878e001
Try to use WORKSPACE_PATH as install prefix like in the old install_a…
hikinggrass d085af2
Set install prefix to source/dist
hikinggrass 9be56e8
Explicitly set dist_path
hikinggrass e8a2bd2
ctest: output on failure
hikinggrass df2d95c
Change install prefix to build/dist
hikinggrass 64e4089
Revert install prefix back to default dist
hikinggrass 7934b28
Copy test files during configure instead of installing them
hikinggrass 717f000
Merge remote-tracking branch 'origin/main' into feature/coverage
hikinggrass 40caa0f
Update reusable workflow to 1.4.4
hikinggrass 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,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,23 @@ | ||
#!/bin/sh | ||
|
||
cmake \ | ||
-B "$EXT_MOUNT/build" \ | ||
-S "$EXT_MOUNT/source" \ | ||
-G Ninja \ | ||
-DBUILD_TESTING=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" \ | ||
everest-evse_security_gcovr_coverage | ||
retValHTML=$? | ||
|
||
ninja \ | ||
-C "$EXT_MOUNT/build" \ | ||
everest-evse_security_gcovr_coverage_xml | ||
retValXML=$? | ||
|
||
# Copy the generated coverage report and xml to the mounted directory in any case | ||
cp -R "$EXT_MOUNT/build/everest-evse_security_gcovr_coverage" "$EXT_MOUNT/gcovr-coverage" | ||
cp "$EXT_MOUNT/build/everest-evse_security_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 | ||
|
||
CTEST_OUTPUT_ON_FAILURE=1 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,4 +1,4 @@ | ||
name: Build and test libevse-security | ||
name: Build, Lint and Test | ||
on: | ||
pull_request: {} | ||
workflow_dispatch: | ||
|
@@ -11,47 +11,24 @@ on: | |
options: | ||
- 'ubuntu-22.04' | ||
- 'large-ubuntu-22.04-xxl' | ||
schedule: | ||
- cron: '37 13,1 * * *' | ||
|
||
jobs: | ||
lint: | ||
name: Lint | ||
runs-on: ${{ inputs.runner || 'ubuntu-22.04' }} | ||
steps: | ||
- name: Checkout libevse-security | ||
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 | ||
test: | ||
name: Build and test libevse-security | ||
runs-on: ${{ inputs.runner || 'ubuntu-22.04' }} | ||
steps: | ||
- name: Checkout libevse-security | ||
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/build-kit-alpine:latest | ||
docker image tag ghcr.io/everest/build-kit-alpine:latest build-kit | ||
- name: Unit test and install | ||
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 | ||
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
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.
Installing these files during configure makes the CI reusable workflow happy. Was there a reason why they were installed before? @james-ctc
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.
install was being used in other places so it was done to follow the same pattern.
Not a problem here, but in some tests there were issues that the file(COPY ...) doesn't appear to be part of the dependencies so when there is an update ninja/make doesn't copy the updates. It is possible that was the original reason for using install.
Elsewhere I have added specific targets where checking for updates is important.
moving away from using install is a very good improvement.