From abf0e9c1fea759d1a2cf210da5554af15ee4cf75 Mon Sep 17 00:00:00 2001 From: kgala2 Date: Thu, 6 Mar 2025 17:58:49 -0800 Subject: [PATCH 1/7] chore: initial commit with sample cloudbuild file --- private.cloudbuild.yaml | 55 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 55 insertions(+) create mode 100644 private.cloudbuild.yaml diff --git a/private.cloudbuild.yaml b/private.cloudbuild.yaml new file mode 100644 index 00000000..644d9aa1 --- /dev/null +++ b/private.cloudbuild.yaml @@ -0,0 +1,55 @@ +name: Ping Instance + +on: + pull_request: + push: + branches: + - main + schedule: + - cron: "0 2 * * *" + +permissions: + contents: read + id-token: write # required for secret manager + +jobs: + ping_instance: + name: Ping Instance + runs-on: ubuntu-latest + env: + PROJECT_ID: ${{ vars.GOOGLE_CLOUD_PROJECT }} + IP_ADDRESS: ${{ vars.IP_ADDRESS }} # Required IP address + DATABASE_PORT: 3306 # Or your database port + + steps: + - id: auth + name: Authenticate to Google Cloud + uses: google-github-actions/auth@71f986410dfbc7added4569d411d040a91dc6935 # v2.1.8 + with: + workload_identity_provider: ${{ vars.PROVIDER_NAME }} + service_account: ${{ vars.SERVICE_ACCOUNT }} + access_token_lifetime: 600s + + - id: secrets + name: Get secrets + uses: google-github-actions/get-secretmanager-secrets@a8440875e1c2892062aef9061228d4f1af8f919b # v2.2.3 + with: + secrets: |- + MYSQL_CONNECTION_NAME:${{ vars.GOOGLE_CLOUD_PROJECT }}/MYSQL_CONNECTION_NAME + + - name: Download Cloud SQL Proxy + run: | + wget -O cloud-sql-proxy https://storage.googleapis.com/cloud-sql-connectors/cloud-sql-proxy/v2.13.0/cloud-sql-proxy.linux.amd64 + chmod +x cloud-sql-proxy + + - name: Ping Instance + run: | + ./cloud-sql-proxy "${{ steps.secrets.outputs.MYSQL_CONNECTION_NAME }}" --port "${{ env.DATABASE_PORT }}" & + sleep 5 + nc -zv "${{ env.IP_ADDRESS }}" "${{ env.DATABASE_PORT }}" + if [ $? -eq 0 ]; then + echo "Successfully pinged the instance!" + else + echo "Failed to ping the instance." + exit 1 + fi \ No newline at end of file From 1c7e367a3bb6856c5804fdaccb8d011686bfdd65 Mon Sep 17 00:00:00 2001 From: kgala2 Date: Wed, 19 Mar 2025 12:04:23 -0700 Subject: [PATCH 2/7] chore: update cloudbuild location --- .cl/cloudbuild.yaml | 0 private.cloudbuild.yaml | 55 ----------------------------------------- 2 files changed, 55 deletions(-) create mode 100644 .cl/cloudbuild.yaml delete mode 100644 private.cloudbuild.yaml diff --git a/.cl/cloudbuild.yaml b/.cl/cloudbuild.yaml new file mode 100644 index 00000000..e69de29b diff --git a/private.cloudbuild.yaml b/private.cloudbuild.yaml deleted file mode 100644 index 644d9aa1..00000000 --- a/private.cloudbuild.yaml +++ /dev/null @@ -1,55 +0,0 @@ -name: Ping Instance - -on: - pull_request: - push: - branches: - - main - schedule: - - cron: "0 2 * * *" - -permissions: - contents: read - id-token: write # required for secret manager - -jobs: - ping_instance: - name: Ping Instance - runs-on: ubuntu-latest - env: - PROJECT_ID: ${{ vars.GOOGLE_CLOUD_PROJECT }} - IP_ADDRESS: ${{ vars.IP_ADDRESS }} # Required IP address - DATABASE_PORT: 3306 # Or your database port - - steps: - - id: auth - name: Authenticate to Google Cloud - uses: google-github-actions/auth@71f986410dfbc7added4569d411d040a91dc6935 # v2.1.8 - with: - workload_identity_provider: ${{ vars.PROVIDER_NAME }} - service_account: ${{ vars.SERVICE_ACCOUNT }} - access_token_lifetime: 600s - - - id: secrets - name: Get secrets - uses: google-github-actions/get-secretmanager-secrets@a8440875e1c2892062aef9061228d4f1af8f919b # v2.2.3 - with: - secrets: |- - MYSQL_CONNECTION_NAME:${{ vars.GOOGLE_CLOUD_PROJECT }}/MYSQL_CONNECTION_NAME - - - name: Download Cloud SQL Proxy - run: | - wget -O cloud-sql-proxy https://storage.googleapis.com/cloud-sql-connectors/cloud-sql-proxy/v2.13.0/cloud-sql-proxy.linux.amd64 - chmod +x cloud-sql-proxy - - - name: Ping Instance - run: | - ./cloud-sql-proxy "${{ steps.secrets.outputs.MYSQL_CONNECTION_NAME }}" --port "${{ env.DATABASE_PORT }}" & - sleep 5 - nc -zv "${{ env.IP_ADDRESS }}" "${{ env.DATABASE_PORT }}" - if [ $? -eq 0 ]; then - echo "Successfully pinged the instance!" - else - echo "Failed to ping the instance." - exit 1 - fi \ No newline at end of file From 57478f4e042413097f5f6dafa1283e9b56da7f9a Mon Sep 17 00:00:00 2001 From: kgala2 Date: Wed, 19 Mar 2025 13:15:10 -0700 Subject: [PATCH 3/7] chore: update sample cloudbuild file --- .cl/cloudbuild.yaml | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/.cl/cloudbuild.yaml b/.cl/cloudbuild.yaml index e69de29b..7b634c23 100644 --- a/.cl/cloudbuild.yaml +++ b/.cl/cloudbuild.yaml @@ -0,0 +1,8 @@ +steps: + - id: ping-google + name: alpine:3.10 + entrypoint: ping + args: + - -c + - "4" + - google.com \ No newline at end of file From 7963566b9874ddf49b59ff95b75a53ffed36fd76 Mon Sep 17 00:00:00 2001 From: kgala2 Date: Wed, 19 Mar 2025 13:37:08 -0700 Subject: [PATCH 4/7] chore: test cloudbuild logging and remove tests.yaml --- .cl/cloudbuild.yaml | 4 +- .github/workflows/tests.yml | 175 ------------------------------------ 2 files changed, 3 insertions(+), 176 deletions(-) delete mode 100644 .github/workflows/tests.yml diff --git a/.cl/cloudbuild.yaml b/.cl/cloudbuild.yaml index 7b634c23..af2f6e2c 100644 --- a/.cl/cloudbuild.yaml +++ b/.cl/cloudbuild.yaml @@ -5,4 +5,6 @@ steps: args: - -c - "4" - - google.com \ No newline at end of file + - google.com +options: + logging: CLOUD_LOGGING_ONLY \ No newline at end of file diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml deleted file mode 100644 index e710138f..00000000 --- a/.github/workflows/tests.yml +++ /dev/null @@ -1,175 +0,0 @@ -# Copyright 2022 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -name: tests -on: - pull_request: - push: - branches: - - main - schedule: - - cron: "0 2 * * *" - -# Declare default permissions as read only. -permissions: read-all - -jobs: - integration: - name: integration tests - # run integration tests on all builds except pull requests from forks or dependabot - if: | - github.event_name != 'pull_request' || - (github.event.pull_request.head.repo.full_name == github.repository && github.actor != 'dependabot[bot]') - runs-on: ${{ matrix.os }} - strategy: - matrix: - os: [macos-latest, windows-latest, ubuntu-latest] - python-version: ["3.9", "3.13"] - fail-fast: false - permissions: - contents: read - id-token: write - issues: write - pull-requests: write - steps: - - name: Checkout code - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 - - - name: Setup Python ${{ matrix.python-version }} - uses: actions/setup-python@42375524e23c412d93fb67b49958b491fce71c38 # v5.4.0 - with: - python-version: ${{ matrix.python-version }} - - - name: Install nox - run: pip install nox - - - id: auth - name: Authenticate to Google Cloud - uses: google-github-actions/auth@71f986410dfbc7added4569d411d040a91dc6935 # v2.1.8 - with: - workload_identity_provider: ${{ vars.PROVIDER_NAME }} - service_account: ${{ vars.SERVICE_ACCOUNT }} - access_token_lifetime: 600s - - - id: secrets - name: Get secrets - uses: google-github-actions/get-secretmanager-secrets@a8440875e1c2892062aef9061228d4f1af8f919b # v2.2.3 - with: - secrets: |- - MYSQL_CONNECTION_NAME:${{ vars.GOOGLE_CLOUD_PROJECT }}/MYSQL_CONNECTION_NAME - MYSQL_USER:${{ vars.GOOGLE_CLOUD_PROJECT }}/MYSQL_USER - MYSQL_IAM_USER:${{ vars.GOOGLE_CLOUD_PROJECT }}/MYSQL_USER_IAM_PYTHON - MYSQL_PASS:${{ vars.GOOGLE_CLOUD_PROJECT }}/MYSQL_PASS - MYSQL_DB:${{ vars.GOOGLE_CLOUD_PROJECT }}/MYSQL_DB - POSTGRES_CONNECTION_NAME:${{ vars.GOOGLE_CLOUD_PROJECT }}/POSTGRES_CONNECTION_NAME - POSTGRES_USER:${{ vars.GOOGLE_CLOUD_PROJECT }}/POSTGRES_USER - POSTGRES_IAM_USER:${{ vars.GOOGLE_CLOUD_PROJECT }}/POSTGRES_USER_IAM_PYTHON - POSTGRES_PASS:${{ vars.GOOGLE_CLOUD_PROJECT }}/POSTGRES_PASS - POSTGRES_DB:${{ vars.GOOGLE_CLOUD_PROJECT }}/POSTGRES_DB - POSTGRES_CAS_CONNECTION_NAME:${{ vars.GOOGLE_CLOUD_PROJECT }}/POSTGRES_CAS_CONNECTION_NAME - POSTGRES_CAS_PASS:${{ vars.GOOGLE_CLOUD_PROJECT }}/POSTGRES_CAS_PASS - POSTGRES_CUSTOMER_CAS_CONNECTION_NAME:${{ vars.GOOGLE_CLOUD_PROJECT }}/POSTGRES_CUSTOMER_CAS_CONNECTION_NAME - POSTGRES_CUSTOMER_CAS_PASS:${{ vars.GOOGLE_CLOUD_PROJECT }}/POSTGRES_CUSTOMER_CAS_PASS - SQLSERVER_CONNECTION_NAME:${{ vars.GOOGLE_CLOUD_PROJECT }}/SQLSERVER_CONNECTION_NAME - SQLSERVER_USER:${{ vars.GOOGLE_CLOUD_PROJECT }}/SQLSERVER_USER - SQLSERVER_PASS:${{ vars.GOOGLE_CLOUD_PROJECT }}/SQLSERVER_PASS - SQLSERVER_DB:${{ vars.GOOGLE_CLOUD_PROJECT }}/SQLSERVER_DB - - - name: Run tests - env: - MYSQL_CONNECTION_NAME: "${{ steps.secrets.outputs.MYSQL_CONNECTION_NAME }}" - MYSQL_USER: "${{ steps.secrets.outputs.MYSQL_USER }}" - MYSQL_IAM_USER: "${{ steps.secrets.outputs.MYSQL_IAM_USER }}" - MYSQL_PASS: "${{ steps.secrets.outputs.MYSQL_PASS }}" - MYSQL_DB: "${{ steps.secrets.outputs.MYSQL_DB }}" - POSTGRES_CONNECTION_NAME: "${{ steps.secrets.outputs.POSTGRES_CONNECTION_NAME }}" - POSTGRES_USER: "${{ steps.secrets.outputs.POSTGRES_USER }}" - POSTGRES_IAM_USER: "${{ steps.secrets.outputs.POSTGRES_IAM_USER }}" - POSTGRES_PASS: "${{ steps.secrets.outputs.POSTGRES_PASS }}" - POSTGRES_DB: "${{ steps.secrets.outputs.POSTGRES_DB }}" - POSTGRES_CAS_CONNECTION_NAME: "${{ steps.secrets.outputs.POSTGRES_CAS_CONNECTION_NAME }}" - POSTGRES_CAS_PASS: "${{ steps.secrets.outputs.POSTGRES_CAS_PASS }}" - POSTGRES_CUSTOMER_CAS_CONNECTION_NAME: "${{ steps.secrets.outputs.POSTGRES_CUSTOMER_CAS_CONNECTION_NAME }}" - POSTGRES_CUSTOMER_CAS_PASS: "${{ steps.secrets.outputs.POSTGRES_CUSTOMER_CAS_PASS }}" - SQLSERVER_CONNECTION_NAME: "${{ steps.secrets.outputs.SQLSERVER_CONNECTION_NAME }}" - SQLSERVER_USER: "${{ steps.secrets.outputs.SQLSERVER_USER }}" - SQLSERVER_PASS: "${{ steps.secrets.outputs.SQLSERVER_PASS }}" - SQLSERVER_DB: "${{ steps.secrets.outputs.SQLSERVER_DB }}" - run: nox -s system-${{ matrix.python-version }} - - - name: FlakyBot (Linux) - # only run flakybot on periodic (schedule) and continuous (push) events - if: ${{ (github.event_name == 'schedule' || github.event_name == 'push') && runner.os == 'Linux' && always() }} - run: | - curl https://github.com/googleapis/repo-automation-bots/releases/download/flakybot-1.1.0/flakybot -o flakybot -s -L - chmod +x ./flakybot - ./flakybot --repo ${{github.repository}} --commit_hash ${{github.sha}} --build_url https://github.com/${{github.repository}}/actions/runs/${{github.run_id}} - - name: FlakyBot (Windows) - # only run flakybot on periodic (schedule) and continuous (push) events - if: ${{ (github.event_name == 'schedule' || github.event_name == 'push') && runner.os == 'Windows' && always() }} - run: | - curl https://github.com/googleapis/repo-automation-bots/releases/download/flakybot-1.1.0/flakybot.exe -o flakybot.exe -s -L - ./flakybot.exe --repo ${{github.repository}} --commit_hash ${{github.sha}} --build_url https://github.com/${{github.repository}}/actions/runs/${{github.run_id}} - - name: FlakyBot (macOS) - # only run flakybot on periodic (schedule) and continuous (push) events - if: ${{ (github.event_name == 'schedule' || github.event_name == 'push') && runner.os == 'macOS' && always() }} - run: | - curl https://github.com/googleapis/repo-automation-bots/releases/download/flakybot-1.1.0/flakybot-darwin-amd64 -o flakybot -s -L - chmod +x ./flakybot - ./flakybot --repo ${{github.repository}} --commit_hash ${{github.sha}} --build_url https://github.com/${{github.repository}}/actions/runs/${{github.run_id}} - - unit: - name: unit tests - runs-on: ubuntu-latest - strategy: - matrix: - python-version: ["3.9", "3.13"] - fail-fast: false - permissions: - contents: read - id-token: write - issues: write - pull-requests: write - steps: - - name: Checkout code - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 - - - name: Setup Python ${{ matrix.python-version }} - uses: actions/setup-python@42375524e23c412d93fb67b49958b491fce71c38 # v5.4.0 - with: - python-version: ${{ matrix.python-version }} - - - name: Install nox - run: pip install nox - - - id: auth - name: Authenticate to Google Cloud - # only needed for Flakybot on periodic (schedule) and continuous (push) events - if: ${{ github.event_name == 'schedule' || github.event_name == 'push' }} - uses: google-github-actions/auth@71f986410dfbc7added4569d411d040a91dc6935 # v2.1.8 - with: - workload_identity_provider: ${{ vars.PROVIDER_NAME }} - service_account: ${{ vars.SERVICE_ACCOUNT }} - access_token_lifetime: 600s - - - name: Run tests - run: nox -s unit-${{ matrix.python-version }} - - - name: FlakyBot (Linux) - # only run flakybot on periodic (schedule) and continuous (push) events - if: ${{ (github.event_name == 'schedule' || github.event_name == 'push') && runner.os == 'Linux' && always() }} - run: | - curl https://github.com/googleapis/repo-automation-bots/releases/download/flakybot-1.1.0/flakybot -o flakybot -s -L - chmod +x ./flakybot - ./flakybot --repo ${{github.repository}} --commit_hash ${{github.sha}} --build_url https://github.com/${{github.repository}}/actions/runs/${{github.run_id}} From d93b8167c6f9e4051857f9cefe427280f6b821e2 Mon Sep 17 00:00:00 2001 From: kgala2 Date: Wed, 19 Mar 2025 13:43:39 -0700 Subject: [PATCH 5/7] chore: update license header for cloudbuild yaml file --- .cl/cloudbuild.yaml | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/.cl/cloudbuild.yaml b/.cl/cloudbuild.yaml index af2f6e2c..17742b16 100644 --- a/.cl/cloudbuild.yaml +++ b/.cl/cloudbuild.yaml @@ -1,3 +1,17 @@ +# Copyright 2025 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + steps: - id: ping-google name: alpine:3.10 From e23ba5ebf4c824248ed8ae89e0745e704907ac4d Mon Sep 17 00:00:00 2001 From: kgala2 Date: Wed, 19 Mar 2025 14:25:42 -0700 Subject: [PATCH 6/7] chore: shorten tests.yaml and enable subtitutions on cloudbuild yaml --- .cl/cloudbuild.yaml | 4 +++ .github/workflows/tests.yml | 63 +++++++++++++++++++++++++++++++++++++ 2 files changed, 67 insertions(+) create mode 100644 .github/workflows/tests.yml diff --git a/.cl/cloudbuild.yaml b/.cl/cloudbuild.yaml index 17742b16..84d36712 100644 --- a/.cl/cloudbuild.yaml +++ b/.cl/cloudbuild.yaml @@ -20,5 +20,9 @@ steps: - -c - "4" - google.com + options: + dynamicSubstitutions: true + pool: + name: $_POOL_NAME logging: CLOUD_LOGGING_ONLY \ No newline at end of file diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml new file mode 100644 index 00000000..83e2dcb9 --- /dev/null +++ b/.github/workflows/tests.yml @@ -0,0 +1,63 @@ +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +name: tests +on: + pull_request: + push: + branches: + - main + schedule: + - cron: "0 2 * * *" + +# Declare default permissions as read only. +permissions: read-all + +jobs: + unit: + name: unit tests + runs-on: ubuntu-latest + strategy: + matrix: + python-version: ["3.9", "3.13"] + fail-fast: false + permissions: + contents: read + id-token: write + issues: write + pull-requests: write + steps: + - name: Checkout code + uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 + + - name: Setup Python ${{ matrix.python-version }} + uses: actions/setup-python@42375524e23c412d93fb67b49958b491fce71c38 # v5.4.0 + with: + python-version: ${{ matrix.python-version }} + + - name: Install nox + run: pip install nox + + - id: auth + name: Authenticate to Google Cloud + # only needed for Flakybot on periodic (schedule) and continuous (push) events + if: ${{ github.event_name == 'schedule' || github.event_name == 'push' }} + uses: google-github-actions/auth@71f986410dfbc7added4569d411d040a91dc6935 # v2.1.8 + with: + workload_identity_provider: ${{ vars.PROVIDER_NAME }} + service_account: ${{ vars.SERVICE_ACCOUNT }} + access_token_lifetime: 600s + + - name: Run tests + run: nox -s unit-${{ matrix.python-version }} \ No newline at end of file From f029f8b6e00c83048d66dd6059fa4feeb8d05b0c Mon Sep 17 00:00:00 2001 From: kgala2 Date: Wed, 19 Mar 2025 15:11:47 -0700 Subject: [PATCH 7/7] chore: restore tests.yaml --- .github/workflows/tests.yml | 114 +++++++++++++++++++++++++++++++++++- 1 file changed, 113 insertions(+), 1 deletion(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 83e2dcb9..e710138f 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -25,6 +25,110 @@ on: permissions: read-all jobs: + integration: + name: integration tests + # run integration tests on all builds except pull requests from forks or dependabot + if: | + github.event_name != 'pull_request' || + (github.event.pull_request.head.repo.full_name == github.repository && github.actor != 'dependabot[bot]') + runs-on: ${{ matrix.os }} + strategy: + matrix: + os: [macos-latest, windows-latest, ubuntu-latest] + python-version: ["3.9", "3.13"] + fail-fast: false + permissions: + contents: read + id-token: write + issues: write + pull-requests: write + steps: + - name: Checkout code + uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 + + - name: Setup Python ${{ matrix.python-version }} + uses: actions/setup-python@42375524e23c412d93fb67b49958b491fce71c38 # v5.4.0 + with: + python-version: ${{ matrix.python-version }} + + - name: Install nox + run: pip install nox + + - id: auth + name: Authenticate to Google Cloud + uses: google-github-actions/auth@71f986410dfbc7added4569d411d040a91dc6935 # v2.1.8 + with: + workload_identity_provider: ${{ vars.PROVIDER_NAME }} + service_account: ${{ vars.SERVICE_ACCOUNT }} + access_token_lifetime: 600s + + - id: secrets + name: Get secrets + uses: google-github-actions/get-secretmanager-secrets@a8440875e1c2892062aef9061228d4f1af8f919b # v2.2.3 + with: + secrets: |- + MYSQL_CONNECTION_NAME:${{ vars.GOOGLE_CLOUD_PROJECT }}/MYSQL_CONNECTION_NAME + MYSQL_USER:${{ vars.GOOGLE_CLOUD_PROJECT }}/MYSQL_USER + MYSQL_IAM_USER:${{ vars.GOOGLE_CLOUD_PROJECT }}/MYSQL_USER_IAM_PYTHON + MYSQL_PASS:${{ vars.GOOGLE_CLOUD_PROJECT }}/MYSQL_PASS + MYSQL_DB:${{ vars.GOOGLE_CLOUD_PROJECT }}/MYSQL_DB + POSTGRES_CONNECTION_NAME:${{ vars.GOOGLE_CLOUD_PROJECT }}/POSTGRES_CONNECTION_NAME + POSTGRES_USER:${{ vars.GOOGLE_CLOUD_PROJECT }}/POSTGRES_USER + POSTGRES_IAM_USER:${{ vars.GOOGLE_CLOUD_PROJECT }}/POSTGRES_USER_IAM_PYTHON + POSTGRES_PASS:${{ vars.GOOGLE_CLOUD_PROJECT }}/POSTGRES_PASS + POSTGRES_DB:${{ vars.GOOGLE_CLOUD_PROJECT }}/POSTGRES_DB + POSTGRES_CAS_CONNECTION_NAME:${{ vars.GOOGLE_CLOUD_PROJECT }}/POSTGRES_CAS_CONNECTION_NAME + POSTGRES_CAS_PASS:${{ vars.GOOGLE_CLOUD_PROJECT }}/POSTGRES_CAS_PASS + POSTGRES_CUSTOMER_CAS_CONNECTION_NAME:${{ vars.GOOGLE_CLOUD_PROJECT }}/POSTGRES_CUSTOMER_CAS_CONNECTION_NAME + POSTGRES_CUSTOMER_CAS_PASS:${{ vars.GOOGLE_CLOUD_PROJECT }}/POSTGRES_CUSTOMER_CAS_PASS + SQLSERVER_CONNECTION_NAME:${{ vars.GOOGLE_CLOUD_PROJECT }}/SQLSERVER_CONNECTION_NAME + SQLSERVER_USER:${{ vars.GOOGLE_CLOUD_PROJECT }}/SQLSERVER_USER + SQLSERVER_PASS:${{ vars.GOOGLE_CLOUD_PROJECT }}/SQLSERVER_PASS + SQLSERVER_DB:${{ vars.GOOGLE_CLOUD_PROJECT }}/SQLSERVER_DB + + - name: Run tests + env: + MYSQL_CONNECTION_NAME: "${{ steps.secrets.outputs.MYSQL_CONNECTION_NAME }}" + MYSQL_USER: "${{ steps.secrets.outputs.MYSQL_USER }}" + MYSQL_IAM_USER: "${{ steps.secrets.outputs.MYSQL_IAM_USER }}" + MYSQL_PASS: "${{ steps.secrets.outputs.MYSQL_PASS }}" + MYSQL_DB: "${{ steps.secrets.outputs.MYSQL_DB }}" + POSTGRES_CONNECTION_NAME: "${{ steps.secrets.outputs.POSTGRES_CONNECTION_NAME }}" + POSTGRES_USER: "${{ steps.secrets.outputs.POSTGRES_USER }}" + POSTGRES_IAM_USER: "${{ steps.secrets.outputs.POSTGRES_IAM_USER }}" + POSTGRES_PASS: "${{ steps.secrets.outputs.POSTGRES_PASS }}" + POSTGRES_DB: "${{ steps.secrets.outputs.POSTGRES_DB }}" + POSTGRES_CAS_CONNECTION_NAME: "${{ steps.secrets.outputs.POSTGRES_CAS_CONNECTION_NAME }}" + POSTGRES_CAS_PASS: "${{ steps.secrets.outputs.POSTGRES_CAS_PASS }}" + POSTGRES_CUSTOMER_CAS_CONNECTION_NAME: "${{ steps.secrets.outputs.POSTGRES_CUSTOMER_CAS_CONNECTION_NAME }}" + POSTGRES_CUSTOMER_CAS_PASS: "${{ steps.secrets.outputs.POSTGRES_CUSTOMER_CAS_PASS }}" + SQLSERVER_CONNECTION_NAME: "${{ steps.secrets.outputs.SQLSERVER_CONNECTION_NAME }}" + SQLSERVER_USER: "${{ steps.secrets.outputs.SQLSERVER_USER }}" + SQLSERVER_PASS: "${{ steps.secrets.outputs.SQLSERVER_PASS }}" + SQLSERVER_DB: "${{ steps.secrets.outputs.SQLSERVER_DB }}" + run: nox -s system-${{ matrix.python-version }} + + - name: FlakyBot (Linux) + # only run flakybot on periodic (schedule) and continuous (push) events + if: ${{ (github.event_name == 'schedule' || github.event_name == 'push') && runner.os == 'Linux' && always() }} + run: | + curl https://github.com/googleapis/repo-automation-bots/releases/download/flakybot-1.1.0/flakybot -o flakybot -s -L + chmod +x ./flakybot + ./flakybot --repo ${{github.repository}} --commit_hash ${{github.sha}} --build_url https://github.com/${{github.repository}}/actions/runs/${{github.run_id}} + - name: FlakyBot (Windows) + # only run flakybot on periodic (schedule) and continuous (push) events + if: ${{ (github.event_name == 'schedule' || github.event_name == 'push') && runner.os == 'Windows' && always() }} + run: | + curl https://github.com/googleapis/repo-automation-bots/releases/download/flakybot-1.1.0/flakybot.exe -o flakybot.exe -s -L + ./flakybot.exe --repo ${{github.repository}} --commit_hash ${{github.sha}} --build_url https://github.com/${{github.repository}}/actions/runs/${{github.run_id}} + - name: FlakyBot (macOS) + # only run flakybot on periodic (schedule) and continuous (push) events + if: ${{ (github.event_name == 'schedule' || github.event_name == 'push') && runner.os == 'macOS' && always() }} + run: | + curl https://github.com/googleapis/repo-automation-bots/releases/download/flakybot-1.1.0/flakybot-darwin-amd64 -o flakybot -s -L + chmod +x ./flakybot + ./flakybot --repo ${{github.repository}} --commit_hash ${{github.sha}} --build_url https://github.com/${{github.repository}}/actions/runs/${{github.run_id}} + unit: name: unit tests runs-on: ubuntu-latest @@ -60,4 +164,12 @@ jobs: access_token_lifetime: 600s - name: Run tests - run: nox -s unit-${{ matrix.python-version }} \ No newline at end of file + run: nox -s unit-${{ matrix.python-version }} + + - name: FlakyBot (Linux) + # only run flakybot on periodic (schedule) and continuous (push) events + if: ${{ (github.event_name == 'schedule' || github.event_name == 'push') && runner.os == 'Linux' && always() }} + run: | + curl https://github.com/googleapis/repo-automation-bots/releases/download/flakybot-1.1.0/flakybot -o flakybot -s -L + chmod +x ./flakybot + ./flakybot --repo ${{github.repository}} --commit_hash ${{github.sha}} --build_url https://github.com/${{github.repository}}/actions/runs/${{github.run_id}}