Skip to content

Commit ebe25a0

Browse files
authored
Report results of Simbank tests into Slack channel (#185)
* Update Test Simbank workflow to create JSON reports for the Simbank tests and then combine them to one report, to be sent into the Slack channel Signed-off-by: Jade Carino <carino_jade@yahoo.co.uk> * Don't report results after every test run from a main build or it will crowd the channel Signed-off-by: Jade Carino <carino_jade@yahoo.co.uk> --------- Signed-off-by: Jade Carino <carino_jade@yahoo.co.uk>
1 parent 7794c0d commit ebe25a0

File tree

2 files changed

+34
-17
lines changed

2 files changed

+34
-17
lines changed

.github/workflows/test.yaml

Lines changed: 30 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,7 @@ jobs:
123123
--obr mvn:dev.galasa/dev.galasa.uber.obr/${GALASA_VERSION}/obr \
124124
--class dev.galasa.simbank.tests/dev.galasa.simbank.tests.SimBankIVT \
125125
--remoteMaven https://development.galasa.dev/main/maven-repo/obr \
126+
--reportjson ${{ github.workspace }}/.galasa/temp/test-1.json \
126127
--log -
127128
128129
- name: Run the BasicAccountCreditTest
@@ -134,6 +135,7 @@ jobs:
134135
--obr mvn:dev.galasa/dev.galasa.uber.obr/${GALASA_VERSION}/obr \
135136
--class dev.galasa.simbank.tests/dev.galasa.simbank.tests.BasicAccountCreditTest \
136137
--remoteMaven https://development.galasa.dev/main/maven-repo/obr \
138+
--reportjson ${{ github.workspace }}/.galasa/temp/test-2.json \
137139
--log -
138140
139141
- name: Run the ProvisionedAccountCreditTests
@@ -145,18 +147,33 @@ jobs:
145147
--obr mvn:dev.galasa/dev.galasa.uber.obr/${GALASA_VERSION}/obr \
146148
--class dev.galasa.simbank.tests/dev.galasa.simbank.tests.ProvisionedAccountCreditTests \
147149
--remoteMaven https://development.galasa.dev/main/maven-repo/obr \
150+
--reportjson ${{ github.workspace }}/.galasa/temp/test-3.json \
148151
--log -
149152
150-
# - name: Report results into Slack channel
151-
# env:
152-
# SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }}
153-
# run: |
154-
# docker run --rm \
155-
# --env SLACK_WEBHOOK=${{ env.SLACK_WEBHOOK }} \
156-
# -v ${{ github.workspace }}/galasa:/galasa:rw \
157-
# ghcr.io/${{ env.NAMESPACE }}/galasabld-ibm:main \
158-
# slackpost tests \
159-
# --path /galasa/test.json \
160-
# --name "Simbank" \
161-
# --desc "Tests running locally on GitHub Actions" \
162-
# --hook ${{ env.SLACK_WEBHOOK }}
153+
#----------------------------------------------------------------------------------
154+
# Combine test reports and report to Slack channel
155+
- name: Combine test reports
156+
# Skip this step for forks
157+
# Only report results if this workflow was called from
158+
# a regression run as Main builds run multiple times a day.
159+
if: ${{ github.repository_owner == 'galasa-dev' && github.event_name 'workflow_dispatch' }}
160+
run: |
161+
jq -s '{ tests: map(.tests[]) }' ${{ github.workspace }}/.galasa/temp/test-1.json ${{ github.workspace }}/.galasa/temp/test-2.json ${{ github.workspace }}/.galasa/temp/test-3.json > ${{ github.workspace }}/.galasa/temp/tests.json
162+
163+
- name: Report results into Slack channel
164+
# Skip this step for forks.
165+
# Only report results if this workflow was called from
166+
# a regression run as Main builds run multiple times a day.
167+
if: ${{ github.repository_owner == 'galasa-dev' && github.event_name 'workflow_dispatch' }}
168+
env:
169+
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }}
170+
run: |
171+
docker run --rm \
172+
--env SLACK_WEBHOOK=${{ env.SLACK_WEBHOOK }} \
173+
-v ${{ github.workspace }}/.galasa/temp:/galasa:rw \
174+
ghcr.io/${{ env.NAMESPACE }}/galasabld-ibm:main \
175+
slackpost tests \
176+
--path /galasa/tests.json \
177+
--name "Simbank" \
178+
--desc "Tests running locally on GitHub Actions" \
179+
--hook ${{ env.SLACK_WEBHOOK }}

test-locally.sh

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -183,12 +183,13 @@ source_dir="."
183183
project=$(basename ${BASEDIR})
184184
SIMBANK_VERSION="0.42.0"
185185

186-
h1 "Running Simbank application tests"
187-
188186
checkGalasaCtlAvailable
189187
checkSimBankTestAreBuilt
190188
checkSimBankAppIsBuilt
191189

190+
mkdir -p ${BASEDIR}/temp
191+
cd ${BASEDIR}/temp
192+
192193
# Start the Simbank back-end server application in a background process...
193194
h1 "Running Simbank back-end server application (version ${SIMBANK_VERSION}) ..."
194195

@@ -198,8 +199,7 @@ success "Simbank application started OK."
198199

199200
TEST_OBR_VERSION="0.42.0"
200201

201-
mkdir -p ${BASEDIR}/temp
202-
cd ${BASEDIR}/temp
202+
h1 "Running Simbank tests"
203203

204204
runSimBankIVT
205205
runBasicAccountCreditTest

0 commit comments

Comments
 (0)