155 lines (151 loc) · 4.84 KB
/
build.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
---
name: "Build & Test"
on:
push:
branches:
- "main"
paths:
- ".github/workflows/build.yaml"
- "buf.gen.yaml"
- "buf.work.yaml"
- "Dockerfile"
- "go.mod"
- "go.sum"
- "cmd/**"
- "pkg/**"
- "internal/**"
- "proto/**"
pull_request:
branches:
- "*"
paths:
- ".github/workflows/build.yaml"
- "buf.gen.yaml"
- "buf.work.yaml"
- "Dockerfile"
- "go.mod"
- "go.sum"
- "cmd/**"
- "pkg/**"
- "internal/**"
- "proto/**"
jobs:
test:
name: "Test"
runs-on: "ubuntu-latest"
steps:
- uses: "actions/checkout@v2"
- uses: "actions/setup-go@v2"
with:
go-version: "^1.17"
- name: "Build"
run: "go build ./cmd/..."
- name: "Test"
run: "go test ./..."
- name: "Full Datastore Integration Tests"
run: "go test -tags ci ./..."
e2e:
# Explicitly disabling e2e testing
if: "false"
name: "E2E"
runs-on: "ubuntu-latest"
steps:
- uses: "actions/checkout@v2"
- uses: "actions/setup-go@v2"
with:
go-version: "^1.16"
- name: "Cache Binaries"
id: "cache-binaries"
uses: "actions/cache@v2"
with:
path: |
e2e/newenemy/cockroach
e2e/newenemy/chaosd
e2e/newenemy/watchmaker
# this key will need to be bumped when dependencies are changed
key: "cockroach-v21.1.7-chaosd-v1.0.2-2"
- name: "Install cockroachdb and chaosd"
if: "steps.cache-binaries.outputs.cache-hit != 'true'"
run: |
pushd e2e/newenemy
curl https://binaries.cockroachdb.com/cockroach-v21.1.7.linux-amd64.tgz | tar -xz && mv cockroach-v21.1.7.linux-amd64/cockroach ./cockroach
curl -fsSL https://mirrors.chaos-mesh.org/chaosd-v1.0.2-linux-amd64.tar.gz | tar -xz && mv chaosd-v1.0.2-linux-amd64/chaosd ./chaosd
# chaosd doesn't yet include time modification, install it separately
git clone https://github.com/chaos-mesh/chaos-mesh/
pushd chaos-mesh
git reset --hard 72d2bc17febc7f2a4a10c97417f11c5eb1d86a13
CGO_ENABLED=1 go build ./cmd/watchmaker/
popd
mv ./chaos-mesh/watchmaker ./watchmaker
popd
- uses: "actions/cache@v2"
with:
path: |
~/.cache/go-build
~/go/pkg/mod
key: "${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}"
restore-keys: |
${{ runner.os }}-go-
- name: "Build SpiceDB"
working-directory: "e2e/newenemy"
run: |
go get -d github.com/authzed/spicedb/cmd/spicedb/...
go build github.com/authzed/spicedb/cmd/spicedb/...
- name: "Run e2e"
working-directory: "e2e/newenemy"
run: |
go test -v -timeout 30m ./...
- uses: "actions/upload-artifact@v2"
if: "always()"
# this upload step is really flaky, don't fail the job if it fails
continue-on-error: true
with:
name: "node-logs"
path: "e2e/newenemy/*.log"
protobuf:
name: "Generate Protobufs"
runs-on: "ubuntu-latest"
steps:
- uses: "actions/checkout@v2"
- uses: "actions/setup-go@v2"
with:
go-version: "^1.17"
- name: "Install Go Protobuf plugins"
run: |
go install google.golang.org/protobuf/cmd/protoc-gen-go@v1.26
go install google.golang.org/grpc/cmd/protoc-gen-go-grpc@v1.1
go install github.com/envoyproxy/protoc-gen-validate@v0.6.1
- uses: "bufbuild/buf-setup-action@v0.6.0"
with:
version: "1.0.0-rc8"
- name: "Generate & Diff Protos"
run: "./buf.gen.yaml && git diff && bash -c '[ $(git status --porcelain | tee /dev/fd/2 | wc -c) -eq 0 ]'"
- uses: "bufbuild/buf-breaking-action@v0.4.0"
if: "github.event_name == 'pull_request'"
env:
BUF_INPUT_HTTPS_USERNAME: "${{ github.actor }}"
BUF_INPUT_HTTPS_PASSWORD: "${{ github.token }}"
with:
input: "proto/internal"
against: "https://github.com/authzed/spicedb.git#branch=main,subdir=proto/internal"
buf_token: "${{ secrets.BUF_REGISTRY_TOKEN }}"
image-build:
name: "Verify Image"
runs-on: "ubuntu-latest"
steps:
- name: "Check out the repo"
uses: "actions/checkout@v2"
- uses: "docker/setup-qemu-action@v1"
- uses: "docker/setup-buildx-action@v1"
with:
driver-opts: "image=moby/buildkit:master"
- name: "Build the container image"
uses: "docker/build-push-action@v1"
with:
push: false
tags: "latest"
- uses: "actions/setup-go@v2"
with:
go-version: "^1.17"
- name: "Test with image"
run: "go test -tags docker cmd/spicedb/*_test.go"