-
Notifications
You must be signed in to change notification settings - Fork 97
207 lines (205 loc) · 7.25 KB
/
ci.yaml
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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
name: CI
on:
push:
branches:
- main
pull_request_target:
branches:
- main
types: [labeled]
jobs:
common:
name: common
runs-on: ubuntu-latest
if: contains(github.event.pull_request.labels.*.name, 'safe to test') || ${{ github.event_name }} == 'push'
steps:
- uses: actions/checkout@v2
with:
ref: ${{ github.event.pull_request.head.ref }}
repository: ${{github.event.pull_request.head.repo.full_name}}
- uses: actions/cache@v2
with:
path: |
~/.cargo/registry
~/.cargo/git
target
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
- uses: dtolnay/rust-toolchain@stable
with:
components: rustfmt, clippy
- name: format check
run: cargo fmt --all -- --check
- name: clippy check
run: cargo clippy -- -D warnings
- name: Setup gcloud
uses: google-github-actions/setup-gcloud@v0.6.0
with:
service_account_key: ${{ secrets.STORAGE_CREDENTIALS }}
export_default_credentials: true
- name: auth-test
run: cargo test --release --all-features --manifest-path foundation/auth/Cargo.toml
- name: gax-test
run: cargo test --release --all-features --manifest-path foundation/gax/Cargo.toml
- name: cargo-deny
uses: EmbarkStudios/cargo-deny-action@v1
with:
arguments: --workspace --all-features
pubsub:
name: pubsub
runs-on: ubuntu-latest
services:
pubsub:
image: messagebird/gcloud-pubsub-emulator:latest
ports:
- 8681:8681
env:
PUBSUB_PROJECT1: "local-project,test-topic:test-subscription,test-topic1:test-subscription1"
steps:
- uses: actions/checkout@v2
with:
ref: ${{ github.event.pull_request.head.ref }}
repository: ${{github.event.pull_request.head.repo.full_name}}
- uses: actions/cache@v2
with:
path: |
~/.cargo/registry
~/.cargo/git
target
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
- uses: dtolnay/rust-toolchain@stable
- name: test
env:
PUBSUB_EMULATOR_HOST: localhost:8681
RUSTFLAGS: "-A dead_code -A unused"
run: cargo test --release --all-features --manifest-path pubsub/Cargo.toml
spanner:
name: spanner
runs-on: ubuntu-latest
services:
spanner:
image: gcr.io/cloud-spanner-emulator/emulator
ports:
- 9020:9020
- 9010:9010
steps:
- uses: actions/checkout@v2
with:
ref: ${{ github.event.pull_request.head.ref }}
repository: ${{github.event.pull_request.head.repo.full_name}}
- uses: actions/cache@v2
with:
path: |
~/.cargo/registry
~/.cargo/git
target
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
- name: setup spanner
run: |
gcloud config configurations create emulator
gcloud config set auth/disable_credentials true
gcloud config set project local-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
- name: migration
uses: docker://mercari/wrench:1.0.4
with:
args: "create --directory spanner/tests/ddl"
env:
SPANNER_PROJECT_ID: local-project
SPANNER_INSTANCE_ID: test-instance
SPANNER_DATABASE_ID: local-database
SPANNER_EMULATOR_HOST: 172.17.0.1:9010
- uses: dtolnay/rust-toolchain@stable
- name: Setup gcloud
uses: google-github-actions/setup-gcloud@v0.6.0
with:
service_account_key: ${{ secrets.STORAGE_CREDENTIALS }}
export_default_credentials: true
- name: test
env:
SPANNER_EMULATOR_HOST: localhost:9010
RUSTFLAGS: "-A dead_code -A unused"
run: cargo test --release --all-features --manifest-path spanner/Cargo.toml
- name: test-derive
env:
SPANNER_EMULATOR_HOST: localhost:9010
RUSTFLAGS: "-A dead_code -A unused"
run: cargo test --release --all-features --manifest-path spanner-derive/Cargo.toml
storage:
name: storage
runs-on: ubuntu-latest
if: contains(github.event.pull_request.labels.*.name, 'safe to test') || ${{ github.event_name }} == 'push'
steps:
- uses: actions/checkout@v2
with:
ref: ${{ github.event.pull_request.head.ref }}
repository: ${{github.event.pull_request.head.repo.full_name}}
- name: Setup gcloud
uses: google-github-actions/setup-gcloud@v0.6.0
with:
service_account_key: ${{ secrets.STORAGE_CREDENTIALS }}
export_default_credentials: true
- uses: actions/cache@v2
with:
path: |
~/.cargo/registry
~/.cargo/git
target
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
- uses: dtolnay/rust-toolchain@stable
- name: test
env:
RUSTFLAGS: "-A dead_code -A unused"
run: cargo test --release --all-features --manifest-path storage/Cargo.toml
bigquery:
name: bigquery
runs-on: ubuntu-latest
if: contains(github.event.pull_request.labels.*.name, 'safe to test') || ${{ github.event_name }} == 'push'
steps:
- uses: actions/checkout@v2
with:
ref: ${{ github.event.pull_request.head.ref }}
repository: ${{github.event.pull_request.head.repo.full_name}}
- name: Setup gcloud
uses: google-github-actions/setup-gcloud@v0.6.0
with:
service_account_key: ${{ secrets.STORAGE_CREDENTIALS }}
export_default_credentials: true
- uses: actions/cache@v2
with:
path: |
~/.cargo/registry
~/.cargo/git
target
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
- uses: dtolnay/rust-toolchain@stable
- name: test
env:
RUSTFLAGS: "-A dead_code -A unused"
run: cargo test --release --all-features --manifest-path bigquery/Cargo.toml
artifact-registry:
name: artifact-registry
runs-on: ubuntu-latest
if: contains(github.event.pull_request.labels.*.name, 'safe to test') || ${{ github.event_name }} == 'push'
steps:
- uses: actions/checkout@v2
with:
ref: ${{ github.event.pull_request.head.ref }}
repository: ${{github.event.pull_request.head.repo.full_name}}
- name: Setup gcloud
uses: google-github-actions/setup-gcloud@v0.6.0
with:
service_account_key: ${{ secrets.STORAGE_CREDENTIALS }}
export_default_credentials: true
- uses: actions/cache@v2
with:
path: |
~/.cargo/registry
~/.cargo/git
target
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
- uses: dtolnay/rust-toolchain@stable
- name: test
env:
RUSTFLAGS: "-A dead_code -A unused"
run: cargo test --release --all-features --manifest-path artifact-registry/Cargo.toml