Skip to content

Commit

Permalink
PI-1513 Re-usable workflow for running e2e tests (#2454)
Browse files Browse the repository at this point in the history
  • Loading branch information
marcus-bcl authored Oct 27, 2023
1 parent ceb6d26 commit 532e4c7
Show file tree
Hide file tree
Showing 5 changed files with 38 additions and 256 deletions.
1 change: 0 additions & 1 deletion .github/actions/render-project-template/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ runs:
sed -i '/add new projects here/i \ - '"'"'["${{ inputs.project_name }}"]'"'"'' .github/workflows/access.yml
sed -i '/add new projects here/i \ - '"'"'["${{ inputs.project_name }}"]'"'"'' .github/workflows/deploy.yml
sed -i '/add new projects here/i \ - '"'"'["${{ inputs.project_name }}"]'"'"'' .github/workflows/docs.yml
sed -i '/add new projects here/i \ - '"'"'["${{ inputs.project_name }}"]'"'"'' .github/workflows/end-to-end-tests.yml
sed -i '/add new projects here/i \ - ${{ inputs.project_name }}' .github/workflows/suppress-trivy.yml
sed -i '/add new projects here/i \ - ${{ inputs.project_name }}' .github/workflows/build.yml
sed -i '/add new projects here/i \* [${{ steps.project_name.outputs.title_case }}](https://ministryofjustice.github.io/hmpps-probation-integration-services/tech-docs/projects/${{ inputs.project_name }})' doc/tech-docs/source/index.html.md.erb
Expand Down
48 changes: 35 additions & 13 deletions .github/workflows/bootstrap.yml
Original file line number Diff line number Diff line change
Expand Up @@ -97,11 +97,33 @@ jobs:
passphrase: ${{ secrets.BOT_GPG_PASSPHRASE }}
token: ${{ secrets.BOT_GITHUB_TOKEN }}

- uses: actions/checkout@v4
with:
path: hmpps-probation-integration-e2e-tests
repository: ministryofjustice/hmpps-probation-integration-e2e-tests
token: ${{ secrets.BOT_GITHUB_TOKEN }}

- name: Update e2e test repo
run: sed -i '/add new projects here/i \ - '"'"'["${{ inputs.project_name }}"]'"'"'' hmpps-probation-integration-e2e-tests/.github/workflows/end-to-end-tests.yml

- name: Create pull request
id: e2e-pr
uses: ./.github/actions/create-signed-pull-request
with:
path: hmpps-probation-integration-e2e-tests
add-paths: .github/workflows
branch: ${{ inputs.issue_number }}-create-${{ inputs.project_name }}-project
commit-message: ${{ inputs.issue_number }} Add option to run tests for ${{ inputs.project_name }}
private-key: ${{ secrets.BOT_GPG_PRIVATE_KEY }}
passphrase: ${{ secrets.BOT_GPG_PASSPHRASE }}
token: ${{ secrets.BOT_GITHUB_TOKEN }}

- name: Create issue for manual steps
run: |
gh issue create \
--title "${{ inputs.issue_number }} Complete project setup for ${{ inputs.project_name }}" \
--body "- [ ] Merge pull request: ${{ steps.pr.outputs.pull-request-url }}" \
--body "- [ ] Merge project pull request: ${{ steps.pr.outputs.pull-request-url }}" \
--body "- [ ] Merge e2e tests pull request: ${{ steps.e2e-pr.outputs.pull-request-url }}" \
--label bootstrap
env:
GITHUB_TOKEN: ${{ github.token }}
Expand Down Expand Up @@ -219,19 +241,19 @@ jobs:
with:
path: cloud-platform-environments-dev
repository: ministryofjustice/cloud-platform-environments
token: ${{ secrets.BOT_GITHUB_TOKEN }}
token: ${{ secrets.BOT_GITHUB_EXTERNAL_REPOS_TOKEN }}

- uses: actions/checkout@v4
with:
path: cloud-platform-environments-preprod
repository: ministryofjustice/cloud-platform-environments
token: ${{ secrets.BOT_GITHUB_TOKEN }}
token: ${{ secrets.BOT_GITHUB_EXTERNAL_REPOS_TOKEN }}

- uses: actions/checkout@v4
with:
path: cloud-platform-environments-prod
repository: ministryofjustice/cloud-platform-environments
token: ${{ secrets.BOT_GITHUB_TOKEN }}
token: ${{ secrets.BOT_GITHUB_EXTERNAL_REPOS_TOKEN }}

- name: Render Terraform queue template
run: |
Expand All @@ -258,7 +280,7 @@ jobs:
commit-message: ${{ inputs.issue_number }} Create SQS queues for ${{ inputs.project_name }} (dev)
private-key: ${{ secrets.BOT_GPG_PRIVATE_KEY }}
passphrase: ${{ secrets.BOT_GPG_PASSPHRASE }}
token: ${{ secrets.BOT_GITHUB_TOKEN }}
token: ${{ secrets.BOT_GITHUB_EXTERNAL_REPOS_TOKEN }}

- name: Create preprod pull request
id: preprod-pr
Expand All @@ -270,7 +292,7 @@ jobs:
commit-message: ${{ inputs.issue_number }} Create SQS queues for ${{ inputs.project_name }} (preprod)
private-key: ${{ secrets.BOT_GPG_PRIVATE_KEY }}
passphrase: ${{ secrets.BOT_GPG_PASSPHRASE }}
token: ${{ secrets.BOT_GITHUB_TOKEN }}
token: ${{ secrets.BOT_GITHUB_EXTERNAL_REPOS_TOKEN }}

- name: Create prod pull request
id: prod-pr
Expand All @@ -282,7 +304,7 @@ jobs:
commit-message: ${{ inputs.issue_number }} Create SQS queues for ${{ inputs.project_name }} (prod)
private-key: ${{ secrets.BOT_GPG_PRIVATE_KEY }}
passphrase: ${{ secrets.BOT_GPG_PASSPHRASE }}
token: ${{ secrets.BOT_GITHUB_TOKEN }}
token: ${{ secrets.BOT_GITHUB_EXTERNAL_REPOS_TOKEN }}

- name: Create issue for manual steps
run: |
Expand Down Expand Up @@ -316,19 +338,19 @@ jobs:
with:
path: cloud-platform-environments-dev
repository: ministryofjustice/cloud-platform-environments
token: ${{ secrets.BOT_GITHUB_TOKEN }}
token: ${{ secrets.BOT_GITHUB_EXTERNAL_REPOS_TOKEN }}

- uses: actions/checkout@v4
with:
path: cloud-platform-environments-preprod
repository: ministryofjustice/cloud-platform-environments
token: ${{ secrets.BOT_GITHUB_TOKEN }}
token: ${{ secrets.BOT_GITHUB_EXTERNAL_REPOS_TOKEN }}

- uses: actions/checkout@v4
with:
path: cloud-platform-environments-prod
repository: ministryofjustice/cloud-platform-environments
token: ${{ secrets.BOT_GITHUB_TOKEN }}
token: ${{ secrets.BOT_GITHUB_EXTERNAL_REPOS_TOKEN }}

- name: Add Pingdom check
run: sed -i '/add new projects here/i \ "${{ inputs.project_name }}",' 'cloud-platform-environments-prod/namespaces/live.cloud-platform.service.justice.gov.uk/hmpps-probation-integration-services-prod/resources/pingdom.tf'
Expand All @@ -349,7 +371,7 @@ jobs:
commit-message: ${{ inputs.issue_number }} Create certificate for ${{ inputs.project_name }} (dev)
private-key: ${{ secrets.BOT_GPG_PRIVATE_KEY }}
passphrase: ${{ secrets.BOT_GPG_PASSPHRASE }}
token: ${{ secrets.BOT_GITHUB_TOKEN }}
token: ${{ secrets.BOT_GITHUB_EXTERNAL_REPOS_TOKEN }}

- name: Create preprod pull request
id: preprod-pr
Expand All @@ -361,7 +383,7 @@ jobs:
commit-message: ${{ inputs.issue_number }} Create certificate for ${{ inputs.project_name }} (preprod)
private-key: ${{ secrets.BOT_GPG_PRIVATE_KEY }}
passphrase: ${{ secrets.BOT_GPG_PASSPHRASE }}
token: ${{ secrets.BOT_GITHUB_TOKEN }}
token: ${{ secrets.BOT_GITHUB_EXTERNAL_REPOS_TOKEN }}

- name: Create prod pull request
id: prod-pr
Expand All @@ -373,7 +395,7 @@ jobs:
commit-message: ${{ inputs.issue_number }} Create Pingdom check and certificate for ${{ inputs.project_name }} (prod)
private-key: ${{ secrets.BOT_GPG_PRIVATE_KEY }}
passphrase: ${{ secrets.BOT_GPG_PASSPHRASE }}
token: ${{ secrets.BOT_GITHUB_TOKEN }}
token: ${{ secrets.BOT_GITHUB_EXTERNAL_REPOS_TOKEN }}

- name: Create issue for manual steps
run: |
Expand Down
8 changes: 0 additions & 8 deletions .github/workflows/cleanup.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,14 +47,6 @@ jobs:
--path 'tech-docs' \
--path 'tech-docs-drafts' \
--path 'schema-spy-report' \
--path "playwright-report/test/main/$(date -d '-7 days' '+%Y-%m-%d')" \
--path "playwright-report/test/main/$(date -d '-6 days' '+%Y-%m-%d')" \
--path "playwright-report/test/main/$(date -d '-5 days' '+%Y-%m-%d')" \
--path "playwright-report/test/main/$(date -d '-4 days' '+%Y-%m-%d')" \
--path "playwright-report/test/main/$(date -d '-3 days' '+%Y-%m-%d')" \
--path "playwright-report/test/main/$(date -d '-2 days' '+%Y-%m-%d')" \
--path "playwright-report/test/main/$(date -d '-1 days' '+%Y-%m-%d')" \
--path "playwright-report/test/main/$(date '+%Y-%m-%d')" \
--refs gh-pages \
--force
git gc --prune=now
Expand Down
232 changes: 0 additions & 232 deletions .github/workflows/end-to-end-tests.yml

This file was deleted.

Loading

0 comments on commit 532e4c7

Please sign in to comment.