-
Notifications
You must be signed in to change notification settings - Fork 31
185 lines (169 loc) · 6.05 KB
/
dst.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
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
name: DST
on:
workflow_dispatch:
inputs:
seed:
description: "seed"
type: number
ticks:
description: "ticks"
type: number
schedule:
- cron: "0 * * * *" # every hour
permissions:
contents: read
issues: write
jobs:
build:
runs-on: ubuntu-22.04
steps:
- name: Check out repository
uses: actions/checkout@v4
- name: Install Nix
uses: DeterminateSystems/nix-installer-action@v14
- name: Use Magic Nix Cache
uses: DeterminateSystems/magic-nix-cache-action@v8
- name: Build resonate binary
run: |
nix build ".#resonate"
cp ./result/bin/resonate resonate
- name: Cache resonate binary
uses: actions/cache/save@v4
with:
path: resonate
key: resonate-${{ github.sha }}
values:
runs-on: ubuntu-22.04
steps:
- id: seed
name: Set random seed
run: echo seed=$RANDOM >> $GITHUB_OUTPUT
outputs:
seed: ${{ inputs.seed || steps.seed.outputs.seed }}
ticks: ${{ inputs.ticks || 1000 }}
dst:
runs-on: ubuntu-22.04
needs: [build, values]
timeout-minutes: 150
strategy:
fail-fast: false
matrix:
scenario: [default, fault, lazy]
store: [sqlite, postgres]
run: [1, 2]
env:
DST_AIO_SUBSYSTEMS_STOREPOSTGRES_CONFIG_HOST: "localhost"
DST_AIO_SUBSYSTEMS_STOREPOSTGRES_CONFIG_PORT: "5432"
DST_AIO_SUBSYSTEMS_STOREPOSTGRES_CONFIG_USERNAME: "username"
DST_AIO_SUBSYSTEMS_STOREPOSTGRES_CONFIG_PASSWORD: "password"
DST_AIO_SUBSYSTEMS_STOREPOSTGRES_CONFIG_DATABASE: "resonate_dst"
services:
postgres:
# workaround to conditionally start the service
# an empty string will skip starting the service
# see: https://github.com/actions/runner/issues/822
image: ${{ matrix.store == 'postgres' && 'postgres:15' || '' }}
env:
POSTGRES_USER: ${{ env.DST_AIO_SUBSYSTEMS_STOREPOSTGRES_CONFIG_USERNAME }}
POSTGRES_PASSWORD: ${{ env.DST_AIO_SUBSYSTEMS_STOREPOSTGRES_CONFIG_PASSWORD }}
POSTGRES_DB: ${{ env.DST_AIO_SUBSYSTEMS_STOREPOSTGRES_CONFIG_DATABASE }}
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
ports:
- 5432:5432
steps:
- name: Restore resonate binary
uses: actions/cache/restore@v4
with:
path: resonate
key: resonate-${{ github.sha }}
fail-on-cache-miss: true
- name: Run dst (seed=${{ needs.values.outputs.seed }}, ticks=${{ needs.values.outputs.ticks }}, scenario=${{ matrix.scenario }}, store=${{ matrix.store }})
run: |
./resonate dst run \
--seed ${{ needs.values.outputs.seed }} \
--ticks ${{ needs.values.outputs.ticks }} \
--timeout 2h \
--scenario ${{ matrix.scenario }} \
--aio-store-${{ matrix.store }}-enable true \
> logs.txt 2>&1
- name: Create issue if dst failed
env:
GITHUB_TOKEN: ${{ secrets.github_token }}
if: ${{ failure() && matrix.run == 1 }}
run: |
./resonate dst issue \
--seed ${{ needs.values.outputs.seed }} \
--ticks ${{ needs.values.outputs.ticks }} \
--scenario ${{ matrix.scenario }} \
--store ${{ matrix.store }} \
--reason "DST run failed for seed=${{ needs.values.outputs.seed }}, ticks=${{ needs.values.outputs.ticks }}, scenario=${{ matrix.scenario }}, store=${{ matrix.store }}." \
--file logs.txt \
--repo $GITHUB_REPOSITORY \
--commit $GITHUB_SHA \
--url $GITHUB_SERVER_URL/$GITHUB_REPOSITORY/actions/runs/$GITHUB_RUN_ID
- uses: actions/upload-artifact@v4
if: ${{ always() }}
with:
name: ${{ matrix.scenario }}-${{ matrix.store }}-${{ matrix.run }}-logs
path: logs.txt
- uses: actions/upload-artifact@v4
if: ${{ always() && matrix.scenario != 'fault' }}
with:
name: ${{ matrix.scenario }}-${{ matrix.store }}-${{ matrix.run }}-visualization
path: dst.html
diff:
runs-on: ubuntu-22.04
needs: [build, values, dst]
strategy:
fail-fast: false
matrix:
scenario: [default, fault, lazy]
store: [sqlite, postgres, sqlite/postgres]
include:
- store: sqlite
logs1: sqlite-1-logs
logs2: sqlite-2-logs
- store: postgres
logs1: postgres-1-logs
logs2: postgres-2-logs
- store: sqlite/postgres
logs1: sqlite-1-logs
logs2: postgres-1-logs
steps:
- name: Restore resonate binary
uses: actions/cache/restore@v4
with:
path: resonate
key: resonate-${{ github.sha }}
fail-on-cache-miss: true
- name: Download logs from run 1
uses: actions/download-artifact@v4
with:
name: ${{ matrix.scenario }}-${{ matrix.logs1 }}
path: logs-1.txt
- name: Download logs from run 2
uses: actions/download-artifact@v4
with:
name: ${{ matrix.scenario }}-${{ matrix.logs2 }}
path: logs-2.txt
- name: Diff
run: |
diff logs-1.txt logs-2.txt
- name: Create issue if diff
env:
GITHUB_TOKEN: ${{ secrets.github_token }}
if: ${{ failure() }}
run: |
./resonate dst issue \
--seed ${{ needs.values.outputs.seed }} \
--ticks ${{ needs.values.outputs.ticks }} \
--scenario ${{ matrix.scenario }} \
--store ${{ matrix.store }} \
--reason "Two DST runs produced different results for seed=${{ needs.values.outputs.seed }}, ticks=${{ needs.values.outputs.ticks }}, scenario=${{ matrix.scenario }}, store=${{ matrix.store }}." \
--repo $GITHUB_REPOSITORY \
--commit $GITHUB_SHA \
--url $GITHUB_SERVER_URL/$GITHUB_REPOSITORY/actions/runs/$GITHUB_RUN_ID