From a4d75748f8eb1d429571478a10ff7ff83375107b Mon Sep 17 00:00:00 2001 From: Dudi Zimberknopf Date: Wed, 3 Jul 2024 14:39:40 +0300 Subject: [PATCH] setup gcloud --- .github/workflows/test.yml | 23 ++++++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 72e6d5a..f6b94ec 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -1,4 +1,3 @@ - name: Run tests on: @@ -7,6 +6,9 @@ on: jobs: test: + permissions: + contents: "read" + id-token: "write" runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 @@ -14,7 +16,7 @@ jobs: - name: Set up Python uses: actions/setup-python@v5 with: - python-version: 3.x # Update with desired Python version + python-version: 3.x # Update with desired Python version - name: Cache Poetry virtualenv id: cache @@ -25,6 +27,17 @@ jobs: restore-keys: | ${{ runner.os }}-poetry- + - id: "auth" + uses: "google-github-actions/auth@v2" + with: + workload_identity_provider: ${{ secrets.WORKLOAD_IDENTITY_PROVIDER }} + service_account: ${{ secrets.SERVICE_ACCOUNT }} + + - name: "Set up Cloud SDK" + uses: "google-github-actions/setup-gcloud@v2" + with: + version: ">= 363.0.0" + - name: Install Poetry if: steps.cache.outputs.cache-hit != true run: | @@ -34,4 +47,8 @@ jobs: run: poetry install - name: Run tests - run: poetry run pytest \ No newline at end of file + env: + PROJECT_ID: ${{ secrets.PROJECT_ID }} + REGION: ${{ vars.REGION }} + OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }} + run: poetry run pytest