-
-
Notifications
You must be signed in to change notification settings - Fork 145
141 lines (108 loc) · 3.66 KB
/
ci.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
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
name: CI
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
paths-ignore:
- 'api/docs/**'
- 'build/charts/**'
- '**/*.md'
- '**/*.txt'
- '**/.gitignore'
env:
GO_VERSION: '1.21'
jobs:
build:
name: build
runs-on: ubuntu-latest
steps:
- name: Set up Go ${{ env.GO_VERSION }}
uses: actions/setup-go@v4
with:
go-version: ${{ env.GO_VERSION }}
- name: Setup buf action
uses: bufbuild/buf-setup-action@v1
with:
github_token: ${{ github.token }}
- name: Check out code
uses: actions/checkout@v4
- name: Get tools dependencies
run: make tools
- name: Lint
run: make lint
- name: Lint proto files
uses: bufbuild/buf-lint-action@v1
- name: Build
run: make build
- name: Stack
run: docker-compose -f build/docker/docker-compose.yml up --build -d
- name: Test
run: go test -tags integration -race -coverprofile=coverage.txt -covermode=atomic -v ./...
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v3
with:
file: ./coverage.txt
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
bench:
name: bench
runs-on: ubuntu-latest
permissions: write-all
steps:
- name: Set up Go ${{ env.GO_VERSION }}
uses: actions/setup-go@v4
with:
go-version: ${{ env.GO_VERSION }}
- name: Check out code
uses: actions/checkout@v4
- name: Get tools dependencies
run: make tools
- name: Stack
run: docker-compose -f build/docker/docker-compose.yml up --build -d
- name: Bench
run: make bench
- name: Download previous benchmark data
uses: actions/cache@v3
with:
path: ./cache
key: ${{ runner.os }}-benchmark
- name: Store benchmark result
uses: benchmark-action/github-action-benchmark@v1
if: ${{ github.event.pull_request.head.repo.full_name == github.repository }}
with:
name: Go Benchmark
tool: 'go'
output-file-path: output.txt
external-data-json-path: ./cache/benchmark-data.json
fail-on-alert: false
github-token: ${{ secrets.GITHUB_TOKEN }}
comment-always: true
sharding_test:
name: sharding_test
runs-on: ubuntu-latest
steps:
- name: Set up Go ${{ env.GO_VERSION }}
uses: actions/setup-go@v3
with:
go-version: ${{ env.GO_VERSION }}
- name: Check out code
uses: actions/checkout@v4
- name: Get tools dependencies
run: make tools
- name: Check Docker Compose Version
run: docker compose --version
- name: Run the Config server, Shard 1 and Shard 2
run: docker compose -f build/docker/sharding/docker-compose.yml up --build -d --wait config1 shard1-1 shard2-1
- name: Initialize the Config server
run: docker compose -f build/docker/sharding/docker-compose.yml exec config1 mongosh test /scripts/init-config1.js
- name: Initialize the Shard 1
run: docker compose -f build/docker/sharding/docker-compose.yml exec shard1-1 mongosh test /scripts/init-shard1-1.js
- name: Initialize the Shard 2
run: docker compose -f build/docker/sharding/docker-compose.yml exec shard2-1 mongosh test /scripts/init-shard2-1.js
- name: Run the Mongos
run: docker compose -f build/docker/sharding/docker-compose.yml up --build -d --wait mongos1
- name: Initialize the Mongos
run: docker compose -f build/docker/sharding/docker-compose.yml exec mongos1 mongosh test /scripts/init-mongos1.js
- name: Run the tests with sharding tag
run: go test -tags sharding -race -v ./test/sharding/...