-
Notifications
You must be signed in to change notification settings - Fork 4
191 lines (177 loc) · 5.32 KB
/
test-build-run.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
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
name: Callable Dqlite Jepsen tests
on:
workflow_dispatch:
inputs:
dqlite-repo:
description: 'dqlite repo'
default: 'canonical/dqlite'
dqlite-ref:
description: 'dqlite branch or ref'
default: 'master'
go-dqlite-repo:
description: 'go-dqlite repo'
default: 'canonical/go-dqlite'
go-dqlite-ref:
description: 'go-dqlite branch or ref'
default: 'master'
workloads:
description: 'Jepsen workloads as JSON, e.g. [ append, bank ]'
required: true
nemeses:
description: "Jepsen nemesis as JSON, e.g. [ 'pause,disk' ]"
required: true
disk:
description: "Enable or disable dqlite's disk-mode e.g. [ '0', '1' ]"
required: true
cli-opts:
description: 'Jepsen cli opts, e.g. --node-targets primaries'
required: false
workflow_call:
inputs:
jepsen-dqlite-repo:
type: string
required: false
default: 'canonical/jepsen.dqlite'
jepsen-dqlite-ref:
type: string
required: false
default: 'master'
jepsen-repo:
type: string
required: false
jepsen-branch:
type: string
required: false
dqlite-repo:
type: string
required: false
dqlite-ref:
type: string
required: false
go-dqlite-repo:
type: string
required: false
go-dqlite-ref:
type: string
required: false
workloads:
type: string
required: true
nemeses:
type: string
required: true
disk:
type: string
required: true
cli-opts:
type: string
required: false
env:
DQLITE_REPO: 'canonical/dqlite'
DQLITE_BRANCH: 'master'
GO_DQLITE_REPO: 'canonical/go-dqlite'
GO_DQLITE_BRANCH: 'master'
jobs:
test:
strategy:
fail-fast: false
matrix:
workload: ${{ fromJSON(inputs.workloads) }}
nemesis: ${{ fromJSON(inputs.nemeses) }}
disk: ${{ fromJSON(inputs.disk) }}
runs-on: ubuntu-22.04
container:
image: ghcr.io/canonical/jepsen-dqlite-unofficial:latest
options: --privileged
timeout-minutes: 25
steps:
- name: Checkout code
uses: actions/checkout@v3
with:
repository: ${{ inputs.jepsen-dqlite-repo || github.repository }}
ref: ${{ inputs.jepsen-dqlite-ref || github.ref }}
- name: Cache Go modules
uses: actions/cache@v3
with:
path: |
~/.cache/go-build
~/go/pkg/mod
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-
- name: Cache Jepsen (lein project) dependencies
uses: actions/cache@v3
with:
path: ~/.m2/repository
key: ${{ runner.os }}-clojure-${{ hashFiles('**/project.clj') }}
restore-keys: |
${{ runner.os }}-clojure
- name: Install local Jepsen
if: ${{ inputs.jepsen-repo && inputs.jepsen-branch }}
run: |
git clone --branch ${{ inputs.jepsen-branch }} --depth 1 ${{ inputs.jepsen-repo }}
cd jepsen/jepsen
git log -n 1
lein install
cd ../..
- name: Check out dqlite
uses: actions/checkout@v3
with:
repository: ${{ inputs.dqlite-repo || env.DQLITE_REPO }}
ref: ${{ inputs.dqlite-ref || env.DQLITE_REF }}
path: dqlite
- name: Build dqlite
run: |
cd dqlite
git log -n 1
autoreconf -i
./configure --enable-debug --enable-backtrace --enable-build-raft
make -j4
sudo make install
sudo ldconfig
- name: sysctl
run: |
sudo sysctl -w kernel.core_pattern=core
sudo sysctl -w fs.suid_dumpable=2
- name: Test
env:
LD_LIBRARY_PATH: "/usr/local/lib"
timeout-minutes: 8
run: |
export PATH="/usr/local/go/bin:$PATH"
go get golang.org/x/sync/semaphore
go get -tags libsqlite3 github.com/canonical/go-dqlite/app@master
go build -tags libsqlite3 -o resources/app resources/app.go
sudo ./resources/network.sh setup 5
if test ${{ matrix.workload }} = set; then echo 180 >time-limit; else echo 240 >time-limit; fi
lein run test --no-ssh --binary $(pwd)/resources/app \
--workload ${{ matrix.workload }} \
--nemesis ${{ matrix.nemesis }} \
--rate 100 \
--time-limit $(cat time-limit) \
--disk ${{ matrix.disk }} \
${{ inputs.cli-opts }}
sudo ./resources/network.sh teardown 5
- name: Jepsen log Summary
if: ${{ always() }}
run: tail -n 100 store/current/jepsen.log > store/current/tail-jepsen.log
- name: Summary Artifact
if: ${{ always() }}
uses: actions/upload-artifact@v3
with:
name: jepsen-data-${{ matrix.workload }}-${{ matrix.nemesis }}-summary
path: |
store/dqlite*/**/results.edn
store/dqlite*/**/latency-raw.png
store/dqlite*/**/tail-jepsen.log
!**/current/
!**/latest/
- name: Failure Artifact
if: ${{ failure() }}
uses: actions/upload-artifact@v3
with:
name: jepsen-data-${{ matrix.workload }}-${{ matrix.nemesis }}-failure
path: |
store/dqlite*
!**/current/
!**/latest/