-
Notifications
You must be signed in to change notification settings - Fork 4
40 lines (35 loc) · 1.27 KB
/
main.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
name: main
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
jobs:
build:
name: Build
if: "!contains(github.event.commits[0].message, 'ci skip')"
runs-on: ubuntu-latest
services:
emulator:
image: gcr.io/cloud-spanner-emulator/emulator
ports:
- 9010:9010
- 9020:9020
steps:
- uses: actions/checkout@v4
- name: Setup Go
uses: actions/setup-go@v4
with:
go-version: '1.21'
- name: Test using emulator
run: |
curl -O https://dl.google.com/dl/cloudsdk/channels/rapid/downloads/google-cloud-sdk-400.0.0-linux-x86_64.tar.gz
tar xvzf google-cloud-sdk-400.0.0-linux-x86_64.tar.gz && ./google-cloud-sdk/install.sh --quiet
gcloud config configurations create emulator
gcloud config set auth/disable_credentials true
gcloud config set project test-project
gcloud config set api_endpoint_overrides/spanner http://localhost:9020/
gcloud spanner instances create test-instance --config=emulator-config --description="Test Instance" --nodes=1
export SPANNER_EMULATOR_HOST=localhost:9010
gcloud spanner databases create testdb --instance=test-instance --ddl-file=$PWD/testdata/emuddl.sql
go test -v -run TestBasic