-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ARN-2494 Switch to GitHub Actions (#656)
* ARN-2494 Switch to GitHub Actions * ARN-2494 Copy local SNS setup from UI repo * ARN-2494 Copy wiremock setup from UI repo * ARN-2494 Revert stubs
- Loading branch information
Showing
19 changed files
with
433 additions
and
286 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
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,6 @@ | ||
# This is a comment. | ||
# Each line is a file pattern followed by one or more owners. | ||
|
||
# These owners will be the default owners for everything in | ||
# the repo. Unless a later match takes precedence, | ||
* @ministryofjustice/hmpps-assessments |
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: Deploy to environment | ||
|
||
on: | ||
workflow_dispatch: | ||
inputs: | ||
environment: | ||
description: Environment | ||
type: choice | ||
required: true | ||
options: | ||
- dev | ||
default: 'dev' | ||
image_tag: | ||
description: Optional image tag to deploy. If left blank, a new image will be built, pushed and deployed | ||
required: false | ||
default: '' | ||
type: string | ||
|
||
jobs: | ||
deploy_to_env: | ||
uses: ministryofjustice/hmpps-assess-risks-and-needs-github-actions/.github/workflows/deploy_to_env.yml@v1 | ||
secrets: inherit | ||
with: | ||
environment: ${{ inputs.environment }} | ||
image_tag: ${{ inputs.image_tag }} |
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,102 @@ | ||
name: Run end-to-end tests | ||
|
||
on: | ||
workflow_call: | ||
inputs: | ||
spec-file-patterns: | ||
type: string | ||
default: 'integration_tests/integration/features/**/*.feature' | ||
app_version: | ||
description: App version | ||
required: true | ||
type: string | ||
|
||
jobs: | ||
get-timings: | ||
uses: ministryofjustice/hmpps-assess-risks-and-needs-github-actions/.github/workflows/cypress_get_timings.yml@v1 | ||
with: | ||
repository: ministryofjustice/hmpps-risk-assessment-ui | ||
spec-file-patterns: ${{ inputs.spec-file-patterns }} | ||
|
||
e2e-test: | ||
runs-on: ubuntu-latest | ||
needs: get-timings | ||
env: | ||
API_IMAGE_TAG: ${{ inputs.app_version }} | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
container: [ 1, 2 ] | ||
outputs: | ||
timings-1: ${{ steps.timings.outputs.t1 }} | ||
timings-2: ${{ steps.timings.outputs.t2 }} | ||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- name: Download docker image | ||
uses: actions/download-artifact@v4 | ||
with: | ||
name: build_image | ||
path: ${{ runner.temp }} | ||
|
||
- name: Load image | ||
run: docker load --input ${{ runner.temp }}/build_image.tar | ||
|
||
- name: Clone UI repository | ||
uses: actions/checkout@v4 | ||
with: | ||
repository: ministryofjustice/hmpps-risk-assessment-ui | ||
path: e2e-test-ui | ||
|
||
- uses: ministryofjustice/hmpps-assess-risks-and-needs-github-actions/.github/actions/cypress/create_timings_file@v1 | ||
with: | ||
timings: ${{ needs.get-timings.outputs.timings }} | ||
path: e2e-test-ui | ||
|
||
- name: Stand up a test environment | ||
run: make up | ||
|
||
- name: Run the end-to-end tests | ||
uses: cypress-io/github-action@v6 | ||
with: | ||
working-directory: e2e-test-ui | ||
publish-summary: false | ||
browser: chrome | ||
env: | ||
SPEC: ${{ inputs.spec-file-patterns }} | ||
SPLIT: ${{ strategy.job-total }} | ||
SPLIT_INDEX: ${{ strategy.job-index }} | ||
SPLIT_FILE: 'timings.json' | ||
|
||
- name: Output updated timings | ||
if: success() || failure() | ||
id: timings | ||
run: | | ||
cat e2e-test-ui/timings.json | ||
echo "t${{ matrix.container }}=$(jq -c . < e2e-test-ui/timings.json)" >> $GITHUB_OUTPUT | ||
- name: Export container logs | ||
if: failure() | ||
run: make save-logs OUTPUT_LOGS_DIR=${{ runner.temp }}/docker-logs | ||
|
||
- name: Upload test results | ||
if: success() || failure() | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: e2e_test_results_${{ matrix.container }} | ||
path: | | ||
e2e-test-ui/test_results | ||
e2e-test-ui/integration_tests/screenshots | ||
e2e-test-ui/integration_tests/snapshots/diff | ||
${{ runner.temp }}/docker-logs | ||
save-timings: | ||
uses: ministryofjustice/hmpps-assess-risks-and-needs-github-actions/.github/workflows/cypress_save_timings.yml@v1 | ||
if: success() || failure() | ||
needs: | ||
- get-timings | ||
- e2e-test | ||
with: | ||
repository: ministryofjustice/hmpps-risk-assessment-ui | ||
initial-timings: ${{ needs.get-timings.outputs.timings }} | ||
updated-timings: ${{ toJSON(needs.e2e-test.outputs) }} |
Oops, something went wrong.