@@ -86,16 +86,30 @@ jobs:
8686 ALLOYDB_PASS : ' ${{ steps.secrets.outputs.ALLOYDB_CLUSTER_PASS }}'
8787 ALLOYDB_CONNECTION_NAME : ' ${{ steps.secrets.outputs.ALLOYDB_CONN_NAME }}'
8888 run : |
89- go test -v -race -cover ./tests
89+ go install github.com/jstemmer/go-junit-report/v2@latest
90+ go test -v -race -cover ./tests | tee test_results.txt
91+ go-junit-report -in test_results.txt -set-exit-code -out integration_sponge_log.xml
92+
93+ - name : FlakyBot
94+ # only run flakybot on periodic (schedule) and continuous (push) events
95+ if : ${{ (github.event_name == 'schedule' || github.event_name == 'push') && always() }}
96+ run : |
97+ curl https://github.com/googleapis/repo-automation-bots/releases/download/flakybot-1.1.0/flakybot -o flakybot -s -L
98+ chmod +x ./flakybot
99+ ./flakybot --repo ${{github.repository}} --commit_hash ${{github.sha}} --build_url https://github.com/${{github.repository}}/actions/runs/${{github.run_id}}
90100
91101 unit :
92- if : " ${{ github.event.action != 'labeled' || github.event.label.name == 'tests: run' }}"
102+ # 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)
103+ if : " ${{ (github.event.action != 'labeled' && github.event.pull_request.head.repo.full_name == github.event.pull_request.base.repo.full_name) || github.event.label.name == 'tests: run' }}"
93104 name : " unit tests"
94105 runs-on : ${{ matrix.os }}
95106 strategy :
96107 matrix :
97108 os : [macos-latest, windows-latest, ubuntu-latest]
98109 fail-fast : false
110+ permissions :
111+ contents : ' read'
112+ id-token : ' write'
99113 steps :
100114 - name : Remove PR label
101115 if : " ${{ github.event.action == 'labeled' && github.event.label.name == 'tests: run' }}"
@@ -125,6 +139,38 @@ jobs:
125139 ref : ${{ github.event.pull_request.head.sha }}
126140 repository : ${{ github.event.pull_request.head.repo.full_name }}
127141
142+ - id : ' auth'
143+ name : ' Authenticate to Google Cloud'
144+ uses : ' google-github-actions/auth@v0.8.0'
145+ with :
146+ workload_identity_provider : ${{ secrets.PROVIDER_NAME }}
147+ service_account : ${{ secrets.SERVICE_ACCOUNT }}
148+
128149 - name : Run tests
129150 run : |
130- go test -v -race -cover -short ./...
151+ go install github.com/jstemmer/go-junit-report/v2@latest
152+ go test -race -v -cover -short ./... | tee test_results.txt
153+ go-junit-report -in test_results.txt -set-exit-code -out unit_sponge_log.xml
154+
155+ - name : FlakyBot (Linux)
156+ # only run flakybot on periodic (schedule) and continuous (push) events
157+ if : ${{ (github.event_name == 'schedule' || github.event_name == 'push') && runner.os == 'Linux' && always() }}
158+ run : |
159+ curl https://github.com/googleapis/repo-automation-bots/releases/download/flakybot-1.1.0/flakybot -o flakybot -s -L
160+ chmod +x ./flakybot
161+ ./flakybot --repo ${{github.repository}} --commit_hash ${{github.sha}} --build_url https://github.com/${{github.repository}}/actions/runs/${{github.run_id}}
162+
163+ - name : FlakyBot (Windows)
164+ # only run flakybot on periodic (schedule) and continuous (push) events
165+ if : ${{ (github.event_name == 'schedule' || github.event_name == 'push') && runner.os == 'Windows' && always() }}
166+ run : |
167+ curl https://github.com/googleapis/repo-automation-bots/releases/download/flakybot-1.1.0/flakybot.exe -o flakybot.exe -s -L
168+ ./flakybot.exe --repo ${{github.repository}} --commit_hash ${{github.sha}} --build_url https://github.com/${{github.repository}}/actions/runs/${{github.run_id}}
169+
170+ - name : FlakyBot (macOS)
171+ # only run flakybot on periodic (schedule) and continuous (push) events
172+ if : ${{ (github.event_name == 'schedule' || github.event_name == 'push') && runner.os == 'macOS' && always() }}
173+ run : |
174+ curl https://github.com/googleapis/repo-automation-bots/releases/download/flakybot-1.1.0/flakybot-darwin-amd64 -o flakybot -s -L
175+ chmod +x ./flakybot
176+ ./flakybot --repo ${{github.repository}} --commit_hash ${{github.sha}} --build_url https://github.com/${{github.repository}}/actions/runs/${{github.run_id}}
0 commit comments