-
Notifications
You must be signed in to change notification settings - Fork 377
80 lines (66 loc) · 2.24 KB
/
test_crdb.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
---
name: Test CRDB
on:
push:
branches:
- master
pull_request:
workflow_dispatch:
permissions:
contents: read
jobs:
lint:
permissions:
contents: read # for actions/checkout to fetch code
pull-requests: read # for golangci/golangci-lint-action to fetch pull requests
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
- uses: actions/setup-go@0c52d547c9bc32b1aa3301fd7a9cb496313a4491 # v5.0.0
with:
go-version: '1.21'
check-latest: true
cache: true
- uses: golangci/golangci-lint-action@3cfe3a4abbb849e10058ce4af15d205b6da42804 # v3.7.1
with:
version: 'v1.55.1'
args: ./storage/crdb
unit-test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
- uses: actions/setup-go@0c52d547c9bc32b1aa3301fd7a9cb496313a4491 # v5.0.0
with:
go-version: '1.21'
check-latest: true
cache: true
- name: Run tests
run: go test -v ./storage/crdb/... ./quota/crdbqm/...
integration:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
- uses: actions/setup-go@0c52d547c9bc32b1aa3301fd7a9cb496313a4491 # v5.0.0
with:
go-version: '1.21'
check-latest: true
cache: true
- name: Build before tests
run: go mod download && go build ./...
- name: Run CockroachDB
run: docker run --rm -d --name=roach -p 8080:8080 -p 26257:26257 -v "${PWD}/cockroach-data:/cockroach/cockroach-data" cockroachdb/cockroach:latest start-single-node --insecure
- name: Wait for CockroachDB
uses: nick-fields/retry@7152eba30c6575329ac0576536151aca5a72780e # v3.0.0
with:
timeout_seconds: 15
max_attempts: 3
retry_on: error
command: docker exec roach ./cockroach sql --insecure -e "SELECT 1"
- name: Get crdb logs
run: docker logs roach
- name: Run tests
run: ./integration/integration_test.sh
env:
TEST_COCKROACHDB_URI: postgresql://root@localhost:26257/defaultdb?sslmode=disable
CRDB_IN_CONTAINER: true
CRDB_CONTAINER_NAME: roach