AUT-3691: Add a finalizedBy configuration to the test task this allow… #15023
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
name: Pre-merge checks | |
env: | |
JAVA_VERSION: "17" | |
JAVA_DISTRIBUTION: "corretto" | |
on: | |
pull_request: | |
types: | |
- opened | |
- reopened | |
- ready_for_review | |
- synchronize | |
merge_group: | |
jobs: | |
check-changed-files: | |
permissions: | |
pull-requests: write | |
uses: ./.github/workflows/call_get_changed_files.yml | |
check-openapi-specs: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check out repository code | |
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 | |
- name: Set up Python | |
uses: actions/setup-python@0b93645e9fea7318ecaed2b359559ac225c90a2b # v5.3.0 | |
with: | |
python-version: 3.12 | |
- name: Install dependencies | |
run: | | |
pip install pyyaml | |
- name: Check OpenAPI specs | |
shell: bash | |
run: | | |
find ci/terraform -type f -name "*openapi*.yaml" -exec python scripts/validate_openapi_definition.py {} \; | |
build: | |
runs-on: ubuntu-latest | |
needs: | |
- check-changed-files | |
steps: | |
- name: Check out repository code | |
if: needs.check-changed-files.outputs.java_changed == 'true' | |
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 | |
- name: Set up JDK 17 | |
if: needs.check-changed-files.outputs.java_changed == 'true' | |
uses: actions/setup-java@8df1039502a15bceb9433410b1a100fbe190c53b #v4.5.0 | |
with: | |
java-version: ${{ env.JAVA_VERSION }} | |
distribution: ${{ env.JAVA_DISTRIBUTION }} | |
- name: Set up Gradle | |
if: needs.check-changed-files.outputs.java_changed == 'true' | |
uses: gradle/actions/setup-gradle@cc4fc85e6b35bafd578d5ffbc76a5518407e1af0 # v4 | |
with: | |
gradle-version: wrapper | |
cache-read-only: false | |
- name: Build Cache | |
if: needs.check-changed-files.outputs.java_changed == 'true' | |
uses: actions/cache@1bd1e32a3bdc45362d1e726936510720a7c30a57 # v4.2.0 | |
with: | |
path: | | |
.gradle/ | |
*/build/ | |
!*/build/reports | |
!*/build/jacoco | |
key: ${{ runner.os }}-build-${{ github.sha }} | |
- name: Run Build | |
if: needs.check-changed-files.outputs.java_changed == 'true' | |
run: ./gradlew --parallel build -x test -x account-management-integration-tests:test -x spotlessApply -x spotlessCheck | |
style-checks: | |
runs-on: ubuntu-latest | |
needs: | |
- build | |
- check-changed-files | |
steps: | |
- name: Check out repository code | |
if: needs.check-changed-files.outputs.java_changed == 'true' | |
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 | |
- name: Set up JDK 17 | |
if: needs.check-changed-files.outputs.java_changed == 'true' | |
uses: actions/setup-java@8df1039502a15bceb9433410b1a100fbe190c53b #v4.5.0 | |
with: | |
java-version: ${{ env.JAVA_VERSION }} | |
distribution: ${{ env.JAVA_DISTRIBUTION }} | |
- name: Set up Gradle | |
if: needs.check-changed-files.outputs.java_changed == 'true' | |
uses: gradle/actions/setup-gradle@cc4fc85e6b35bafd578d5ffbc76a5518407e1af0 # v4 | |
with: | |
gradle-version: wrapper | |
cache-read-only: true | |
- name: Restore Build Cache | |
if: needs.check-changed-files.outputs.java_changed == 'true' | |
uses: actions/cache/restore@1bd1e32a3bdc45362d1e726936510720a7c30a57 # v4.2.0 | |
with: | |
path: | | |
.gradle/ | |
*/build/ | |
!*/build/reports | |
!*/build/jacoco | |
key: ${{ runner.os }}-build-${{ github.sha }} | |
- name: Run Spotless | |
if: needs.check-changed-files.outputs.java_changed == 'true' | |
run: ./gradlew --no-daemon spotlessCheck | |
run-unit-tests: | |
runs-on: ubuntu-latest | |
needs: | |
- build | |
- check-changed-files | |
steps: | |
- name: Check out repository code | |
if: needs.check-changed-files.outputs.java_changed == 'true' | |
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 | |
- name: Set up JDK 17 | |
if: needs.check-changed-files.outputs.java_changed == 'true' | |
uses: actions/setup-java@8df1039502a15bceb9433410b1a100fbe190c53b #v4.5.0 | |
with: | |
java-version: ${{ env.JAVA_VERSION }} | |
distribution: ${{ env.JAVA_DISTRIBUTION }} | |
- name: Set up Gradle | |
if: needs.check-changed-files.outputs.java_changed == 'true' | |
uses: gradle/actions/setup-gradle@cc4fc85e6b35bafd578d5ffbc76a5518407e1af0 # v4 | |
with: | |
gradle-version: wrapper | |
cache-read-only: true | |
- name: Restore Build Cache | |
if: needs.check-changed-files.outputs.java_changed == 'true' | |
uses: actions/cache/restore@1bd1e32a3bdc45362d1e726936510720a7c30a57 # v4.2.0 | |
with: | |
path: | | |
.gradle/ | |
*/build/ | |
!*/build/reports | |
!*/build/jacoco | |
key: ${{ runner.os }}-build-${{ github.sha }} | |
- name: Run Unit Tests | |
if: needs.check-changed-files.outputs.java_changed == 'true' | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
run: ./gradlew --parallel test jacocoTestReport -x integration-tests:test -x account-management-integration-tests:test -x delivery-receipts-integration-tests:test -x spotlessApply -x spotlessCheck | |
- name: Cache Unit Test Reports | |
if: needs.check-changed-files.outputs.java_changed == 'true' | |
uses: actions/cache/save@1bd1e32a3bdc45362d1e726936510720a7c30a57 # v4.2.0 | |
with: | |
key: ${{ runner.os }}-unit-test-reports-${{ github.sha }} | |
path: | | |
*/build/jacoco/ | |
*/build/reports/ | |
!integration-tests/build/jacoco/ | |
!integration-tests/build/reports/ | |
!account-management-integration-tests/build/jacoco/ | |
!account-management-integration-tests/build/reports/ | |
!delivery-receipts-integration-tests/build/jacoco/ | |
!delivery-receipts-integration-tests/build/reports/ | |
- name: Upload Unit Test Reports | |
uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 # v4.4.3 | |
if: failure() && needs.check-changed-files.outputs.java_changed == 'true' | |
with: | |
name: unit-test-reports | |
path: | | |
*/build/reports/ | |
!integration-tests/build/reports/ | |
!account-management-integration-tests/build/reports/ | |
!delivery-receipts-integration-tests/build/reports/ | |
retention-days: 5 | |
run-integration-tests: | |
runs-on: ubuntu-latest | |
needs: | |
- build | |
- check-changed-files | |
services: | |
localstack: | |
image: ${{ (needs.check-changed-files.outputs.java_changed == 'true') && 'localstack/localstack:3.0.0' || '' }} | |
env: | |
SERVICES: "lambda, apigateway, iam, ec2, sqs, s3, sts, kms, sns, ssm, events" | |
GATEWAY_LISTEN: 0.0.0.0:45678 | |
LOCALSTACK_HOST: localhost:45678 | |
TEST_AWS_ACCOUNT_ID: 123456789012 | |
options: >- | |
--add-host "notify.internal:host-gateway" | |
--add-host "subscriber.internal:host-gateway" | |
ports: | |
- 45678:45678 | |
redis: | |
image: ${{ (needs.check-changed-files.outputs.java_changed == 'true') && 'redis:6.0.5-alpine' || '' }} | |
options: >- | |
--health-cmd "redis-cli ping" | |
--health-interval 10s | |
--health-timeout 5s | |
--health-retries 5 | |
ports: | |
- 6379:6379 | |
dynamodb: | |
image: ${{ (needs.check-changed-files.outputs.java_changed == 'true') && 'amazon/dynamodb-local:1.22.0' || '' }} | |
options: >- | |
--health-cmd "curl http://localhost:8000" | |
--health-interval 10s | |
--health-timeout 5s | |
--health-retries 5 | |
ports: | |
- 8000:8000 | |
steps: | |
- name: Check out repository code | |
if: needs.check-changed-files.outputs.java_changed == 'true' | |
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 | |
- name: Set up JDK 17 | |
if: needs.check-changed-files.outputs.java_changed == 'true' | |
uses: actions/setup-java@8df1039502a15bceb9433410b1a100fbe190c53b #v4.5.0 | |
with: | |
java-version: ${{ env.JAVA_VERSION }} | |
distribution: ${{ env.JAVA_DISTRIBUTION }} | |
- name: Set up Gradle | |
if: needs.check-changed-files.outputs.java_changed == 'true' | |
uses: gradle/actions/setup-gradle@cc4fc85e6b35bafd578d5ffbc76a5518407e1af0 # v4 | |
with: | |
gradle-version: wrapper | |
cache-read-only: true | |
- name: Restore Build Cache | |
if: needs.check-changed-files.outputs.java_changed == 'true' | |
uses: actions/cache/restore@1bd1e32a3bdc45362d1e726936510720a7c30a57 # v4.2.0 | |
with: | |
path: | | |
.gradle/ | |
*/build/ | |
!*/build/reports | |
!*/build/jacoco | |
key: ${{ runner.os }}-build-${{ github.sha }} | |
- name: Run Integration Tests | |
if: needs.check-changed-files.outputs.java_changed == 'true' | |
run: | | |
./gradlew :integration-tests:test :integration-tests:jacocoTestReport -x spotlessApply -x spotlessCheck -x composeUp | |
- name: Cache Test Reports | |
if: needs.check-changed-files.outputs.java_changed == 'true' | |
uses: actions/cache/save@1bd1e32a3bdc45362d1e726936510720a7c30a57 # v4.2.0 | |
with: | |
key: ${{ runner.os }}-integration-test-reports-${{ github.sha }} | |
path: | | |
integration-tests/build/jacoco/ | |
integration-tests/build/reports/ | |
- name: Upload Integration Test Reports | |
uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 # v4.4.3 | |
if: failure() && needs.check-changed-files.outputs.java_changed == 'true' | |
with: | |
name: integration-test-reports | |
path: integration-tests/build/reports/tests/test/ | |
retention-days: 5 | |
run-account-management-and-delivery-receipts-tests: | |
runs-on: ubuntu-latest | |
needs: | |
- build | |
- check-changed-files | |
services: | |
localstack: | |
image: ${{ (needs.check-changed-files.outputs.java_changed == 'true') && 'localstack/localstack:3.0.0' || '' }} | |
env: | |
SERVICES: "lambda, apigateway, iam, ec2, sqs, s3, sts, kms, sns, ssm, events" | |
DEFAULT_REGION: eu-west-2 | |
GATEWAY_LISTEN: 0.0.0.0:45678 | |
LOCALSTACK_HOST: localhost:45678 | |
TEST_AWS_ACCOUNT_ID: 123456789012 | |
KMS_PROVIDER: local-kms | |
options: >- | |
--add-host "notify.internal:host-gateway" | |
--add-host "subscriber.internal:host-gateway" | |
ports: | |
- 45678:45678 | |
redis: | |
image: ${{ (needs.check-changed-files.outputs.java_changed == 'true') && 'redis:6.0.5-alpine' || '' }} | |
options: >- | |
--health-cmd "redis-cli ping" | |
--health-interval 10s | |
--health-timeout 5s | |
--health-retries 5 | |
ports: | |
- 6379:6379 | |
dynamodb: | |
image: ${{ (needs.check-changed-files.outputs.java_changed == 'true') && 'amazon/dynamodb-local:1.22.0' || '' }} | |
options: >- | |
--health-cmd "curl http://localhost:8000" | |
--health-interval 10s | |
--health-timeout 5s | |
--health-retries 5 | |
ports: | |
- 8000:8000 | |
steps: | |
- name: Check out repository code | |
if: needs.check-changed-files.outputs.java_changed == 'true' | |
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 | |
- name: Set up JDK 17 | |
if: needs.check-changed-files.outputs.java_changed == 'true' | |
uses: actions/setup-java@8df1039502a15bceb9433410b1a100fbe190c53b #v4.5.0 | |
with: | |
java-version: ${{ env.JAVA_VERSION }} | |
distribution: ${{ env.JAVA_DISTRIBUTION }} | |
- name: Set up Gradle | |
if: needs.check-changed-files.outputs.java_changed == 'true' | |
uses: gradle/actions/setup-gradle@cc4fc85e6b35bafd578d5ffbc76a5518407e1af0 # v4 | |
with: | |
gradle-version: wrapper | |
cache-read-only: true | |
- name: Restore Build Cache | |
if: needs.check-changed-files.outputs.java_changed == 'true' | |
uses: actions/cache/restore@1bd1e32a3bdc45362d1e726936510720a7c30a57 # v4.2.0 | |
with: | |
path: | | |
.gradle/ | |
*/build/ | |
!*/build/reports | |
!*/build/jacoco | |
key: ${{ runner.os }}-build-${{ github.sha }} | |
- name: Run Account Management Integration Tests | |
if: needs.check-changed-files.outputs.java_changed == 'true' | |
run: | | |
./gradlew :account-management-integration-tests:test :account-management-integration-tests:jacocoTestReport -x spotlessApply -x spotlessCheck -x composeUp | |
- name: Upload Account Management Integration Test Reports | |
uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 # v4.4.3 | |
if: failure() && needs.check-changed-files.outputs.java_changed == 'true' | |
with: | |
name: account-management-integration-test-reports | |
path: account-management-integration-tests/build/reports/tests/test/ | |
retention-days: 5 | |
- name: Run Delivery Receipts Integration Tests | |
if: needs.check-changed-files.outputs.java_changed == 'true' | |
run: | | |
./gradlew :delivery-receipts-integration-tests:test :delivery-receipts-integration-tests:jacocoTestReport -x spotlessApply -x spotlessCheck -x composeUp | |
- name: Cache Test Reports | |
if: needs.check-changed-files.outputs.java_changed == 'true' | |
uses: actions/cache/save@1bd1e32a3bdc45362d1e726936510720a7c30a57 # v4.2.0 | |
with: | |
key: ${{ runner.os }}-am-dr-integration-test-reports-${{ github.sha }} | |
path: | | |
account-management-integration-tests/build/jacoco/ | |
account-management-integration-tests/build/reports/ | |
delivery-receipts-integration-tests/build/jacoco/ | |
delivery-receipts-integration-tests/build/reports/ | |
- name: Upload Account Management Integration Test Reports | |
uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 # v4.4.3 | |
if: failure() && needs.check-changed-files.outputs.java_changed == 'true' | |
with: | |
name: delivery-receipts-integration-test-reports | |
path: delivery-receipts-integration-tests/build/reports/tests/test/ | |
retention-days: 5 | |
run-sonar-analysis: | |
runs-on: ubuntu-latest | |
needs: | |
- run-unit-tests | |
- run-integration-tests | |
- run-account-management-and-delivery-receipts-tests | |
- check-changed-files | |
if: github.event_name != 'merge_group' | |
steps: | |
- name: Check out repository code | |
if: needs.check-changed-files.outputs.java_changed == 'true' | |
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 | |
with: | |
fetch-depth: 0 | |
- name: Set up JDK 17 | |
if: needs.check-changed-files.outputs.java_changed == 'true' | |
uses: actions/setup-java@8df1039502a15bceb9433410b1a100fbe190c53b #v4.5.0 | |
with: | |
java-version: ${{ env.JAVA_VERSION }} | |
distribution: ${{ env.JAVA_DISTRIBUTION }} | |
- name: Set up Gradle | |
if: needs.check-changed-files.outputs.java_changed == 'true' | |
uses: gradle/actions/setup-gradle@cc4fc85e6b35bafd578d5ffbc76a5518407e1af0 # v4 | |
with: | |
gradle-version: wrapper | |
cache-read-only: true | |
- name: Restore Build Cache | |
if: needs.check-changed-files.outputs.java_changed == 'true' | |
uses: actions/cache/restore@1bd1e32a3bdc45362d1e726936510720a7c30a57 # v4.2.0 | |
with: | |
path: | | |
.gradle/ | |
*/build/ | |
!*/build/reports | |
!*/build/jacoco | |
key: ${{ runner.os }}-build-${{ github.sha }} | |
- name: Restore Cached Unit Test Reports | |
if: needs.check-changed-files.outputs.java_changed == 'true' | |
uses: actions/cache/restore@1bd1e32a3bdc45362d1e726936510720a7c30a57 # v4.2.0 | |
with: | |
key: ${{ runner.os }}-unit-test-reports-${{ github.sha }} | |
path: | | |
*/build/jacoco/ | |
*/build/reports/ | |
!integration-tests/build/jacoco/ | |
!integration-tests/build/reports/ | |
!account-management-integration-tests/build/jacoco/ | |
!account-management-integration-tests/build/reports/ | |
!delivery-receipts-integration-tests/build/jacoco/ | |
!delivery-receipts-integration-tests/build/reports/ | |
- name: Restore Cached Integration Test Reports | |
if: needs.check-changed-files.outputs.java_changed == 'true' | |
uses: actions/cache/restore@1bd1e32a3bdc45362d1e726936510720a7c30a57 # v4.2.0 | |
with: | |
key: ${{ runner.os }}-integration-test-reports-${{ github.sha }} | |
path: | | |
integration-tests/build/jacoco/ | |
integration-tests/build/reports/ | |
- name: Restore Cached AM DR Integration Test Reports | |
if: needs.check-changed-files.outputs.java_changed == 'true' | |
uses: actions/cache/restore@1bd1e32a3bdc45362d1e726936510720a7c30a57 # v4.2.0 | |
with: | |
key: ${{ runner.os }}-am-dr-integration-test-reports-${{ github.sha }} | |
path: | | |
account-management-integration-tests/build/jacoco/ | |
account-management-integration-tests/build/reports/ | |
delivery-receipts-integration-tests/build/jacoco/ | |
delivery-receipts-integration-tests/build/reports/ | |
- name: Run SonarCloud Analysis | |
if: github.actor != 'dependabot[bot]' && needs.check-changed-files.outputs.java_changed == 'true' | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} | |
run: ./gradlew testCodeCoverageReport sonar -x test -x account-management-integration-tests:test -x spotlessApply -x spotlessCheck |