Skip to content

Commit

Permalink
Merge branch 'main' into quickstart
Browse files Browse the repository at this point in the history
  • Loading branch information
twishabansal authored Jan 15, 2025
2 parents 9427446 + 0c3d12a commit 6eba3e1
Show file tree
Hide file tree
Showing 75 changed files with 4,359 additions and 229 deletions.
83 changes: 55 additions & 28 deletions .ci/integration.cloudbuild.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,89 +15,109 @@
steps:
- id: "install-dependencies"
name: golang:1
waitFor: ['-']
waitFor: ["-"]
env:
- 'GOPATH=/gopath'
- "GOPATH=/gopath"
volumes:
- name: 'go'
path: '/gopath'
- name: "go"
path: "/gopath"
script: |
go get -d ./...
go get -d ./...
- id: "cloud-sql-pg"
name: golang:1
waitFor: ['install-dependencies']
waitFor: ["install-dependencies"]
entrypoint: /bin/bash
env:
- 'GOPATH=/gopath'
- "GOPATH=/gopath"
- "CLOUD_SQL_POSTGRES_PROJECT=$PROJECT_ID"
- "CLOUD_SQL_POSTGRES_INSTANCE=$_CLOUD_SQL_POSTGRES_INSTANCE"
- "CLOUD_SQL_POSTGRES_DATABASE=$_DATABASE_NAME"
- "CLOUD_SQL_POSTGRES_REGION=$_REGION"
secretEnv: ["CLOUD_SQL_POSTGRES_USER", "CLOUD_SQL_POSTGRES_PASS"]
- "SERVICE_ACCOUNT_EMAIL=$SERVICE_ACCOUNT_EMAIL"
secretEnv:
["CLOUD_SQL_POSTGRES_USER", "CLOUD_SQL_POSTGRES_PASS", "CLIENT_ID"]
volumes:
- name: 'go'
path: '/gopath'
args:
- name: "go"
path: "/gopath"
args:
- -c
- |
go test -race -v -tags=integration,cloudsql ./tests
- id: "alloydb-pg"
name: golang:1
waitFor: ['install-dependencies']
waitFor: ["install-dependencies"]
entrypoint: /bin/bash
env:
- 'GOPATH=/gopath'
- "GOPATH=/gopath"
- "ALLOYDB_POSTGRES_PROJECT=$PROJECT_ID"
- "ALLOYDB_POSTGRES_CLUSTER=$_ALLOYDB_POSTGRES_CLUSTER"
- "ALLOYDB_POSTGRES_INSTANCE=$_ALLOYDB_POSTGRES_INSTANCE"
- "ALLOYDB_POSTGRES_DATABASE=$_DATABASE_NAME"
- "ALLOYDB_POSTGRES_REGION=$_REGION"
secretEnv: ["ALLOYDB_POSTGRES_USER", "ALLOYDB_POSTGRES_PASS"]
- "SERVICE_ACCOUNT_EMAIL=$SERVICE_ACCOUNT_EMAIL"
secretEnv: ["ALLOYDB_POSTGRES_USER", "ALLOYDB_POSTGRES_PASS", "CLIENT_ID"]
volumes:
- name: 'go'
path: '/gopath'
args:
- name: "go"
path: "/gopath"
args:
- -c
- |
go test -race -v -tags=integration,alloydb ./tests
- id: "postgres"
name: golang:1
waitFor: ['install-dependencies']
waitFor: ["install-dependencies"]
entrypoint: /bin/bash
env:
- 'GOPATH=/gopath'
- "GOPATH=/gopath"
- "POSTGRES_DATABASE=$_DATABASE_NAME"
- "POSTGRES_HOST=$_POSTGRES_HOST"
- "POSTGRES_PORT=$_POSTGRES_PORT"
secretEnv: ["POSTGRES_USER", "POSTGRES_PASS"]
volumes:
- name: 'go'
path: '/gopath'
args:
- name: "go"
path: "/gopath"
args:
- -c
- |
go test -race -v -tags=integration,postgres ./tests
- id: "spanner"
name: golang:1
waitFor: ['install-dependencies']
waitFor: ["install-dependencies"]
entrypoint: /bin/bash
env:
- 'GOPATH=/gopath'
- "GOPATH=/gopath"
- "SPANNER_PROJECT=$PROJECT_ID"
- "SPANNER_DATABASE=$_DATABASE_NAME"
- "SPANNER_INSTANCE=$_SPANNER_INSTANCE"
volumes:
- name: 'go'
path: '/gopath'
args:
- name: "go"
path: "/gopath"
args:
- -c
- |
go test -race -v -tags=integration,spanner ./tests
- id: "neo4j"
name: golang:1
waitFor: ["install-dependencies"]
entrypoint: /bin/bash
env:
- "GOPATH=/gopath"
- "NEO4J_DATABASE=$_NEO4J_DATABASE"
- "NEO4J_URI=$_NEO4J_URI"
secretEnv: ["NEO4J_USER", "NEO4J_PASS"]
volumes:
- name: "go"
path: "/gopath"
args:
- -c
- |
go test -race -v -tags=integration,neo4j ./tests
availableSecrets:
secretManager:
- versionName: projects/$PROJECT_ID/secrets/cloud_sql_pg_user/versions/latest
Expand All @@ -112,11 +132,17 @@ availableSecrets:
env: POSTGRES_USER
- versionName: projects/$PROJECT_ID/secrets/postgres_pass/versions/latest
env: POSTGRES_PASS
- versionName: projects/$PROJECT_ID/secrets/client_id/versions/latest
env: CLIENT_ID
- versionName: projects/$PROJECT_ID/secrets/neo4j_user/versions/latest
env: NEO4J_USER
- versionName: projects/$PROJECT_ID/secrets/neo4j_pass/versions/latest
env: NEO4J_PASS

options:
logging: CLOUD_LOGGING_ONLY
automapSubstitutions: true
substitutionOption: 'ALLOW_LOOSE'
substitutionOption: "ALLOW_LOOSE"
dynamicSubstitutions: true
pool:
name: projects/$PROJECT_ID/locations/us-central1/workerPools/integration-testing # Necessary for VPC network connection
Expand All @@ -130,3 +156,4 @@ substitutions:
_POSTGRES_HOST: 127.0.0.1
_POSTGRES_PORT: "5432"
_SPANNER_INSTANCE: "spanner-testing"
_NEO4J_DATABASE: "neo4j"
81 changes: 81 additions & 0 deletions .github/workflows/docs_deploy.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
# 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.

name: "docs"

permissions:
contents: write

on:
push:
branches:
- main
paths:
- 'docs/**'
- 'github/workflows/docs**'
- '.hugo'

# Allow triggering manually.
workflow_dispatch:

jobs:
deploy:
runs-on: ubuntu-22.04
defaults:
run:
working-directory: .hugo
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0 # Fetch all history for .GitInfo and .Lastmod

- name: Setup Hugo
uses: peaceiris/actions-hugo@v3
with:
hugo-version: "latest"
extended: true

- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: "22"

- name: Cache dependencies
uses: actions/cache@v4
with:
path: ~/.npm
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-node-
- run: npm ci
- run: hugo --minify
env:
# HUGO_BASEURL: https://${{ github.repository_owner }}.github.io/${{ github.repository }}
# While private, GitHub uses an obfuscated url instead:
HUGO_BASEURL: https://vigilant-guacamole-plnwrm9.pages.github.io/
HUGO_RELATIVEURLS: false

- name: Deploy
uses: peaceiris/actions-gh-pages@v4
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: .hugo/public
# Do not delete previews on each production deploy.
# CSS or JS changes will require manual clean-up.
keep_files: true
commit_message: "deploy: ${{ github.event.head_commit.message }}"
59 changes: 59 additions & 0 deletions .github/workflows/docs_preview_clean.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
# 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.

name: "docs"

permissions:
contents: write
pull-requests: write

# This Workflow depends on 'github.event.number',
# not compatible with branch or manual triggers.
on:
pull_request:
types:
- closed

jobs:
clean:
if: ${{ !github.event.pull_request.head.repo.fork }}
runs-on: ubuntu-24.04
concurrency:
# Shared concurrency group wih preview staging.
group: "preview-${{ github.event.number }}"
cancel-in-progress: true
steps:
- uses: actions/checkout@v4
with:
ref: gh-pages

- name: Remove Preview
run: |
rm -Rf ./previews/PR-${{ github.event.number }}
git config user.name 'github-actions[bot]'
git config user.email 'github-actions[bot]@users.noreply.github.com'
git add -u previews/PR-${{ github.event.number }}
git commit --message "cleanup: previews/PR-${{ github.event.number }}"
git push
- name: Comment
uses: actions/github-script@v7
with:
script: |
github.rest.issues.createComment({
issue_number: context.payload.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: "🧨 Preview deployments removed."
})
Loading

0 comments on commit 6eba3e1

Please sign in to comment.