Get integration test configuration directly from a GitHub Actions variable

This commit is contained in:
Jon Chambers 2025-05-16 15:23:08 -04:00 committed by Jon Chambers
parent 74ee1c8c4f
commit fbbc4b8b27
2 changed files with 24 additions and 8 deletions

View File

@ -5,30 +5,33 @@ on:
- cron: '30 19 * * MON-FRI' - cron: '30 19 * * MON-FRI'
workflow_dispatch: workflow_dispatch:
env:
# This may seem a little redundant, but copying the configuration to an environment variable makes it easier and safer
# to then write its contents to a file
INTEGRATION_TEST_CONFIG: ${{ vars.INTEGRATION_TEST_CONFIG }}
jobs: jobs:
build: build:
if: ${{ vars.INTEGRATION_TESTS_BUCKET != '' }} if: ${{ vars.INTEGRATION_TEST_CONFIG != '' }}
runs-on: ubuntu-latest runs-on: ubuntu-latest
permissions: permissions:
id-token: write id-token: write
contents: read contents: read
steps: steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- uses: actions/setup-java@3a4f6e1af504cf6a31855fa899c6aa5355ba6c12 # v4.7.0 - uses: actions/setup-java@c5195efecf7bdfc987ee8bae7a71cb8b11521c00 # v4.7.1
with: with:
distribution: 'temurin' distribution: 'temurin'
java-version: '21' java-version: '21'
cache: 'maven' cache: 'maven'
- uses: aws-actions/configure-aws-credentials@ececac1a45f3b08a01d2dd070d28d111c5fe6722 # v4.1.0 - uses: aws-actions/configure-aws-credentials@b47578312673ae6fa5b5096b330d9fbac3d116df # v4.2.1
name: Configure AWS credentials from Test account name: Configure AWS credentials from Test account
with: with:
role-to-assume: ${{ vars.AWS_ROLE }} role-to-assume: ${{ vars.AWS_ROLE }}
aws-region: ${{ vars.AWS_REGION }} aws-region: ${{ vars.AWS_REGION }}
- name: Fetch integration utils library - name: Write integration test configuration
run: | run: |
mkdir -p integration-tests/.libs
mkdir -p integration-tests/src/main/resources mkdir -p integration-tests/src/main/resources
wget -O integration-tests/.libs/software.amazon.awssdk-sso.jar https://repo1.maven.org/maven2/software/amazon/awssdk/sso/2.19.8/sso-2.19.8.jar echo "${INTEGRATION_TEST_CONFIG}" > integration-tests/src/main/resources/config.yml
aws s3 cp "s3://${{ vars.INTEGRATION_TESTS_BUCKET }}/config-latest.yml" integration-tests/src/main/resources/config.yml
- name: Run and verify integration tests - name: Run and verify integration tests
run: ./mvnw clean compile test-compile failsafe:integration-test failsafe:verify run: ./mvnw clean compile test-compile failsafe:integration-test failsafe:verify -P aws-sso

View File

@ -57,4 +57,17 @@
</plugin> </plugin>
</plugins> </plugins>
</build> </build>
<profiles>
<profile>
<id>aws-sso</id>
<dependencies>
<dependency>
<groupId>software.amazon.awssdk</groupId>
<artifactId>sso</artifactId>
</dependency>
</dependencies>
</profile>
</profiles>
</project> </project>