-
Notifications
You must be signed in to change notification settings - Fork 4
189 lines (168 loc) · 6.19 KB
/
dockerized.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
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
name: Dockerized Tests
on:
push:
branches:
- main
pull_request:
branches:
- '*'
paths-ignore:
- '**/*.md'
- '**/*.jpg'
- '**/README.txt'
- '**/LICENSE.txt'
- 'docs/**'
- 'ISSUE_TEMPLATE/**'
- '**/remove-old-artifacts.yml'
env:
BUILD_TYPE: Release
jobs:
build-dockerized-community-tests:
name: Dockerized Community Tests
runs-on: ubuntu-20.04
env:
CMAKE_GENERATOR: Unix Makefiles
steps:
- name: Checkout source code
uses: actions/checkout@v2
- name: Cache AWS SDK libraries
id: cache-dynamic-aws-sdk
uses: actions/cache@v3
with:
path: |
aws_sdk
key: ${{ runner.os }}-aws-sdk-dynamic-lib
- name: Build and install AWS SDK C++
working-directory: ./scripts
if: steps.cache-dynamic-aws-sdk.outputs.cache-hit != 'true'
run: |
./build_aws_sdk_unix.sh $BUILD_TYPE
- name: 'Set up JDK 8'
uses: actions/setup-java@v1
with:
java-version: 8
- name: 'Run Community Tests'
working-directory: ${{ github.workspace }}/testframework
run: |
./gradlew --no-parallel --no-daemon test-community --info
env:
TEST_DSN: awsmysqlodbca
TEST_USERNAME: root
TEST_PASSWORD: root
DRIVER_PATH: ${{ github.workspace }}
build-dockerized-integration-tests:
concurrency: # Cancel previous runs in the same branch
group: environment-${{ github.ref }}
cancel-in-progress: true
name: Dockerized Integration Tests
runs-on: ubuntu-20.04
env:
CMAKE_GENERATOR: Unix Makefiles
steps:
- name: Checkout source code
uses: actions/checkout@v2
- name: Cache AWS SDK libraries
id: cache-dynamic-aws-sdk
uses: actions/cache@v3
with:
path: |
aws_sdk
key: ${{ runner.os }}-aws-sdk-dynamic-lib
- name: Build and install AWS SDK C++
working-directory: ./scripts
if: steps.cache-dynamic-aws-sdk.outputs.cache-hit != 'true'
run: |
./build_aws_sdk_unix.sh $BUILD_TYPE
- name: 'Set up JDK 8'
uses: actions/setup-java@v1
with:
java-version: 8
- name: 'Configure AWS Credentials'
uses: aws-actions/configure-aws-credentials@v1
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: ${{ secrets.AWS_DEFAULT_REGION }}
- name: 'Set up Temp AWS Credentials'
run: |
creds=($(aws sts get-session-token \
--duration-seconds 7200 \
--query 'Credentials.[AccessKeyId, SecretAccessKey, SessionToken]' \
--output text \
| xargs));
echo "::add-mask::${creds[0]}"
echo "::add-mask::${creds[1]}"
echo "::add-mask::${creds[2]}"
echo "TEMP_AWS_ACCESS_KEY_ID=${creds[0]}" >> $GITHUB_ENV
echo "TEMP_AWS_SECRET_ACCESS_KEY=${creds[1]}" >> $GITHUB_ENV
echo "TEMP_AWS_SESSION_TOKEN=${creds[2]}" >> $GITHUB_ENV
- name: 'Run Integration Tests'
working-directory: ${{ github.workspace }}/testframework
run: |
./gradlew --no-parallel --no-daemon test-failover --info
env:
TEST_DSN: awsmysqlodbca
TEST_USERNAME: ${{ secrets.TEST_USERNAME }}
TEST_PASSWORD: ${{ secrets.TEST_PASSWORD }}
TEST_DB_CLUSTER_IDENTIFIER: ${{ secrets.TEST_DB_CLUSTER_IDENTIFIER }}-${{ github.run_id }}-${{ github.run_attempt }}
AWS_ACCESS_KEY_ID: ${{ env.TEMP_AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ env.TEMP_AWS_SECRET_ACCESS_KEY }}
AWS_SESSION_TOKEN: ${{ env.TEMP_AWS_SESSION_TOKEN }}
DRIVER_PATH: ${{ github.workspace }}
- name: 'Get Github Action IP'
id: ip
uses: haythem/[email protected]
- name: 'Remove Github Action IP'
if: always()
run: |
aws ec2 revoke-security-group-ingress \
--group-name default \
--protocol tcp \
--port 3306 \
--cidr ${{ steps.ip.outputs.ipv4 }}/32 \
2>&1 > /dev/null;
- name: 'Display and save log'
if: always()
working-directory: ${{ github.workspace }}
run: |
echo "Displaying logs"
mkdir -p ./reports/tests
if [[ -f myodbc.log && -s myodbc.log ]]; then
cat myodbc.log
cp myodbc.log ./reports/tests/myodbc.log
fi
if [[ -f failover_performance.xlsx && -s failover_performance.xlsx ]]; then
cp failover_performance.xlsx ./reports/tests/failover_performance.xlsx
fi
if [[ -f efm_performance.xlsx && -s efm_performance.xlsx ]]; then
cp efm_performance.xlsx ./reports/tests/efm_performance.xlsx
fi
if [[ -f efm_detection_performance.xlsx && -s efm_detection_performance.xlsx ]]; then
cp efm_detection_performance.xlsx ./reports/tests/efm_detection_performance.xlsx
fi
- name: 'Archive log results'
if: always()
uses: actions/upload-artifact@v2
with:
name: 'integration-test-logs'
path: reports/tests/
retention-days: 3
- name: 'Delete Test Clusters if Ungraceful Cancel'
if: cancelled()
run: |
db_instances=($(aws rds describe-db-clusters \
--db-cluster-identifier ${{ secrets.TEST_DB_CLUSTER_IDENTIFIER }}-${{ github.run_id }}-${{ github.run_attempt }} \
--query 'DBClusters[].DBClusterMembers[].DBInstanceIdentifier' \
--output text \
| xargs));
for ((i = 0; i < ${#db_instances[@]}; i++)); \
do \
aws rds delete-db-instance \
--db-instance-identifier ${db_instances[i]} \
--skip-final-snapshot \
2>&1 > /dev/null; \
done;
aws rds delete-db-cluster \
--db-cluster-identifier ${{ secrets.TEST_DB_CLUSTER_IDENTIFIER }}-${{ github.run_id }}-${{ github.run_attempt }} \
--skip-final-snapshot \
2>&1 > /dev/null;