-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Initial middleware code coverage workflow
- Added python coverage package - Added coverage report generation script - Added coverage workflow that publishes an artifact with the coverage report (this is to be improved)
- Loading branch information
1 parent
c382bb2
commit 9abddac
Showing
4 changed files
with
117 additions
and
0 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,25 @@ | ||
name: "Middleware coverage" | ||
|
||
on: | ||
push: | ||
workflow_dispatch: | ||
|
||
jobs: | ||
coverage: | ||
name: Run tests and generate coverage report | ||
|
||
steps: | ||
- name: Checkout this repo | ||
uses: actions/checkout@v3 | ||
|
||
- name: Build the middleware docker image | ||
run: docker/mware/build | ||
|
||
- name: Run coverage script | ||
run: middleware/test-all-coverage | ||
|
||
- name: "Upload coverage report" | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
name: coverage_report | ||
path: middleware/coverage |
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 |
---|---|---|
|
@@ -11,3 +11,5 @@ build/build/ | |
|
||
pin.txt | ||
changePIN | ||
|
||
coverage |
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,29 @@ | ||
#! /usr/bin/env bash | ||
|
||
# | ||
# Run python coverage tool and generate reports | ||
# | ||
|
||
if [[ $1 == "exec" ]]; then | ||
pushd $(dirname $0) > /dev/null | ||
|
||
rm -rf coverage | ||
coverage erase | ||
coverage run -m unittest discover | ||
coverage html -d coverage | ||
coverage report --format=total > coverage/total | ||
echo "Wrote total to coverage/total" | ||
coverage erase | ||
|
||
popd > /dev/null | ||
else | ||
# Script directory | ||
pushd $(dirname $0) > /dev/null | ||
MIDDLEWARE_ROOT=$(pwd) | ||
popd > /dev/null | ||
|
||
SCRIPT=$(basename $0) | ||
|
||
$MIDDLEWARE_ROOT/../docker/mware/do-notty-nousb /hsm2/middleware "./$SCRIPT exec" | ||
fi | ||
|