-
Notifications
You must be signed in to change notification settings - Fork 6
144 lines (130 loc) · 6.23 KB
/
integration-test.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
name: Run integration tests
on:
workflow_dispatch:
inputs:
database1:
description: 'Database (v1) - a new one will be created if not provided'
required: false
default: ''
database2:
description: 'Database (v2) - a new one will be created if not provided'
required: false
default: ''
engine2:
description: 'Engine (v2) - a new one will be created if not provided'
required: false
account:
description: 'Account'
required: true
default: 'developer'
environment:
description: 'Environment to run the tests against'
type: choice
required: true
default: 'staging'
options:
- dev
- staging
jobs:
run-integration-tests:
runs-on: ubuntu-latest
steps:
- name: Validate database and engine
if: ${{ (github.event.inputs.database2 == '') != (github.event.inputs.engine2 == '') }}
uses: actions/github-script@v3
with:
script: |
core.setFailed("Database and Engine parameters should be provided simultaneously")
- name: "Foresight: Collect Workflow Telemetry"
uses: runforesight/foresight-workflow-kit-action@v1
if: ${{ always() }}
- name: Check out code
uses: actions/checkout@v3
- name: Prepare java
uses: actions/setup-java@v3
with:
distribution: 'zulu'
java-version: '11'
- name: Determine env variables (v1)
run: |
if [ "${{ github.event.inputs.environment }}" == 'staging' ]; then
echo "USERNAME=${{ secrets.FIREBOLT_USERNAME_STAGING }}" >> "$GITHUB_ENV"
echo "PASSWORD=${{ secrets.FIREBOLT_PASSWORD_STAGING }}" >> "$GITHUB_ENV"
echo "SERVICE_ACCOUNT_ID=${{ secrets.SERVICE_ACCOUNT_ID_STAGING }}" >> "$GITHUB_ENV"
echo "SERVICE_ACCOUNT_SECRET=${{ secrets.SERVICE_ACCOUNT_SECRET_STAGING }}" >> "$GITHUB_ENV"
else
echo "USERNAME=${{ secrets.FIREBOLT_USERNAME_DEV }}" >> "$GITHUB_ENV"
echo "PASSWORD=${{ secrets.FIREBOLT_PASSWORD_DEV }}" >> "$GITHUB_ENV"
echo "SERVICE_ACCOUNT_ID=${{ secrets.SERVICE_ACCOUNT_ID_DEV }}" >> "$GITHUB_ENV"
echo "SERVICE_ACCOUNT_SECRET=${{ secrets.SERVICE_ACCOUNT_SECRET_DEV }}" >> "$GITHUB_ENV"
fi - name: Setup database and engine (v1)
id: setup1
if: ${{ github.event.inputs.database1 == '' }}
uses: firebolt-db/integration-testing-setup@v1
with:
firebolt-username: ${{ env.USERNAME }}
firebolt-password: ${{ env.PASSWORD }}
api-endpoint: "api.${{ github.event.inputs.environment }}.firebolt.io"
region: "us-east-1"
instance-type: "B2"
- name: Determine database (v1) name
id: find-database-name1
run: |
if ! [[ -z "${{ github.event.inputs.database1 }}" ]]; then
echo "database_name=${{ github.event.inputs.database1 }}" >> $GITHUB_OUTPUT
else
echo "database_name=${{ steps.setup.outputs.database_name }}" >> $GITHUB_OUTPUT
fi
- name: Run integration tests (v1)
run: ./gradlew integrationTest -Ddb=${{ steps.find-database-name.outputs.database_name }} -Dapi=api.${{ github.event.inputs.environment }}.firebolt.io -Dpassword="${{ env.SERVICE_ACCOUNT_SECRET }}" -Duser="${{ env.SERVICE_ACCOUNT_ID }}" -DincludeTags="common,v1"
- name: Determine env variables (v2)
run: |
if [ "${{ github.event.inputs.environment }}" == 'staging' ]; then
echo "USERNAME=${{ secrets.FIREBOLT_USERNAME_STAGING }}" >> "$GITHUB_ENV"
echo "PASSWORD=${{ secrets.FIREBOLT_PASSWORD_STAGING }}" >> "$GITHUB_ENV"
echo "SERVICE_ACCOUNT_ID=${{ secrets.FIREBOLT_CLIENT_ID_STG_NEW_IDN }}" >> "$GITHUB_ENV"
echo "SERVICE_ACCOUNT_SECRET=${{ secrets.FIREBOLT_CLIENT_SECRET_STG_NEW_IDN }}" >> "$GITHUB_ENV"
else
echo "USERNAME=${{ secrets.FIREBOLT_USERNAME_DEV }}" >> "$GITHUB_ENV"
echo "PASSWORD=${{ secrets.FIREBOLT_PASSWORD_DEV }}" >> "$GITHUB_ENV"
echo "SERVICE_ACCOUNT_ID=${{ secrets.FIREBOLT_CLIENT_ID_NEW_IDN }}" >> "$GITHUB_ENV"
echo "SERVICE_ACCOUNT_SECRET=${{ secrets.FIREBOLT_CLIENT_SECRET_NEW_IDN }}" >> "$GITHUB_ENV"
fi
- name: Setup database and engine (v2)
id: setup2
if: ${{ github.event.inputs.database2 == '' }}
uses: firebolt-db/integration-testing-setup@v2
with:
firebolt-client-id: ${{ env.SERVICE_ACCOUNT_ID }}
firebolt-client-secret: ${{ env.SERVICE_ACCOUNT_SECRET }}
account: ${{ github.event.inputs.account }}
api-endpoint: "api.${{ github.event.inputs.environment }}.firebolt.io"
instance-type: "B2"
- name: Determine database (v2) name
id: find-database-name2
run: |
if ! [[ -z "${{ github.event.inputs.database2 }}" ]]; then
echo "database_name=${{ github.event.inputs.database2 }}" >> $GITHUB_OUTPUT
else
echo "database_name=${{ steps.setup.outputs.database_name }}" >> $GITHUB_OUTPUT
fi
- name: Determine engine (v2) name
id: find-engine-name2
run: |
if ! [[ -z "${{ github.event.inputs.engine2 }}" ]]; then
echo "engine_name=${{ github.event.inputs.engine2 }}" >> $GITHUB_OUTPUT
else
echo "engine_name=${{ steps.setup.outputs.engine_name }}" >> $GITHUB_OUTPUT
fi
- name: Run integration tests (v2)
run: ./gradlew integrationTest -Ddb=${{ steps.find-database-name.outputs.database_name }} -Denv=${{ github.event.inputs.environment }} -Dclient_secret="${{ env.SERVICE_ACCOUNT_SECRET }}" -Dclient_id="${{ env.SERVICE_ACCOUNT_ID }}" -Daccount="${{ github.event.inputs.account }}" -Dengine="${{ steps.find-engine-name.outputs.engine_name }}" -DincludeTags="common,v2"
- name: "Foresight: Analyze Test Results"
uses: runforesight/foresight-test-kit-action@v1
if: success() || failure()
with:
test_format: JUNIT
test_framework: JUNIT
test_path: ./build/test-results/
tags: |
type:"integration"
language:"Java"