forked from googleforgames/open-match-docs
-
Notifications
You must be signed in to change notification settings - Fork 0
/
cloudbuild.yaml
122 lines (105 loc) · 4.63 KB
/
cloudbuild.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
# Copyright 2019 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.
################################################################################
# Open Match Script for Google Cloud Build #
################################################################################
# To run this locally:
# cloud-build-local --config=cloudbuild.yaml --dryrun=false --substitutions=_OM_VERSION=DEV .
# To run this remotely:
# gcloud builds submit --config=cloudbuild.yaml --substitutions=_OM_VERSION=DEV .
# Requires gcloud to be installed to work. (https://cloud.google.com/sdk/)
# gcloud auth login
# gcloud components install cloud-build-local
# This YAML contains all the build steps for building Open Match.
# All PRs are verified against this script to prevent build breakages and regressions.
# Conventions
# Each build step is ID'ed with "Prefix: Description".
# The prefix portion determines what kind of step it is and it's impact.
# Docker Image: Read-Only, outputs a docker image.
# Lint: Read-Only, verifies correctness and formatting of a file.
# Build: Read-Write, outputs a build artifact. Ok to run in parallel if the artifact will not collide with another one.
# Generate: Read-Write, outputs files within /workspace that are used in other build step. Do not run these in parallel.
# Setup: Read-Write, similar to generate but steps that run before any other step.
# Some useful things to know about Cloud Build.
# The root of this repository is always stored in /workspace.
# Any modifications that occur within /workspace are persisted between builds anything else is forgotten.
# If a build step has intermediate files that need to be persisted for a future step then use volumes.
# An example of this is the go-vol which is where the pkg/ data for go mod is stored.
# More information here: https://cloud.google.com/cloud-build/docs/build-config#build_steps
# A build step is basically a docker image that is tuned for Cloud Build,
# https://github.com/GoogleCloudPlatform/cloud-builders/tree/master/go
steps:
- id: 'Docker Image: open-match-docs-build'
name: gcr.io/cloud-builders/docker
args: ['build', '-t', 'gcr.io/$PROJECT_ID/open-match-build', '-f', 'Dockerfile.ci', '.']
waitFor: ['-']
- id: 'Test: Markdown'
name: 'gcr.io/$PROJECT_ID/open-match-docs-build'
args: ['make', 'md-test']
waitFor: ['Docker Image: open-match-docs-build']
- id: 'Build: Clean'
name: 'gcr.io/$PROJECT_ID/open-match-docs-build'
args: ['make', 'clean']
waitFor: ['Docker Image: open-match-docs-build']
- id: 'Setup: Download Dependencies'
name: 'gcr.io/$PROJECT_ID/open-match-docs-build'
args: ['make', 'sync-deps']
volumes:
- name: 'go-vol'
path: '/go'
waitFor: ['Build: Clean']
- id: 'Build: Install Toolchain'
name: 'gcr.io/$PROJECT_ID/open-match-docs-build'
args: ['make', 'install-toolchain']
volumes:
- name: 'go-vol'
path: '/go'
waitFor: ['Setup: Download Dependencies']
- id: 'Lint: Format and Vet'
name: 'gcr.io/$PROJECT_ID/open-match-docs-build'
args: ['make', 'lint']
volumes:
- name: 'go-vol'
path: '/go'
waitFor: ['Setup: Download Dependencies']
- id: 'Test: Backend'
name: 'gcr.io/$PROJECT_ID/open-match-docs-build'
args: ['make', 'GOPROXY=off', 'test']
volumes:
- name: 'go-vol'
path: '/go'
waitFor: ['Lint: Format and Vet']
- id: 'Build: Website'
name: 'gcr.io/$PROJECT_ID/open-match-docs-build'
args: ['make', 'BRANCH_NAME=${BRANCH_NAME}', 'build/site/']
waitFor: ['Lint: Format and Vet']
- id: 'Test: Website'
name: 'gcr.io/$PROJECT_ID/open-match-docs-build'
args: ['make', 'site-test']
waitFor: ['Build: Website']
- id: 'Deploy: Website'
name: 'gcr.io/$PROJECT_ID/open-match-docs-build'
args: ['make', '_GCB_POST_SUBMIT=${_GCB_POST_SUBMIT}', '_GCB_LATEST_VERSION=${_GCB_LATEST_VERSION}', 'VERSION_SUFFIX=${SHORT_SHA}', 'BRANCH_NAME=${BRANCH_NAME}', 'ci-deploy-site']
waitFor: ['Test: Website']
volumes:
- name: 'go-vol'
path: '/go'
substitutions:
_OM_VERSION: "1.1.0"
_GCB_POST_SUBMIT: "0"
_GCB_LATEST_VERSION: "undefined"
logsBucket: 'gs://open-match-site-build-logs/'
options:
sourceProvenanceHash: ['SHA256']
timeout: 1200s