Skip to content

Commit

Permalink
Add verbose test logging by PR label (#1588)
Browse files Browse the repository at this point in the history
* add verbose logging by label

* Update run-tests.sh

* remove extraneous quote and logging

* Adding logging of verbosity

* Update PULL_REQUEST_TEMPLATE.md
  • Loading branch information
aldebaran30701 committed Dec 9, 2021
1 parent 4b15eb1 commit 5438ccd
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 4 deletions.
18 changes: 16 additions & 2 deletions .github/workflows/build-and-scan.yml
Expand Up @@ -28,6 +28,20 @@ jobs:
- name: Checkout Branch
uses: actions/checkout@v1

# Check the label of the PR for verbose logging
- name: Check PR labels action step
id: check_pr_labels
uses: shioyang/check-pr-labels-on-push-action@v1.0.3
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
labels: '["verbose logging"]'

# Set the verbose flag as a variable
- name: Set Verbosity
if: ${{ steps.check_pr_labels.outputs.result }}
run: echo '::set-output name=VERBOSITY::-verbose'
id: verbosity

- name: Create Cache Folder
run: mkdir -p ${HOME}/.ivy2/cache

Expand All @@ -46,8 +60,8 @@ jobs:
run: |
chmod +x /home/runner/work/constellation/constellation/.githubutilities/run-tests.sh
docker pull "${RUNNER_IMAGE}"
docker run --mount "type=bind,source=/home/runner/work/constellation/constellation/,target=/home/runner/work/constellation/constellation/" --mount "type=bind,source=${HOME}/.ivy2/cache,target=/root/.ivy2/cache" --workdir /home/runner/work/constellation/constellation/ "${RUNNER_IMAGE}" .githubutilities/run-tests.sh
docker run --mount "type=bind,source=/home/runner/work/constellation/constellation/,target=/home/runner/work/constellation/constellation/" --mount "type=bind,source=${HOME}/.ivy2/cache,target=/root/.ivy2/cache" --workdir /home/runner/work/constellation/constellation/ "${RUNNER_IMAGE}" .githubutilities/run-tests.sh -v ${{ steps.verbosity.outputs.VERBOSITY }}
- name: Run Sonar
run: |
chmod +x /home/runner/work/constellation/constellation/.githubutilities/sonar.sh
Expand Down
22 changes: 21 additions & 1 deletion .githubutilities/run-tests.sh
@@ -1,8 +1,25 @@
#!/bin/bash
set -euo pipefail

if (( $# != 2 ))
then
echo "Invalid arguments parsed."
exit 1
fi

source .githubutilities/functions.sh

verbosity=""

while getopts ":v:" opt
do
case ${opt} in
v )
verbosity=$OPTARG
;;
esac
done

title "Run Core Build"

ant \
Expand All @@ -14,7 +31,10 @@ ant \

title "Run Core Unit Testing"

ant -verbose \
echo "Running tests with verbosity tag as: ${verbosity}"

ant \
$verbosity \
-Dnbplatform.active.dir="${NETBEANS_HOME}" \
-Dnbplatform.default.netbeans.dest.dir="${NETBEANS_HOME}" \
-Dnbplatform.default.harness.dir="${NETBEANS_HOME}"/harness \
Expand Down
3 changes: 2 additions & 1 deletion PULL_REQUEST_TEMPLATE.md
Expand Up @@ -19,7 +19,8 @@ https://github.com/constellation-app/constellation/blob/master/CODE_OF_CONDUCT.m
- [ ] Reviewed the [checklist](CHECKLIST.md)

- [ ] Reviewed feedback from the "Sonar Cloud" bot. Note that you have to wait
for the "CI / Unit Tests") to complete first.
for the "CI / Unit Tests") to complete first. Failed Unit tests can be
debugged by adding the label "verbose logging" to the GitHub PR.

### Description of the Change

Expand Down

0 comments on commit 5438ccd

Please sign in to comment.