Skip to content

Commit 7f7742c

Browse files
committed
ci: reimplement cicd
Move all logic to a `Makefile` Use `Makefile` in github actions to make it easily reproducible locally
1 parent d349cc8 commit 7f7742c

11 files changed

+585
-195
lines changed
+219
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,219 @@
1+
name: Build
2+
3+
on:
4+
push:
5+
branches: [ master ]
6+
pull_request:
7+
branches: [ master ]
8+
9+
env:
10+
CARGO_TERM_COLOR: always
11+
12+
jobs:
13+
build-lint-and-unit-test:
14+
name: Build, lint and run unit tests
15+
runs-on: ubuntu-latest
16+
steps:
17+
- name: Checkout
18+
uses: actions/checkout@v4
19+
20+
- name: Install dependencies
21+
run: make install-build-dependencies
22+
23+
- name: Build integration test binary
24+
run: make build-integration-test-bin
25+
26+
- name: Check
27+
run: make check
28+
29+
- name: Run unit and proxy tests
30+
run: make run-test-unit
31+
32+
- name: Save integration test binary
33+
if: success()
34+
uses: actions/cache/save@v4
35+
id: save-integration-test-bin
36+
with:
37+
path: cassandra-integration-tests
38+
key: integration-test-bin-${{ github.sha }}
39+
40+
scylla-integration-tests:
41+
name: Scylla ITs
42+
runs-on: ubuntu-latest
43+
needs: [build-lint-and-unit-test]
44+
timeout-minutes: 90
45+
46+
strategy:
47+
matrix:
48+
scylla-version: [ENTERPRISE-RELEASE, ENTERPRISE-PRIOR-RELEASE, OSS-RELEASE, OSS-PRIOR-RELEASE]
49+
fail-fast: false
50+
51+
steps:
52+
- name: Checkout
53+
uses: actions/checkout@v4
54+
55+
- name: Setup Python 3
56+
uses: actions/setup-python@v5
57+
with:
58+
python-version: '3.11'
59+
60+
- name: Install CCM
61+
run: |
62+
make install-ccm-if-missing
63+
64+
- name: Get scylla version
65+
id: scylla-version
66+
run: |
67+
if [[ "${{ matrix.scylla-version }}" == "ENTERPRISE-RELEASE" ]]; then
68+
echo "value=$(python3 ci/version_fetch.py --version-index 1 scylla-enterprise-stable:1 | tr -d '\"')" >> $GITHUB_OUTPUT
69+
elif [[ "${{ matrix.scylla-version }}" == "ENTERPRISE-PRIOR-RELEASE" ]]; then
70+
echo "value=$(python3 ci/version_fetch.py --version-index 2 scylla-enterprise-stable:2 | tr -d '\"')" >> $GITHUB_OUTPUT
71+
elif [[ "${{ matrix.scylla-version }}" == "ENTERPRISE-RC" ]]; then
72+
echo "value=$(python3 ci/version_fetch.py --version-index 1 scylla-enterprise-rc | tr -d '\"')" >> $GITHUB_OUTPUT
73+
elif [[ "${{ matrix.scylla-version }}" == "OSS-RELEASE" ]]; then
74+
echo "value=$(python3 ci/version_fetch.py --version-index 1 scylla-oss-stable:1 | tr -d '\"')" >> $GITHUB_OUTPUT
75+
elif [[ "${{ matrix.scylla-version }}" == "OSS-PRIOR-RELEASE" ]]; then
76+
echo "value=$(python3 ci/version_fetch.py --version-index 2 scylla-oss-stable:2 | tr -d '\"')" >> $GITHUB_OUTPUT
77+
elif [[ "${{ matrix.scylla-version }}" == "OSS-RC" ]]; then
78+
echo "value=$(python3 ci/version_fetch.py --version-index 1 scylla-oss-rc | tr -d '\"')" >> $GITHUB_OUTPUT
79+
else
80+
echo "Unknown scylla version name `${{ matrix.scylla-version }}`"
81+
exit 1
82+
fi
83+
84+
- name: Pull CCM image from the cache
85+
uses: actions/cache/restore@v4
86+
id: pull-image
87+
with:
88+
path: ~/.ccm/scylla-repository
89+
key: image-scylla-${{ runner.os }}-${{ steps.scylla-version.outputs.value }}
90+
91+
- name: Download Scylla (${{ steps.scylla-version.outputs.value }}) image
92+
if: steps.pull-image.outputs.cache-hit != 'true'
93+
run: SCYLLA_VERSION="release:${{ steps.scylla-version.outputs.value }}" make download-ccm-scylla-image
94+
95+
- name: Save CCM image cache
96+
uses: actions/cache/save@v4
97+
if: steps.pull-image.outputs.cache-hit != 'true'
98+
with:
99+
path: ~/.ccm/scylla-repository
100+
key: image-scylla-${{ runner.os }}-${{ steps.scylla-version.outputs.value }}
101+
102+
- name: Pull integration test binary
103+
uses: actions/cache/restore@v4
104+
id: restore-integration-test-bin
105+
with:
106+
path: cassandra-integration-tests
107+
key: integration-test-bin-${{ github.sha }}
108+
109+
- name: Install valgrind
110+
run: make install-valgrind-if-missing
111+
112+
- name: Install binary dependencies
113+
run: make install-bin-dependencies
114+
115+
- name: Run integration tests on Scylla ${{ steps.scylla-version.outputs.value }}
116+
id: run-integration-tests
117+
run: SCYLLA_VERSION="release:${{ steps.scylla-version.outputs.value }}" make run-test-integration-scylla
118+
119+
- name: Upload test logs
120+
uses: actions/upload-artifact@v4
121+
if: steps.run-integration-tests.outcome == 'failure'
122+
with:
123+
name: test-logs-scylla-${{ matrix.scylla-version }}
124+
path: ./log/*
125+
126+
- name: Upload CCM logs
127+
uses: actions/upload-artifact@v4
128+
if: failure()
129+
with:
130+
name: ccm-log-scylla-${{ matrix.scylla-version }}
131+
path: /tmp/ccm*/ccm*/node*/logs/*
132+
133+
cassandra-integration-tests:
134+
runs-on: ubuntu-latest
135+
needs: [build-lint-and-unit-test]
136+
137+
strategy:
138+
matrix:
139+
cassandra-version: [RELEASE-3.X]
140+
java-version: [8]
141+
fail-fast: false
142+
143+
steps:
144+
- name: Checkout
145+
uses: actions/checkout@v4
146+
147+
- name: Set up JDK ${{ matrix.java-version }}
148+
uses: actions/setup-java@v4
149+
with:
150+
java-version: ${{ matrix.java-version }}
151+
distribution: 'adopt'
152+
153+
- name: Setup Python 3
154+
uses: actions/setup-python@v5
155+
with:
156+
python-version: '3.11'
157+
158+
- name: Install CCM
159+
run: make install-ccm-if-missing
160+
161+
- name: Get cassandra version
162+
id: cassandra-version
163+
run: |
164+
if [[ "${{ matrix.cassandra-version }}" == "RELEASE-3.X" ]]; then
165+
echo "value=$(python3 ci/version_fetch.py --version-index 1 cassandra3-stable:1 | tr -d '\"')" >> $GITHUB_OUTPUT
166+
elif [[ "${{ matrix.cassandra-version }}" == "RELEASE-4.X" ]]; then
167+
echo "value=$(python3 ci/version_fetch.py --version-index 1 cassandra4-stable:1 | tr -d '\"')" >> $GITHUB_OUTPUT
168+
else
169+
echo "Unknown cassandra version name `${{ matrix.cassandra-version }}`"
170+
fi
171+
172+
- name: Pull CCM image from the cache
173+
uses: actions/cache/restore@v4
174+
id: pull-image
175+
with:
176+
path: ~/.ccm/repository
177+
key: image-cassandra-${{ runner.os }}-${{ steps.cassandra-version.outputs.value }}
178+
179+
- name: Download Cassandra (${{ steps.cassandra-version.outputs.value }}) image
180+
if: steps.pull-image.outputs.cache-hit != 'true'
181+
run: CASSANDRA_VERSION="${{ steps.cassandra-version.outputs.value }}" make download-ccm-cassandra-image
182+
183+
- name: Save CCM image cache
184+
uses: actions/cache/save@v4
185+
if: steps.pull-image.outputs.cache-hit != 'true'
186+
with:
187+
path: ~/.ccm/repository
188+
key: image-cassandra-${{ runner.os }}-${{ steps.cassandra-version.outputs.value }}
189+
190+
- name: Pull integration test binary
191+
uses: actions/cache/restore@v4
192+
id: restore-integration-test-bin
193+
with:
194+
path: cassandra-integration-tests
195+
key: integration-test-bin-${{ github.sha }}
196+
197+
- name: Install valgrind
198+
run: make install-valgrind-if-missing
199+
200+
- name: Install binary dependencies
201+
run: make install-bin-dependencies
202+
203+
- name: Run integration tests on Cassandra ${{ steps.cassandra-version.outputs.value }}
204+
id: run-integration-tests
205+
run: CASSANDRA_VERSION="${{ steps.cassandra-version.outputs.value }}" make run-test-integration-cassandra
206+
207+
- name: Upload test logs
208+
uses: actions/upload-artifact@v4
209+
if: steps.run-integration-tests.outcome == 'failure'
210+
with:
211+
name: test-logs-cassandra-${{ matrix.cassandra-version }}
212+
path: ./log/*
213+
214+
- name: Upload CCM logs
215+
uses: actions/upload-artifact@v4
216+
if: failure()
217+
with:
218+
name: ccm-log-cassandra-${{ matrix.java-version }}-${{ matrix.cassandra-version }}
219+
path: /tmp/ccm*/ccm*/node*/logs/*

.github/workflows/build.yml

-67
This file was deleted.

.github/workflows/cargo_check.yml

-19
This file was deleted.

.github/workflows/cassandra.yml

-70
This file was deleted.

.github/workflows/clippy.yml

-19
This file was deleted.

0 commit comments

Comments
 (0)