Skip to content

sample

sample #2915

Workflow file for this run

# 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: sample
on:
pull_request:
branches:
- main
push:
branches:
- main
schedule:
- cron: '0 2 * * *'
# Declare default permissions as read only.
permissions: read-all
jobs:
# job to run change detection
changes:
runs-on: ubuntu-latest
# Required permissions
permissions:
pull-requests: write
issues: write
# Set job outputs to values from filter step
outputs:
java: ${{ steps.filter.outputs.java }}
nodejs: ${{ steps.filter.outputs.nodejs }}
go: ${{ steps.filter.outputs.go }}
python: ${{ steps.filter.outputs.python }}
steps:
- uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4.2.1
- uses: dorny/paths-filter@de90cc6fb38fc0963ad72b210f1f284cd68cea36 # v3.0.2
id: filter
with:
filters: |
go:
- 'examples/go/**'
go:
# This ensures that the go job executes after the changes job, since it's dependent on
# that job's output.
needs: changes
if: ${{ needs.changes.outputs.go == 'true' || github.event_name == 'schedule' }}
runs-on: [self-hosted, linux, x64]
permissions:
contents: 'read'
id-token: 'write'
steps:
- name: Checkout code
uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4.2.1
with:
ref: ${{ github.event.pull_request.head.sha }}
repository: ${{ github.event.pull_request.head.repo.full_name }}
- name: Setup Go
uses: actions/setup-go@0a12ed9d6a96ab950c8f026ed9f722fe0da7ef32 # v5.0.2
with:
go-version: "1.23"
cache: false
- name: Authenticate to Google Cloud
id: 'auth'
uses: google-github-actions/auth@8254fb75a33b976a221574d287e93919e6a36f70 # v2.1.6
with:
workload_identity_provider: ${{ vars.PROVIDER_NAME }}
service_account: ${{ vars.SERVICE_ACCOUNT }}
- name: Set up Cloud SDK
uses: google-github-actions/setup-gcloud@f0990588f1e5b5af6827153b93673613abdc6ec7 # v2.1.1
- name: Get Secrets
id: 'secrets'
uses: google-github-actions/get-secretmanager-secrets@95a0b09b8348ef3d02c68c6ba5662a037e78d713 # v2.1.4
with:
secrets: |-
ALLOYDB_INSTANCE_NAME:alloydb-connector-testing/ALLOYDB_INSTANCE_NAME
ALLOYDB_CLUSTER_PASS:alloydb-connector-testing/ALLOYDB_CLUSTER_PASS
- name: Run tests
env:
DB_NAME: 'postgres'
DB_USER: 'postgres'
DB_PASS: '${{ steps.secrets.outputs.ALLOYDB_CLUSTER_PASS }}'
ALLOYDB_CONNECTION_NAME: '${{ steps.secrets.outputs.ALLOYDB_INSTANCE_NAME }}'
run: |
./examples/go/run_tests.sh