89
89
ALLOYDB_USER : ' postgres'
90
90
ALLOYDB_PASS : ' ${{ steps.secrets.outputs.ALLOYDB_CLUSTER_PASS }}'
91
91
ALLOYDB_URI : ' ${{ steps.secrets.outputs.ALLOYDB_URI }}'
92
+ # specifying bash shell ensures a failure in a piped process isn't lost by using `set -eo pipefail`
93
+ shell : bash
92
94
run : |
93
- go test -v -race -cover ./e2e_test.go
95
+ go test -v -race -cover ./e2e_test.go | tee test_results.txt
96
+
97
+ - name : Convert test output to XML
98
+ if : ${{ (github.event_name == 'schedule' || github.event_name == 'push') && always() }}
99
+ run : |
100
+ go install github.com/jstemmer/go-junit-report/v2@latest
101
+ go-junit-report -in test_results.txt -set-exit-code -out integration_sponge_log.xml
102
+
103
+ - name : FlakyBot
104
+ # only run flakybot on periodic (schedule) and continuous (push) events
105
+ if : ${{ (github.event_name == 'schedule' || github.event_name == 'push') && always() }}
106
+ run : |
107
+ curl https://github.com/googleapis/repo-automation-bots/releases/download/flakybot-1.1.0/flakybot -o flakybot -s -L
108
+ chmod +x ./flakybot
109
+ ./flakybot --repo ${{github.repository}} --commit_hash ${{github.sha}} --build_url https://github.com/${{github.repository}}/actions/runs/${{github.run_id}}
94
110
95
111
unit :
96
112
# run job on proper workflow event triggers (skip job for pull_request event from forks and only run pull_request_target for "tests: run" label)
@@ -106,6 +122,9 @@ jobs:
106
122
- os : macos-latest
107
123
goarch : " 386"
108
124
fail-fast : false
125
+ permissions :
126
+ contents : ' read'
127
+ id-token : ' write'
109
128
env :
110
129
GOARCH : ${{ matrix.goarch }}
111
130
steps :
@@ -137,12 +156,48 @@ jobs:
137
156
ref : ${{ github.event.pull_request.head.sha }}
138
157
repository : ${{ github.event.pull_request.head.repo.full_name }}
139
158
159
+ - id : ' auth'
160
+ name : ' Authenticate to Google Cloud'
161
+ uses : ' google-github-actions/auth@v1.0.0'
162
+ with :
163
+ workload_identity_provider : ${{ secrets.PROVIDER_NAME }}
164
+ service_account : ${{ secrets.SERVICE_ACCOUNT }}
165
+
140
166
- name : Run tests
141
167
if : matrix.goarch == ''
168
+ # specifying bash shell ensures a failure in a piped process isn't lost by using `set -eo pipefail`
169
+ shell : bash
142
170
run : |
143
- go test -v -race -cover -short ./...
171
+ go test -v -race -cover -short ./... | tee test_results.txt
144
172
- name : Run tests (386)
145
173
# 386 archs don't support race detector
146
174
if : matrix.goarch == '386'
147
175
run : |
148
176
go test -v -cover -short ./...
177
+
178
+ - name : Convert test output to XML
179
+ if : ${{ (github.event_name == 'schedule' || github.event_name == 'push') && always() && matrix.goarch == '' }}
180
+ run : |
181
+ go install github.com/jstemmer/go-junit-report/v2@latest
182
+ go-junit-report -in test_results.txt -set-exit-code -out unit_sponge_log.xml
183
+
184
+ - name : FlakyBot (Linux)
185
+ # only run flakybot on periodic (schedule) and continuous (push) events
186
+ if : ${{ (github.event_name == 'schedule' || github.event_name == 'push') && runner.os == 'Linux' && always() }}
187
+ run : |
188
+ curl https://github.com/googleapis/repo-automation-bots/releases/download/flakybot-1.1.0/flakybot -o flakybot -s -L
189
+ chmod +x ./flakybot
190
+ ./flakybot --repo ${{github.repository}} --commit_hash ${{github.sha}} --build_url https://github.com/${{github.repository}}/actions/runs/${{github.run_id}}
191
+ - name : FlakyBot (Windows)
192
+ # only run flakybot on periodic (schedule) and continuous (push) events
193
+ if : ${{ (github.event_name == 'schedule' || github.event_name == 'push') && runner.os == 'Windows' && always() }}
194
+ run : |
195
+ curl https://github.com/googleapis/repo-automation-bots/releases/download/flakybot-1.1.0/flakybot.exe -o flakybot.exe -s -L
196
+ ./flakybot.exe --repo ${{github.repository}} --commit_hash ${{github.sha}} --build_url https://github.com/${{github.repository}}/actions/runs/${{github.run_id}}
197
+ - name : FlakyBot (macOS)
198
+ # only run flakybot on periodic (schedule) and continuous (push) events
199
+ if : ${{ (github.event_name == 'schedule' || github.event_name == 'push') && runner.os == 'macOS' && always() }}
200
+ run : |
201
+ curl https://github.com/googleapis/repo-automation-bots/releases/download/flakybot-1.1.0/flakybot-darwin-amd64 -o flakybot -s -L
202
+ chmod +x ./flakybot
203
+ ./flakybot --repo ${{github.repository}} --commit_hash ${{github.sha}} --build_url https://github.com/${{github.repository}}/actions/runs/${{github.run_id}}
0 commit comments