Skip to content

Commit bc47037

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 24fd7d1 commit bc47037

File tree

9 files changed

+623
-196
lines changed

9 files changed

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

.github/workflows/build.yml

-68
This file was deleted.

.github/workflows/cargo_check.yml

-19
This file was deleted.

.github/workflows/cassandra.yml

-71
This file was deleted.

0 commit comments

Comments
 (0)