-
Notifications
You must be signed in to change notification settings - Fork 0
157 lines (136 loc) · 4.89 KB
/
integration-tests.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
name: Integration Tests
on:
workflow_dispatch:
inputs:
environment:
type: choice
description: 'environment to run test in'
required: true
options:
- staging
- dev
default: 'dev'
env:
TEST_INPUT: ${{ github.event.inputs.environment }}
TEST_DEFAULT: dev
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
persist-credentials: false
- name: Set up JDK
uses: actions/setup-java@v3
with:
java-version: '17'
distribution: 'temurin'
cache: 'gradle'
- name: Build integration subproject
run: ./gradlew --build-cache :integration:build
dispatch-trivy:
needs: [ build ]
runs-on: ubuntu-latest
steps:
- name: Fire off Trivy action
uses: broadinstitute/workflow-dispatch@v3
with:
workflow: Trivy
token: ${{ secrets.BROADBOT_TOKEN }}
test-env:
runs-on: ubuntu-latest
outputs:
test-env: ${{ steps.test-env.outputs.test-env }}
steps:
- name: Set default test env
id: test-env
run: |
TEST_ENV=${TEST_INPUT:-$TEST_DEFAULT}
echo "test-env=${TEST_ENV}" >> $GITHUB_OUTPUT
echo "Running tests in '${TEST_ENV}' environment"
test-runner:
needs: [ build, test-env ]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
persist-credentials: false
- name: Get the helm chart versions for the test env
run: |
curl -H 'Authorization: token ${{ secrets.BROADBOT_TOKEN }}' \
-H 'Accept: application/vnd.github.v3.raw' \
-L https://api.github.com/repos/broadinstitute/terra-helmfile/contents/versions/app/dev.yaml \
--create-dirs -o "integration/src/main/resources/rendered/dev.yaml"
curl -H 'Authorization: token ${{ secrets.BROADBOT_TOKEN }}' \
-H 'Accept: application/vnd.github.v3.raw' \
-L https://api.github.com/repos/broadinstitute/terra-helmfile/contents/environments/live/${TEST_ENV}.yaml \
--create-dirs -o "integration/src/main/resources/rendered/${TEST_ENV}.yaml"
env:
TEST_ENV: ${{ needs.test-env.outputs.test-env }}
- name: Set up JDK
uses: actions/setup-java@v3
with:
java-version: '17'
distribution: 'temurin'
cache: 'gradle'
- name: Render GitHub Secrets
run: |
echo "${{ secrets.DEV_FIRECLOUD_ACCOUNT_B64 }}" | base64 -d > "integration/src/main/resources/rendered/user-delegated-sa.json"
echo "${{ secrets.PERF_TESTRUNNER_ACCOUNT_B64 }}" | base64 -d > "integration/src/main/resources/rendered/testrunner-perf.json"
- name: Run integration test suite
run: |
./gradlew --build-cache runTest --args="suites/${TEST_ENV}/FullIntegration.json build/reports"
env:
TEST_ENV: ${{ needs.test-env.outputs.test-env }}
- name: Upload Test Reports for QA
if: always()
run: |
./gradlew --build-cache uploadResults --args="CompressDirectoryToTerraKernelK8S.json build/reports"
- name: Upload Test Reports for GitHub
if: always()
uses: actions/upload-artifact@v4
with:
name: Test Reports
path: integration/build/reports
retention-days: 7
notify-de-slack:
needs: [ build, test-env, test-runner ]
runs-on: ubuntu-latest
if: failure()
steps:
- name: "Notify Slack channel on failure"
uses: broadinstitute/[email protected]
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
STATUS: failure
with:
channel: ${{ vars.SLACK_NOTIFICATION_CHANNELS }}
status: ${{ env.STATUS }}
fields: job,ref
text: >
${{ format('Catalog test *{0}* in *{1}* {2}',
env.STATUS, needs.test-env.outputs.test-env,
env.STATUS == 'success' && ':check_green:' || ':sadpanda:') }}
username: 'Data Explorer Tests'
notify-qa-slack:
needs: [ build, test-env, test-runner ]
runs-on: ubuntu-latest
if: always() && needs.test-env.outputs.test-env != 'dev'
steps:
- name: "Always notify #dsde-qa Slack"
uses: broadinstitute/[email protected]
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
STATUS: >-
${{ needs.build.result == 'success'
&& needs.test-runner.result == 'success'
&& 'success' || 'failure' }}
with:
channel: '#dsde-qa'
status: ${{ env.STATUS }}
fields: job,ref
text: >
${{ format('Catalog test *{0}* in *{1}* {2}',
env.STATUS, needs.test-env.outputs.test-env,
env.STATUS == 'success' && ':check_green:' || ':sadpanda:') }}
username: 'Data Explorer Tests'