-
Notifications
You must be signed in to change notification settings - Fork 18
234 lines (202 loc) · 9.67 KB
/
test.yaml
File metadata and controls
234 lines (202 loc) · 9.67 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
#
# Copyright contributors to the Galasa project
#
# SPDX-License-Identifier: EPL-2.0
#
name: Test SimBank
on:
# This workflow_dispatch is used in the release process.
workflow_dispatch:
# This workflow_call is used after the Main Build of Simplatform.
workflow_call:
schedule:
- cron: "0 6 * * *" # Daily at 06:00
env:
NAMESPACE: ${{ github.repository_owner }}
jobs:
get-galasa-version:
name: Get Galasa Version
# Use the build.properties file in the galasa repo to source the galasa-version output variable.
# This variable can be referenced by other jobs in this flow using ${{ needs.get-galasa-version.outputs.galasa-version }}
runs-on: macos-latest
steps:
- name: Checkout 'galasa' repository
uses: actions/checkout@v4
with:
repository: ${{ env.NAMESPACE }}/galasa
path: ${{ github.workspace }}/galasa
sparse-checkout: |
build.properties
- name: Get Galasa Version from build.properties file
id: get-galasa-version
run: |
cat ${{ github.workspace }}/galasa/build.properties | grep "=" >> $GITHUB_OUTPUT
outputs:
galasa-version: ${{ steps.get-galasa-version.outputs.GALASA_VERSION }}
build-and-run-simbank-tests:
name: Build and Run SimBank Tests
runs-on: macos-latest
needs: [get-galasa-version]
env:
GALASA_HOME: ${{ github.workspace }}/.galasa
steps:
#----------------------------------------------------------------------------------
- name: Checkout the Simplatform repository
uses: actions/checkout@v4
with:
repository: ${{ env.NAMESPACE }}/simplatform
#----------------------------------------------------------------------------------
# Set up pre-requesite technology (Java, Gradle and galasactl)
- name: Setup JDK
uses: actions/setup-java@v4
with:
java-version: '17'
distribution: 'semeru'
- name: Setup Gradle
uses: gradle/actions/setup-gradle@v3
with:
gradle-version: 9.0.0
cache-disabled: true
#----------------------------------------------------------------------------------
# Install galasactl from development download site
- name: Make temp directory
run: |
mkdir ${{ github.workspace }}/temp
- name: Download the galasactl-darwin-arm64 binary
working-directory: ${{ github.workspace }}/temp
run: |
wget https://development.galasa.dev/main/binary/cli/galasactl-darwin-arm64
- name: Make `galasactl` executable
working-directory: ${{ github.workspace }}/temp
run: |
chmod +x galasactl-darwin-arm64
xattr -dr com.apple.quarantine galasactl-darwin-arm64
mv galasactl-darwin-arm64 galasactl
#----------------------------------------------------------------------------------
# Set up Galasa environment
- name: Initialise local Galasa environment to create remaining files and folders
working-directory: ${{ github.workspace }}/temp
run: |
./galasactl local init --log -
#----------------------------------------------------------------------------------
# Download or build the Simplatform application that the tests connect to
# If this workflow was called after a Main build, it will share the github.event_name
# with the calling workflow, which is 'push'. Download the artifacts from that build.
- name: Ensure local Maven repo exists
env:
HOME: /Users/runner
run: mkdir -p ${{ env.HOME }}/.m2/repository
- name: Download SimBank from Main Build
if: ${{ github.event_name == 'push' }}
uses: actions/download-artifact@v4
env:
HOME: /Users/runner
with:
name: simplatform
path: ${{ env.HOME }}/.m2/repository
# If this workflow was called by the daily regression test run or the release, build the code.
- name: Build SimBank using local build script
if: ${{ github.event_name == 'schedule' || github.event_name == 'workflow_dispatch' }}
run: |
./build-locally.sh --skip-docker --skip-secrets
#----------------------------------------------------------------------------------
# Run the Simplatform application
- name: Start the Simplatform application
env:
GALASA_VERSION: ${{ needs.get-galasa-version.outputs.galasa-version }}
run: |
echo "Starting SimBank application..."
java -jar /Users/runner/.m2/repository/dev/galasa/galasa-simplatform/${GALASA_VERSION}/galasa-simplatform-${GALASA_VERSION}.jar &
#----------------------------------------------------------------------------------
# Run the Simbank tests
- name: Run the SimBankIVT
working-directory: ${{ github.workspace }}/temp
env:
GALASA_VERSION: ${{ needs.get-galasa-version.outputs.galasa-version }}
run: |
./galasactl runs submit local \
--obr mvn:dev.galasa/dev.galasa.simbank.obr/${GALASA_VERSION}/obr \
--obr mvn:dev.galasa/dev.galasa.uber.obr/${GALASA_VERSION}/obr \
--class dev.galasa.simbank.tests/dev.galasa.simbank.tests.SimBankIVT \
--remoteMaven https://development.galasa.dev/main/maven-repo/obr \
--reportjson ${{ github.workspace }}/.galasa/test-1.json \
--log -
- name: Run the BasicAccountCreditTest
working-directory: ${{ github.workspace }}/temp
env:
GALASA_VERSION: ${{ needs.get-galasa-version.outputs.galasa-version }}
run: |
./galasactl runs submit local \
--obr mvn:dev.galasa/dev.galasa.simbank.obr/${GALASA_VERSION}/obr \
--obr mvn:dev.galasa/dev.galasa.uber.obr/${GALASA_VERSION}/obr \
--class dev.galasa.simbank.tests/dev.galasa.simbank.tests.BasicAccountCreditTest \
--remoteMaven https://development.galasa.dev/main/maven-repo/obr \
--reportjson ${{ github.workspace }}/.galasa/test-2.json \
--log -
- name: Run the ProvisionedAccountCreditTests
working-directory: ${{ github.workspace }}/temp
env:
GALASA_VERSION: ${{ needs.get-galasa-version.outputs.galasa-version }}
run: |
./galasactl runs submit local \
--obr mvn:dev.galasa/dev.galasa.simbank.obr/${GALASA_VERSION}/obr \
--obr mvn:dev.galasa/dev.galasa.uber.obr/${GALASA_VERSION}/obr \
--class dev.galasa.simbank.tests/dev.galasa.simbank.tests.ProvisionedAccountCreditTests \
--remoteMaven https://development.galasa.dev/main/maven-repo/obr \
--reportjson ${{ github.workspace }}/.galasa/test-3.json \
--log -
- name: Run the BatchAccountsOpenTest
working-directory: ${{ github.workspace }}/temp
env:
GALASA_VERSION: ${{ needs.get-galasa-version.outputs.galasa-version }}
run: |
./galasactl runs submit local \
--obr mvn:dev.galasa/dev.galasa.simbank.obr/${GALASA_VERSION}/obr \
--obr mvn:dev.galasa/dev.galasa.uber.obr/${GALASA_VERSION}/obr \
--class dev.galasa.simbank.tests/dev.galasa.simbank.tests.BatchAccountsOpenTest \
--remoteMaven https://development.galasa.dev/main/maven-repo/obr \
--reportjson ${{ github.workspace }}/.galasa/test-4.json \
--log -
#----------------------------------------------------------------------------------
# Combine test reports and report to Slack channel
# Skip these steps for forks. Only report results if this workflow was
# called from a regression run as Main builds run multiple times a day.
- name: Combine test reports
if: ${{ failure() && github.repository_owner == 'galasa-dev' && github.event_name == 'schedule' }}
run: |
jq -s '{ tests: map(.tests[]) }' ${{ github.workspace }}/.galasa/test-1.json ${{ github.workspace }}/.galasa/test-2.json ${{ github.workspace }}/.galasa/test-3.json ${{ github.workspace }}/.galasa/test-4.json > ${{ github.workspace }}/.galasa/tests.json
# The test report must be sent to Slack in the next job that uses the ubuntu-latest runner.
# We need to run a Docker image to communicate with the Slack webhook and the macos-latest
# runner does not have `docker` installed. Upload the report and download in the next job.
- name: Upload combined test report
if: ${{ failure() && github.repository_owner == 'galasa-dev' && github.event_name == 'schedule' }}
uses: actions/upload-artifact@v4
with:
name: tests.json
path: ${{ github.workspace }}/.galasa/tests.json
report-simbank-test-results:
name: Report Simbank Test results into Slack
runs-on: ubuntu-latest
# Skip this job for forks. Only report results if this workflow was
# called from a regression run as Main builds run multiple times a day.
if: ${{ failure() && github.repository_owner == 'galasa-dev' && github.event_name == 'schedule' }}
needs: [build-and-run-simbank-tests]
steps:
- name: Download Test Report
uses: actions/download-artifact@v4
with:
name: tests.json
path: ${{ github.workspace }}/.galasa
- name: Report results into Slack channel
env:
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }}
run: |
docker run --rm \
--env SLACK_WEBHOOK=${{ env.SLACK_WEBHOOK }} \
-v ${{ github.workspace }}/.galasa:/galasa \
ghcr.io/${{ env.NAMESPACE }}/galasabld-ibm:main \
slackpost tests \
--path /galasa/tests.json \
--name "Simbank" \
--desc "Tests running locally on GitHub Actions" \
--hook ${{ env.SLACK_WEBHOOK }}