Skip to content

Commit 7574e68

Browse files
committed
add daily workflow
1 parent 844579c commit 7574e68

File tree

1 file changed

+265
-0
lines changed

1 file changed

+265
-0
lines changed

.github/workflows/daily.yml

+265
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,265 @@
1+
name: Daily ScalarDB cluster test
2+
3+
on:
4+
schedule:
5+
- cron: "0 10 * * *"
6+
7+
jobs:
8+
daily-cluster:
9+
name: "Daily ScalarDB cluster test"
10+
11+
runs-on: ubuntu-latest
12+
13+
strategy:
14+
fail-fast: false
15+
matrix:
16+
tests:
17+
- name: "Transfers_SI"
18+
workload: "transfer transfer-append"
19+
nemesis: "none partition packet clock crash"
20+
enable-group-commit: false
21+
isolation_level: "snapshot"
22+
consistency_model: "snapshot-isolation"
23+
# Required but not used
24+
serializable_strategy: "extra-read"
25+
- name: "Transfers_2PC_SI"
26+
workload: "transfer-2pc transfer-append-2pc"
27+
nemesis: "none partition packet clock crash"
28+
enable-group-commit: false
29+
isolation_level: "snapshot"
30+
consistency_model: "snapshot-isolation"
31+
# Required but not used
32+
serializable_strategy: "extra-read"
33+
- name: "RCSI"
34+
workload: "elle-append elle-write-read"
35+
nemesis: "none partition packet clock crash"
36+
enable-group-commit: false
37+
isolation_level: "snapshot"
38+
consistency_model: "cursor-stability"
39+
# Required but not used
40+
serializable_strategy: "extra-read"
41+
- name: "RCSI_2PC"
42+
workload: "elle-append-2pc elle-write-read-2pc"
43+
nemesis: "none partition packet clock crash"
44+
enable-group-commit: false
45+
isolation_level: "snapshot"
46+
consistency_model: "cursor-stability"
47+
# Required but not used
48+
serializable_strategy: "extra-read"
49+
- name: "Serializable_ExtraRead"
50+
workload: "elle-append elle-write-read"
51+
nemesis: "none partition packet clock crash"
52+
enable-group-commit: false
53+
isolation_level: "serializable"
54+
consistency_model: "strict-serializable"
55+
serializable_strategy: "extra-read"
56+
- name: "Serializable_ExtraWrite"
57+
workload: "elle-append elle-write-read"
58+
nemesis: "none partition packet clock crash"
59+
enable-group-commit: false
60+
isolation_level: "serializable"
61+
consistency_model: "strict-serializable"
62+
serializable_strategy: "extra-write"
63+
- name: "Serializable_2PC_ExtraRead"
64+
workload: "elle-append-2pc elle-write-read-2pc"
65+
nemesis: "none partition packet clock crash"
66+
enable-group-commit: false
67+
isolation_level: "serializable"
68+
consistency_model: "strict-serializable"
69+
serializable_strategy: "extra-read"
70+
- name: "Serializable_2PC_ExtraWrite"
71+
workload: "elle-append-2pc elle-write-read-2pc"
72+
nemesis: "none partition packet clock crash"
73+
enable-group-commit: false
74+
isolation_level: "serializable"
75+
consistency_model: "strict-serializable"
76+
serializable_strategy: "extra-write"
77+
- name: "GroupCommit"
78+
workload: "elle-append elle-write-read"
79+
nemesis: "none partition packet clock crash"
80+
enable-group-commit: true
81+
isolation_level: "serializable"
82+
consistency_model: "strict-serializable"
83+
serializable_strategy: "extra-read"
84+
85+
steps:
86+
- uses: actions/checkout@v4
87+
88+
# Need ssh to the localhost
89+
- name: Install SSH server
90+
run: |
91+
sudo apt update
92+
sudo apt install -y openssh-server
93+
94+
- name: Enable ssh for runner user
95+
run: |
96+
mkdir -p ~/.ssh
97+
chmod 700 ~/.ssh
98+
ssh-keygen -t rsa -b 2048 -f ~/.ssh/id_rsa -N ""
99+
cat ~/.ssh/id_rsa.pub >> ~/.ssh/authorized_keys
100+
chmod 600 ~/.ssh/authorized_keys
101+
sudo sed -i 's/#PasswordAuthentication yes/PasswordAuthentication no/' /etc/ssh/sshd_config
102+
sudo sed -i 's/#PubkeyAuthentication yes/PubkeyAuthentication yes/' /etc/ssh/sshd_config
103+
sudo service ssh restart
104+
105+
- name: Setup Java
106+
uses: actions/setup-java@v3
107+
with:
108+
java-version: '11'
109+
distribution: 'temurin'
110+
111+
- name: Install leiningen
112+
uses: DeLaGuardo/[email protected]
113+
with:
114+
lein: latest
115+
116+
- name: Cache m2 repository
117+
uses: actions/cache@v3
118+
with:
119+
path: ~/.m2
120+
key: ${{ runner.os }}-m2-${{ hashFiles('**/project.clj') }}
121+
restore-keys: |
122+
${{ runner.os }}-m2-
123+
124+
- name: Set up Docker
125+
uses: docker/setup-buildx-action@v3
126+
127+
- name: Set up Kind cluster
128+
uses: helm/[email protected]
129+
with:
130+
cluster_name: test-cluster
131+
132+
- name: Install MetalLB
133+
run: |
134+
kubectl apply -f https://raw.githubusercontent.com/metallb/metallb/v0.14.9/config/manifests/metallb-native.yaml
135+
kubectl wait --namespace metallb-system \
136+
--for=condition=Ready pods \
137+
--selector=app=metallb \
138+
--timeout=90s
139+
140+
NET=$(docker network inspect kind | jq -r '.[0].IPAM.Config[] | select(.Subnet | test("^fc00") | not) | .Subnet')
141+
echo "IPv4 Subnet: $NET"
142+
143+
PREFIX=$(echo "$NET" | cut -d. -f1-2)
144+
IP_RANGE="${PREFIX}.255.200-${PREFIX}.255.250"
145+
146+
cat <<EOF | kubectl apply -f -
147+
apiVersion: metallb.io/v1beta1
148+
kind: IPAddressPool
149+
metadata:
150+
name: kind-pool
151+
namespace: metallb-system
152+
spec:
153+
addresses:
154+
- $IP_RANGE
155+
---
156+
apiVersion: metallb.io/v1beta1
157+
kind: L2Advertisement
158+
metadata:
159+
name: l2adv
160+
namespace: metallb-system
161+
EOF
162+
163+
- name: Install dependencies
164+
run: |
165+
cd cassandra
166+
lein install
167+
168+
- name: ${{ matrix.tests.name }}
169+
run: |
170+
cd scalardb
171+
GROUP_COMMIT_OPT=""
172+
if [ "${{ matrix.tests.enable-group-commit }}" = "true" ]; then
173+
GROUP_COMMIT_OPT="--enable-group-commit"
174+
fi
175+
lein with-profile cluster run test \
176+
--workload ${{ matrix.tests.workload }} \
177+
--nemesis ${{ matrix.tests.nemesis }} \
178+
--isolation-level ${{ matrix.tests.isolation_level }} \
179+
--consistency-model ${{ matrix.tests.consistency_model }} \
180+
--serializable-strategy ${{ matrix.tests.serializable_strategy }} \
181+
--time-limit 600 \
182+
--nodes localhost \
183+
--db cluster \
184+
--concurrency 5 \
185+
--username runner \
186+
--ssh-private-key ~/.ssh/id_rsa \
187+
--docker-username ${{ github.repository_owner }} \
188+
--docker-access-token ${{ secrets.CR_PAT }} \
189+
$GROUP_COMMIT_OPT > /dev/null 2>&1
190+
191+
- name: Record result
192+
if: always()
193+
run: |
194+
echo "${{ matrix.tests.name }}:${{ job.status }}" >> result.txt
195+
196+
- name: Upload result
197+
uses: actions/upload-artifact@v4
198+
with:
199+
name: result-${{ matrix.tests.name }}
200+
path: result.txt
201+
202+
- name: Upload logs
203+
uses: actions/upload-artifact@v4
204+
with:
205+
name: logs-${{ matrix.tests.name }}
206+
path: scalardb/store
207+
208+
# Disable the notification until the tests work well
209+
#notify-slack:
210+
# name: Notify Slack
211+
# if: always()
212+
# needs: daily-cluster
213+
# runs-on: ubuntu-latest
214+
# steps:
215+
# - name: Install GitHub CLI
216+
# run: sudo apt-get install -y gh
217+
218+
# - name: Download result artifacts only
219+
# env:
220+
# GH_TOKEN: ${{ secrets.GH_PAT }}
221+
# run: |
222+
# mkdir -p results
223+
# gh api repos/${{ github.repository }}/actions/runs/${{ github.run_id }}/artifacts \
224+
# --jq '.artifacts[] | select(.name | startswith("result-")) | .name' | \
225+
# while read name; do
226+
# echo "Downloading $name"
227+
# gh run download ${{ github.run_id }} -n "$name" -D results
228+
# done
229+
230+
# - name: Generate Slack message
231+
# id: message
232+
# run: |
233+
# successes=""
234+
# failures=""
235+
236+
# for file in results/result-*/result.txt; do
237+
# while read -r line; do
238+
# name=$(echo "$line" | cut -d: -f1)
239+
# status=$(echo "$line" | cut -d: -f2)
240+
241+
# if [ "$status" = "success" ]; then
242+
# successes+="- $name\n"
243+
# else
244+
# failures+="- $name\n"
245+
# fi
246+
# done < "$file"
247+
# done
248+
249+
# echo "message<<EOF" >> $GITHUB_OUTPUT
250+
# echo ":white_check_mark: *ScalarDB cluster tests completed*" >> $GITHUB_OUTPUT
251+
# echo "" >> $GITHUB_OUTPUT
252+
# echo "*Success:*" >> $GITHUB_OUTPUT
253+
# echo -e "$successes" >> $GITHUB_OUTPUT
254+
# echo "" >> $GITHUB_OUTPUT
255+
# echo "*Failed:*" >> $GITHUB_OUTPUT
256+
# echo -e "$failures" >> $GITHUB_OUTPUT
257+
# echo "" >> $GITHUB_OUTPUT
258+
# echo "<https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}|View logs>" >> $GITHUB_OUTPUT
259+
# echo "EOF" >> $GITHUB_OUTPUT
260+
261+
# - name: Post to Slack
262+
# run: |
263+
# curl -X POST -H 'Content-type: application/json' \
264+
# --data "{\"text\": \"${{ steps.message.outputs.message }}\"}" \
265+
# ${{ secrets.SLACK_TOKEN }}

0 commit comments

Comments
 (0)