Skip to content

Commit 0a06845

Browse files
authored
Merge pull request #54 from dvsa/feat/testWorkflows
Feat/test workflows
2 parents e6caebb + 467b226 commit 0a06845

File tree

1 file changed

+39
-56
lines changed

1 file changed

+39
-56
lines changed

.github/workflows/performance-test.yml

Lines changed: 39 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ jobs:
9999
uses: aws-actions/configure-aws-credentials@v4
100100
with:
101101
role-to-assume: ${{ env.ROLE_ARN }}
102-
aws-region: ${{ vars.DVSA_AWS_REGION }}
102+
aws-region: ${{ vars.TF_AWS_REGION }}
103103
role-duration-seconds: 8400
104104

105105
- name: Cache local Maven repository
@@ -113,58 +113,41 @@ jobs:
113113
- name: Submit AWS Batch Job
114114
id: submit-job
115115
run: |
116+
CONTAINER_OVERRIDES=$(jq -n \
117+
--arg cmd "/usr/local/bin/test-runner.sh" \
118+
--arg platform_env "${{ inputs.platform_env }}" \
119+
--arg simulation_class "${{ inputs.simulation_class }}" \
120+
--arg users "${{ inputs.users }}" \
121+
--arg duration "${{ inputs.duration }}" \
122+
--arg ramp_time "${{ inputs.ramp_time }}" \
123+
--arg build_id "${{ env.JOB_NAME }}" \
124+
--arg maven_options "${{ inputs.maven_options }}" \
125+
--arg bucket "${{ env.BUCKET_NAME }}" \
126+
--arg bucket_path "${{ env.BUCKET_KEY }}" \
127+
--arg build_number "${{ github.run_number }}" \
128+
'{
129+
command: [$cmd],
130+
environment: [
131+
{name: "PLATFORM_ENV", value: $platform_env},
132+
{name: "SIMULATION_CLASS", value: $simulation_class},
133+
{name: "USERS", value: $users},
134+
{name: "DURATION", value: $duration},
135+
{name: "RAMP_TIME", value: $ramp_time},
136+
{name: "BUILD_ID", value: $build_id},
137+
{name: "MAVEN_OPTIONS", value: $maven_options},
138+
{name: "RESULTS_TARGET_BUCKET", value: $bucket},
139+
{name: "RESULTS_TARGET_BUCKET_PATH", value: $bucket_path},
140+
{name: "RESULTS_BUILD_NUMBER", value: $build_number}
141+
]
142+
}')
143+
116144
JOB_ID=$(aws batch submit-job \
117145
--job-name ${{ env.JOB_NAME }} \
118146
--job-queue ${{ env.BATCH_JOB_QUEUE }} \
119147
--job-definition ${{ env.BATCH_JOB_DEFINITION }} \
120148
--timeout "attemptDurationSeconds=$(( ${{ inputs.batch_timeout_minutes }} * 60 ))" \
121-
--container-overrides '{
122-
"command": [
123-
"/usr/local/bin/test-runner.sh"
124-
],
125-
"environment": [
126-
{
127-
"name": "PLATFORM_ENV",
128-
"value": "${{ inputs.platform_env }}"
129-
},
130-
{
131-
"name": "SIMULATION_CLASS",
132-
"value": "${{ inputs.simulation_class }}"
133-
},
134-
{
135-
"name": "USERS",
136-
"value": "${{ inputs.users }}"
137-
},
138-
{
139-
"name": "DURATION",
140-
"value": "${{ inputs.duration }}"
141-
},
142-
{
143-
"name": "RAMP_TIME",
144-
"value": "${{ inputs.ramp_time }}"
145-
},
146-
{
147-
"name": "BUILD_ID",
148-
"value": "${{ env.JOB_NAME }}"
149-
},
150-
{
151-
"name": "MAVEN_OPTIONS",
152-
"value": "${{ inputs.maven_options }}"
153-
},
154-
{
155-
"name": "RESULTS_TARGET_BUCKET",
156-
"value": "${{ env.BUCKET_NAME }}"
157-
},
158-
{
159-
"name": "RESULTS_TARGET_BUCKET_PATH",
160-
"value": "${{ env.BUCKET_KEY }}"
161-
},
162-
{
163-
"name": "RESULTS_BUILD_NUMBER",
164-
"value": "${{ github.run_number }}"
165-
}
166-
]
167-
}')
149+
--container-overrides "$CONTAINER_OVERRIDES")
150+
168151
jobId=$(echo $JOB_ID | jq -r '.jobId')
169152
echo "job_id=$jobId" >> $GITHUB_OUTPUT
170153
@@ -206,7 +189,7 @@ jobs:
206189
207190
upload-results:
208191
name: Upload Results to GitHub
209-
needs: [ run-batch, create-job-name ]
192+
needs: [run-batch, create-job-name]
210193
runs-on: ubuntu-latest
211194
env:
212195
FOLDER_NAME: ${{ needs.create-job-name.outputs.job_name }}
@@ -218,7 +201,7 @@ jobs:
218201
uses: aws-actions/configure-aws-credentials@v4
219202
with:
220203
role-to-assume: ${{ env.ROLE_ARN }}
221-
aws-region: ${{ vars.DVSA_AWS_REGION }}
204+
aws-region: ${{ vars.TF_AWS_REGION }}
222205
role-duration-seconds: 8400
223206

224207
- name: Download Gatling Results from S3
@@ -233,9 +216,9 @@ jobs:
233216
234217
- name: Unzip Gatling Results
235218
run: |
236-
mkdir -p ./upload/${{env.FOLDER_NAME }}/gatling-results
237-
unzip ./upload/${{env.FOLDER_NAME }}/${{ env.RESULTS_NAME }} -d ./upload/${{env.FOLDER_NAME }}/gatling-results
238-
ls -R ./upload/${{env.FOLDER_NAME }}/gatling-results
219+
mkdir -p ./upload/${{ env.FOLDER_NAME }}/gatling-results
220+
unzip ./upload/${{ env.FOLDER_NAME }}/${{ env.RESULTS_NAME }} -d ./upload/${{ env.FOLDER_NAME }}/gatling-results
221+
ls -R ./upload/${{ env.FOLDER_NAME }}/gatling-results
239222
240223
- name: Store Gatling Results
241224
uses: actions/upload-artifact@v4
@@ -245,7 +228,7 @@ jobs:
245228

246229
report:
247230
name: Display Performance Report
248-
needs: [ upload-results, create-job-name ]
231+
needs: [upload-results, create-job-name]
249232
env:
250233
REPORT_KEY: ${{ needs.create-job-name.outputs.job_name }}
251234
runs-on: ubuntu-latest
@@ -261,7 +244,7 @@ jobs:
261244

262245
- name: Console Output Report
263246
run: |
264-
echo "Gatling performance report is available at s3://${{ env.BUCKET_NAME }}/${{ env.BUCKET_KEY }}/${{env.REPORT_KEY}}/gatling-results/index.html"
247+
echo "Gatling performance report is available at s3://${{ env.BUCKET_NAME }}/${{ env.BUCKET_KEY }}/${{ env.REPORT_KEY }}/gatling-results/index.html"
265248
266249
- name: Performance Summary
267250
run: |
@@ -273,7 +256,7 @@ jobs:
273256
274257
job-succeeded:
275258
name: Job Succeeded
276-
needs: [ report ]
259+
needs: [report]
277260
runs-on: ubuntu-latest
278261
steps:
279262
- name: Job Succeeded

0 commit comments

Comments
 (0)