Skip to content

Commit

Permalink
ci: Simplify integration test workflows
Browse files Browse the repository at this point in the history
  • Loading branch information
ptiurin committed Jul 18, 2024
1 parent 5186237 commit 7db1202
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 48 deletions.
13 changes: 11 additions & 2 deletions .github/workflows/integration-test-v1.yml
Original file line number Diff line number Diff line change
@@ -1,15 +1,24 @@
name: Run integration tests v1

on:
workflow_dispatch:
inputs:
database:
description: 'Database override'
required: false
default: ''
engine:
description: 'Engine override'
required: false
workflow_call:
inputs:
database:
description: 'Database - a new one will be created if not provided'
description: 'Database override'
required: false
default: ''
type: string
engine:
description: 'Engine - a new one will be created if not provided'
description: 'Database override'
required: false
type: string
secrets:
Expand Down
36 changes: 30 additions & 6 deletions .github/workflows/integration-test-v2.yml
Original file line number Diff line number Diff line change
@@ -1,20 +1,33 @@
name: Run integration tests v2

on:
workflow_dispatch:
inputs:
database:
description: 'Database override'
required: false
default: ''
engine:
description: 'Engine override'
required: false
account:
description: 'Account override'
required: false
type: string
workflow_call:
inputs:
database:
description: 'Database - a new one will be created if not provided'
description: 'Database override'
required: false
default: ''
type: string
engine:
description: 'Engine - a new one will be created if not provided'
description: 'Engine override'
required: false
type: string
account:
description: 'Account'
required: true
description: 'Account override'
required: false
type: string
secrets:
FIREBOLT_CLIENT_ID_STG_NEW_IDN:
Expand All @@ -34,6 +47,17 @@ jobs:
script: |
core.setFailed("Database and Engine parameters should be provided simultaneously")
- name: Resolve account
id: set-account
run: |
if ! [[ -z "${{ inputs.account }}" ]]; then
echo "account=${{ inputs.account }}" >> $GITHUB_OUTPUT
echo "account=${{ inputs.account }}"
else
echo "account=${{ vars.FIREBOLT_ACCOUNT }}" >> $GITHUB_OUTPUT
echo "account=${{ vars.FIREBOLT_ACCOUNT }}"
fi
- name: Check out code
uses: actions/checkout@v3

Expand All @@ -50,7 +74,7 @@ jobs:
with:
firebolt-client-id: ${{ secrets.FIREBOLT_CLIENT_ID_STG_NEW_IDN }}
firebolt-client-secret: ${{ secrets.FIREBOLT_CLIENT_SECRET_STG_NEW_IDN }}
account: ${{ inputs.account }}
account: ${{ steps.set-account.outputs.account }}
api-endpoint: "api.staging.firebolt.io"

- name: Determine database name
Expand All @@ -72,4 +96,4 @@ jobs:
fi
- name: Run integration tests
run: ./gradlew integrationTest -Ddb=${{ steps.find-database-name.outputs.database_name }} -Denv=staging -Dclient_secret="${{ secrets.FIREBOLT_CLIENT_SECRET_STG_NEW_IDN }}" -Dclient_id="${{ secrets.FIREBOLT_CLIENT_ID_STG_NEW_IDN }}" -Daccount="${{ inputs.account }}" -Dengine="${{ steps.find-engine-name.outputs.engine_name }}" -DexcludeTags=v1
run: ./gradlew integrationTest -Ddb=${{ steps.find-database-name.outputs.database_name }} -Denv=staging -Dclient_secret="${{ secrets.FIREBOLT_CLIENT_SECRET_STG_NEW_IDN }}" -Dclient_id="${{ secrets.FIREBOLT_CLIENT_ID_STG_NEW_IDN }}" -Daccount="${{ steps.set-account.outputs.account }}" -Dengine="${{ steps.find-engine-name.outputs.engine_name }}" -DexcludeTags=v1
41 changes: 1 addition & 40 deletions .github/workflows/integration-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,56 +2,17 @@ name: Run integration tests

on:
workflow_dispatch:
inputs:
database1:
description: 'Database (v1) - a new one will be created if not provided'
required: false
default: ''
database-with-engine-v2:
description: 'Database (v2) for Firebolt v2 - a new one will be created if not provided'
required: false
default: ''
engine1:
description: 'Engine (v1) - a new one will be created if not provided'
required: false
engine_v2_fb_2_0:
description: 'Engine (v2) for Firebolt v2 - a new one will be created if not provided'
required: false
run-v1:
description: 'Run tests against Firebolt DB v1'
required: true
default: true
type: choice
options:
- 'true'
- 'false'
run-database-with-engine-v2:
description: 'Run tests against Firebolt DB v2 and Engine V2'
required: true
default: true
type: choice
options:
- 'true'
- 'false'
workflow_call:

jobs:
run-integration-tests1:
if: ${{ inputs.run-v1 == 'true' }}
uses: ./.github/workflows/integration-test-v1.yml
with:
database: ${{ inputs.database1 }}
engine: ${{ inputs.engine1 }}
secrets:
FIREBOLT_STG_USERNAME: ${{ secrets.FIREBOLT_STG_USERNAME }}
FIREBOLT_STG_PASSWORD: ${{ secrets.FIREBOLT_STG_PASSWORD }}

run-integration-tests-engine2:
if: ${{ inputs.run-database-with-engine-v2 == 'true' }}
uses: ./.github/workflows/integration-test-v2.yml
with:
database: ${{ inputs.database-with-engine-v2 }}
engine: ${{ inputs.engine_v2_fb_2_0 }}
account: ${{ vars.FIREBOLT_ACCOUNT_V2 }}
secrets:
FIREBOLT_CLIENT_ID_STG_NEW_IDN: ${{ secrets.FIREBOLT_CLIENT_ID_STG_NEW_IDN }}
FIREBOLT_CLIENT_SECRET_STG_NEW_IDN: ${{ secrets.FIREBOLT_CLIENT_SECRET_STG_NEW_IDN }}
Expand Down

0 comments on commit 7db1202

Please sign in to comment.