1+ # Copyright 2022 Google LLC
2+ #
3+ # Licensed under the Apache License, Version 2.0 (the "License");
4+ # you may not use this file except in compliance with the License.
5+ # You may obtain a copy of the License at
6+ #
7+ # http://www.apache.org/licenses/LICENSE-2.0
8+ #
9+ # Unless required by applicable law or agreed to in writing, software
10+ # distributed under the License is distributed on an "AS IS" BASIS,
11+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+ # See the License for the specific language governing permissions and
13+ # limitations under the License.
14+
15+ name : tests
16+ on :
17+ pull_request :
18+ push :
19+ branches :
20+ - main
21+ schedule :
22+ - cron : " 0 2 * * *"
23+
24+ # Declare default permissions as read only.
25+ permissions : read-all
26+
27+ jobs :
28+ unit :
29+ name : unit tests
30+ runs-on : ubuntu-latest
31+ strategy :
32+ matrix :
33+ python-version : ["3.9", "3.13"]
34+ fail-fast : false
35+ permissions :
36+ contents : read
37+ id-token : write
38+ issues : write
39+ pull-requests : write
40+ steps :
41+ - name : Checkout code
42+ uses : actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
43+
44+ - name : Setup Python ${{ matrix.python-version }}
45+ uses : actions/setup-python@42375524e23c412d93fb67b49958b491fce71c38 # v5.4.0
46+ with :
47+ python-version : ${{ matrix.python-version }}
48+
49+ - name : Install nox
50+ run : pip install nox
51+
52+ - id : auth
53+ name : Authenticate to Google Cloud
54+ # only needed for Flakybot on periodic (schedule) and continuous (push) events
55+ if : ${{ github.event_name == 'schedule' || github.event_name == 'push' }}
56+ uses : google-github-actions/auth@71f986410dfbc7added4569d411d040a91dc6935 # v2.1.8
57+ with :
58+ workload_identity_provider : ${{ vars.PROVIDER_NAME }}
59+ service_account : ${{ vars.SERVICE_ACCOUNT }}
60+ access_token_lifetime : 600s
61+
62+ - name : Run tests
63+ run : nox -s unit-${{ matrix.python-version }}
0 commit comments