1515name : tests
1616on :
1717 pull_request :
18+ branches :
19+ - main
1820 push :
1921 branches :
2022 - main
21- pull_request_target :
22- types : [labeled]
2323 schedule :
2424 - cron : ' 0 2 * * *'
2525
@@ -28,8 +28,6 @@ permissions: read-all
2828
2929jobs :
3030 unit :
31- # 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)
32- 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' }}"
3331 name : unit tests
3432 runs-on : ${{ matrix.os }}
3533 permissions :
4341 python-version : ["3.8", "3.12"]
4442 fail-fast : false
4543 steps :
46- - name : Remove PR label
47- if : " ${{ github.event.action == 'labeled' && github.event.label.name == 'tests: run' }}"
48- uses : actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1
49- with :
50- github-token : ${{ secrets.GITHUB_TOKEN }}
51- script : |
52- try {
53- await github.rest.issues.removeLabel({
54- name: 'tests: run',
55- owner: context.repo.owner,
56- repo: context.repo.repo,
57- issue_number: context.payload.pull_request.number
58- });
59- } catch (e) {
60- console.log('Failed to remove label. Another job may have already removed it!');
61- }
62-
6344 - name : Checkout code
6445 uses : actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
6546 with :
7859 name : Authenticate to Google Cloud
7960 uses : google-github-actions/auth@71fee32a0bb7e97b4d33d548e7d957010649d8fa # v2.1.3
8061 with :
81- workload_identity_provider : ${{ secrets .PROVIDER_NAME }}
82- service_account : ${{ secrets .SERVICE_ACCOUNT }}
62+ workload_identity_provider : ${{ vars .PROVIDER_NAME }}
63+ service_account : ${{ vars .SERVICE_ACCOUNT }}
8364 access_token_lifetime : 600s
8465
8566 - name : Run tests
10788 ./flakybot --repo ${{github.repository}} --commit_hash ${{github.sha}} --build_url https://github.com/${{github.repository}}/actions/runs/${{github.run_id}}
10889
10990 integration :
110- # 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)
111- 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' }}"
11291 name : integration tests
11392 runs-on : [self-hosted, linux, x64]
11493 strategy :
@@ -121,23 +100,6 @@ jobs:
121100 issues : write
122101 pull-requests : write
123102 steps :
124- - name : Remove PR label
125- if : " ${{ github.event.action == 'labeled' && github.event.label.name == 'tests: run' }}"
126- uses : actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1
127- with :
128- github-token : ${{ secrets.GITHUB_TOKEN }}
129- script : |
130- try {
131- await github.rest.issues.removeLabel({
132- name: 'tests: run',
133- owner: context.repo.owner,
134- repo: context.repo.repo,
135- issue_number: context.payload.pull_request.number
136- });
137- } catch (e) {
138- console.log('Failed to remove label. Another job may have already removed it!');
139- }
140-
141103 - name : Checkout code
142104 uses : actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
143105 with :
@@ -156,20 +118,20 @@ jobs:
156118 name : ' Authenticate to Google Cloud'
157119 uses : google-github-actions/auth@71fee32a0bb7e97b4d33d548e7d957010649d8fa # v2.1.3
158120 with :
159- workload_identity_provider : ${{ secrets .PROVIDER_NAME }}
160- service_account : ${{ secrets .SERVICE_ACCOUNT }}
121+ workload_identity_provider : ${{ vars .PROVIDER_NAME }}
122+ service_account : ${{ vars .SERVICE_ACCOUNT }}
161123 access_token_lifetime : 600s
162124
163125 - id : ' secrets'
164126 name : Get secrets
165127 uses : google-github-actions/get-secretmanager-secrets@dc4a1392bad0fd60aee00bb2097e30ef07a1caae # v2.1.3
166128 with :
167129 secrets : |-
168- ALLOYDB_INSTANCE_URI:${{ secrets .GOOGLE_CLOUD_PROJECT }}/ALLOYDB_INSTANCE_URI
169- ALLOYDB_CLUSTER_PASS:${{ secrets .GOOGLE_CLOUD_PROJECT }}/ALLOYDB_CLUSTER_PASS
170- ALLOYDB_IAM_USER:${{ secrets .GOOGLE_CLOUD_PROJECT }}/ALLOYDB_PYTHON_IAM_USER
171- ALLOYDB_INSTANCE_IP:${{ secrets .GOOGLE_CLOUD_PROJECT }}/ALLOYDB_INSTANCE_IP
172- ALLOYDB_PSC_INSTANCE_URI:${{ secrets .GOOGLE_CLOUD_PROJECT }}/ALLOYDB_PSC_INSTANCE_URI
130+ ALLOYDB_INSTANCE_URI:${{ vars .GOOGLE_CLOUD_PROJECT }}/ALLOYDB_INSTANCE_URI
131+ ALLOYDB_CLUSTER_PASS:${{ vars .GOOGLE_CLOUD_PROJECT }}/ALLOYDB_CLUSTER_PASS
132+ ALLOYDB_IAM_USER:${{ vars .GOOGLE_CLOUD_PROJECT }}/ALLOYDB_PYTHON_IAM_USER
133+ ALLOYDB_INSTANCE_IP:${{ vars .GOOGLE_CLOUD_PROJECT }}/ALLOYDB_INSTANCE_IP
134+ ALLOYDB_PSC_INSTANCE_URI:${{ vars .GOOGLE_CLOUD_PROJECT }}/ALLOYDB_PSC_INSTANCE_URI
173135
174136 - name : Run tests
175137 env :
@@ -181,7 +143,7 @@ jobs:
181143 ALLOYDB_INSTANCE_URI : ' ${{ steps.secrets.outputs.ALLOYDB_INSTANCE_URI }}'
182144 ALLOYDB_PSC_INSTANCE_URI : ' ${{ steps.secrets.outputs.ALLOYDB_PSC_INSTANCE_URI }}'
183145 run : nox -s system-${{ matrix.python-version }}
184-
146+
185147 - name : FlakyBot (Linux)
186148 # only run flakybot on periodic (schedule) and continuous (push) events
187149 if : ${{ (github.event_name == 'schedule' || github.event_name == 'push') && always() }}
0 commit comments