-
Notifications
You must be signed in to change notification settings - Fork 69
97 lines (88 loc) · 2.7 KB
/
build-and-test.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
name: CI tests
on:
- push
- pull_request
jobs:
build-and-test:
strategy:
fail-fast: false
matrix:
go:
- 1.13.x
- 1.14.x
- 1.15.x
- 1.16.x
- 1.17.x
- 1.18.x
- 1.19.x
- 1.20.x
- 1.21.x
os:
- ubuntu-20.04
- ubuntu-22.04
disk:
- 1
- 0
runs-on: ${{ matrix.os }}
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Install Go
uses: actions/setup-go@v3
with:
go-version: ${{ matrix.go }}
- name: Setup dependencies
run: |
sudo add-apt-repository ppa:dqlite/dev -y
sudo apt update
sudo apt install -y golint libsqlite3-dev libuv1-dev liblz4-dev libdqlite-dev
go get github.com/go-playground/overalls
- name: Build & Test
env:
CGO_LDFLAGS_ALLOW: "-Wl,-z,now"
run: |
go version
go get -t -tags libsqlite3 ./...
go vet -tags libsqlite3 ./...
golint
export GO_DQLITE_MULTITHREAD=1
go test -v -race -coverprofile=coverage.out ./...
go test -v -tags nosqlite3 ./...
VERBOSE=1 DISK=${{ matrix.disk }} ./test/dqlite-demo.sh
VERBOSE=1 DISK=${{ matrix.disk }} ./test/roles.sh
VERBOSE=1 DISK=${{ matrix.disk }} ./test/recover.sh
- name: Coverage
uses: coverallsapp/github-action@v2
with:
file: coverage.out
parallel: true
- name: Benchmark
env:
CGO_LDFLAGS_ALLOW: "-Wl,-z,now"
GO_DQLITE_MULTITHREAD: 1
run: |
go install -tags libsqlite3 github.com/canonical/go-dqlite/cmd/dqlite-benchmark
diskmode=$(if [ ${{ matrix.disk }} -eq 1 ]; then echo -n "--disk"; fi)
dqlite-benchmark --db 127.0.0.1:9001 --driver $diskmode --cluster 127.0.0.1:9001,127.0.0.1:9002,127.0.0.1:9003 --workload kvreadwrite &
masterpid=$!
dqlite-benchmark --db 127.0.0.1:9002 $diskmode --join 127.0.0.1:9001 &
dqlite-benchmark --db 127.0.0.1:9003 $diskmode --join 127.0.0.1:9001 &
wait $masterpid
echo "Write results:"
head -n 5 /tmp/dqlite-benchmark/127.0.0.1:9001/results/0-exec-*
echo ""
echo "Read results:"
head -n 5 /tmp/dqlite-benchmark/127.0.0.1:9001/results/0-query-*
- uses: actions/upload-artifact@v3
with:
name: dqlite-benchmark-${{ matrix.os }}-${{ matrix.go }}
path: /tmp/dqlite-benchmark/127.0.0.1:9001/results/*
finish:
needs: build-and-test
if: ${{ always() }}
runs-on: ubuntu-latest
steps:
- name: Finish coverage
uses: coverallsapp/github-action@v2
with:
parallel-finished: true