-
Notifications
You must be signed in to change notification settings - Fork 141
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Simplify the e2e test workflow by creating a composite action (#2978)
Move code to composite action in order to remove code duplication.
- Loading branch information
Showing
2 changed files
with
142 additions
and
102 deletions.
There are no files selected for viewing
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,95 @@ | ||
name: Run e2e tests | ||
description: Runs the e2e test in the specified environment | ||
inputs: | ||
flc-namespace: | ||
description: The namespace FLC uses | ||
required: true | ||
flc-environment: | ||
description: The environment FLC uses | ||
required: true | ||
target-branch: | ||
description: Target branch to run E2E tests over | ||
required: true | ||
default: main | ||
tenant1-name: | ||
description: The name of Tenant 1 | ||
required: true | ||
tenant1-apitoken: | ||
description: The API token of Tenant 1 | ||
required: true | ||
tenant1-oteltoken: | ||
description: The OTel token of Tenant 1 | ||
required: true | ||
tenant1-oauth-client-id: | ||
description: The OAuth client ID of Tenant 1 | ||
required: true | ||
tenant1-oauth-secret: | ||
description: The OAuth secret of Tenant 1 | ||
required: true | ||
tenant2-name: | ||
description: The name of Tenant 2 | ||
required: true | ||
tenant2-apitoken: | ||
description: The API token of Tenant 2 | ||
required: true | ||
github-token: | ||
description: The GitHub token | ||
required: true | ||
|
||
runs: | ||
using: composite | ||
steps: | ||
- name: Checkout workflow scripts from ref branch | ||
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 | ||
with: | ||
path: ref | ||
- name: Checkout target branch | ||
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 | ||
with: | ||
ref: ${{ github.event.inputs.target || 'main' }} | ||
path: target | ||
- name: Set up kubectl | ||
uses: azure/setup-kubectl@3e0aec4d80787158d308d7b364cb1b702e7feb7f # v4.0.0 | ||
- name: Set up go | ||
uses: actions/setup-go@0c52d547c9bc32b1aa3301fd7a9cb496313a4491 # v5.0.0 | ||
with: | ||
go-version-file: "${{ github.workspace }}/target/go.mod" | ||
- name: Set up helm | ||
uses: azure/setup-helm@5119fcb9089d432beecbf79bb2c7915207344b78 # v3.5 | ||
with: | ||
token: ${{ inputs.github-token }} | ||
- name: Install gotestsum | ||
shell: bash | ||
run: go install gotest.tools/gotestsum@latest | ||
- name: Create cluster | ||
shell: bash | ||
run: ref/.github/scripts/create-cluster.sh | ||
env: | ||
FLC_NAMESPACE: ${{ inputs.flc-namespace }} | ||
FLC_ENVIRONMENT: ${{ inputs.flc-environment }} | ||
- name: Run tests | ||
shell: bash | ||
run: ref/.github/scripts/run-e2e-tests.sh | ||
env: | ||
FLC_NAMESPACE: ${{ inputs.flc-namespace }} | ||
FLC_ENVIRONMENT: ${{ inputs.flc-environment }} | ||
TARGET_BRANCH: ${{ inputs.target-branch || 'main' }} | ||
TENANT1_NAME: ${{ inputs.tenant1-name }} | ||
TENANT1_APITOKEN: ${{ inputs.tenant1-apitoken }} | ||
TENANT1_OTELTOKEN: ${{ inputs.tenant1-oteltoken }} | ||
TENANT1_OAUTH_CLIENT_ID: ${{ inputs.tenant1-oauth-client-id }} | ||
TENANT1_OAUTH_SECRET: ${{ inputs.tenant1-oauth-secret }} | ||
TENANT2_NAME: ${{ inputs.tenant2-name }} | ||
TENANT2_APITOKEN: ${{ inputs.tenant2-apitoken }} | ||
- name: Destroy cluster | ||
shell: bash | ||
run: ref/.github/scripts/destroy-cluster.sh | ||
env: | ||
FLC_NAMESPACE: ${{ inputs.flc-namespace }} | ||
FLC_ENVIRONMENT: ${{ inputs.flc-environment }} | ||
if: always() | ||
- name: Publish test results | ||
uses: EnricoMi/publish-unit-test-result-action@v2 | ||
with: | ||
files: target/results/*.xml | ||
if: always() |
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