Skip to content

Commit f1e2be5

Browse files
committed
ci: replace version helper with get-version action
Use scylladb-actions/get-version for Scylla and Cassandra version resolution and drop the local version_fetch.py helper. Keep CCM installation on the standard pip path by exporting ~/.local/bin from the Makefile, without a repo-local CCM shim. Use a valid batch statement in the request timeout integration test for newer Scylla.
1 parent 588a850 commit f1e2be5

11 files changed

Lines changed: 139 additions & 293 deletions

File tree

.github/workflows/build-lint-and-test.yml

Lines changed: 63 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -60,64 +60,78 @@ jobs:
6060

6161
strategy:
6262
matrix:
63-
scylla-version: [ENTERPRISE-RELEASE, ENTERPRISE-PRIOR-RELEASE]
63+
scylla-version: [LATEST, PRIOR, LTS-LATEST, LTS-PRIOR]
6464
fail-fast: false
6565

6666
steps:
6767
- name: Checkout
6868
uses: actions/checkout@v4
6969

70-
- name: Setup Python 3
71-
uses: actions/setup-python@v5
72-
with:
73-
python-version: "3.11"
74-
7570
- name: Update apt cache
7671
run: sudo apt-get update -y
7772

7873
- name: Install CCM
74+
run: make install-ccm-if-missing
75+
76+
- name: Select scylla filter
77+
id: scylla-filter
7978
run: |
80-
make install-ccm-if-missing
79+
# Select the latest stable patch on each release line and drop
80+
# prerelease tags before taking the requested position.
81+
case "${{ matrix.scylla-version }}" in
82+
LATEST)
83+
printf 'value=%s\n' '^[0-9]{4}$.^[2-9][0-9]*$.LAST and *.*.^[0-9]+$ and LAST' >> "$GITHUB_OUTPUT"
84+
;;
85+
PRIOR)
86+
printf 'value=%s\n' '^[0-9]{4}$.^[2-9][0-9]*$.LAST and *.*.^[0-9]+$ and LAST-1' >> "$GITHUB_OUTPUT"
87+
;;
88+
LTS-LATEST)
89+
printf 'value=%s\n' '^[0-9]{4}$.1.LAST and *.*.^[0-9]+$ and LAST' >> "$GITHUB_OUTPUT"
90+
;;
91+
LTS-PRIOR)
92+
printf 'value=%s\n' '^[0-9]{4}$.1.LAST and *.*.^[0-9]+$ and LAST-1' >> "$GITHUB_OUTPUT"
93+
;;
94+
*)
95+
echo "Unknown scylla version name ${{ matrix.scylla-version }}"
96+
exit 1
97+
;;
98+
esac
8199
82100
- name: Get scylla version
83101
id: scylla-version
102+
uses: scylladb-actions/get-version@v0.4.5
103+
with:
104+
source: dockerhub-imagetag
105+
repo: scylladb/scylla
106+
filters: ${{ steps.scylla-filter.outputs.value }}
107+
108+
- name: Resolve scylla version
109+
id: scylla-version-value
84110
run: |
85-
if [[ "${{ matrix.scylla-version }}" == "ENTERPRISE-RELEASE" ]]; then
86-
echo "value=$(python3 ci/version_fetch.py --version-index 1 scylla-enterprise-stable:1 | tr -d '\"')" | tee -a $GITHUB_OUTPUT
87-
elif [[ "${{ matrix.scylla-version }}" == "ENTERPRISE-PRIOR-RELEASE" ]]; then
88-
echo "value=$(python3 ci/version_fetch.py --version-index 2 scylla-enterprise-stable:2 | tr -d '\"')" | tee -a $GITHUB_OUTPUT
89-
elif [[ "${{ matrix.scylla-version }}" == "ENTERPRISE-RC" ]]; then
90-
echo "value=$(python3 ci/version_fetch.py --version-index 1 scylla-enterprise-rc | tr -d '\"')" | tee -a $GITHUB_OUTPUT
91-
elif [[ "${{ matrix.scylla-version }}" == "OSS-RELEASE" ]]; then
92-
echo "value=$(python3 ci/version_fetch.py --version-index 1 scylla-oss-stable:1 | tr -d '\"')" | tee -a $GITHUB_OUTPUT
93-
elif [[ "${{ matrix.scylla-version }}" == "OSS-PRIOR-RELEASE" ]]; then
94-
echo "value=$(python3 ci/version_fetch.py --version-index 2 scylla-oss-stable:2 | tr -d '\"')" | tee -a $GITHUB_OUTPUT
95-
elif [[ "${{ matrix.scylla-version }}" == "OSS-RC" ]]; then
96-
echo "value=$(python3 ci/version_fetch.py --version-index 1 scylla-oss-rc | tr -d '\"')" | tee -a $GITHUB_OUTPUT
97-
elif echo "${{ matrix.scylla-version }}" | grep -P '^[0-9\.]+'; then # If you want to run specific version do just that
98-
echo "value=${{ matrix.scylla-version }}" | tee -a $GITHUB_OUTPUT
99-
else
100-
echo "Unknown scylla version name `${{ matrix.scylla-version }}`"
111+
value='${{ fromJson(steps.scylla-version.outputs.versions)[0] }}'
112+
if [ -z "$value" ]; then
113+
echo "No Scylla version resolved for ${{ matrix.scylla-version }}" >&2
101114
exit 1
102115
fi
116+
echo "value=$value" | tee -a "$GITHUB_OUTPUT"
103117
104118
- name: Pull CCM image from the cache
105119
uses: actions/cache/restore@v4
106120
id: pull-image
107121
with:
108122
path: ~/.ccm/scylla-repository
109-
key: image-scylla-${{ runner.os }}-${{ steps.scylla-version.outputs.value }}
123+
key: image-scylla-${{ runner.os }}-${{ steps.scylla-version-value.outputs.value }}
110124

111-
- name: Download Scylla (${{ steps.scylla-version.outputs.value }}) image
125+
- name: Download Scylla (${{ steps.scylla-version-value.outputs.value }}) image
112126
if: steps.pull-image.outputs.cache-hit != 'true'
113-
run: SCYLLA_VERSION="release:${{ steps.scylla-version.outputs.value }}" make download-ccm-scylla-image
127+
run: SCYLLA_VERSION="release:${{ steps.scylla-version-value.outputs.value }}" make download-ccm-scylla-image
114128

115129
- name: Save CCM image cache
116130
uses: actions/cache/save@v4
117131
if: steps.pull-image.outputs.cache-hit != 'true'
118132
with:
119133
path: ~/.ccm/scylla-repository
120-
key: image-scylla-${{ runner.os }}-${{ steps.scylla-version.outputs.value }}
134+
key: image-scylla-${{ runner.os }}-${{ steps.scylla-version-value.outputs.value }}
121135

122136
- name: Pull integration test binary
123137
uses: actions/cache/restore@v4
@@ -134,9 +148,9 @@ jobs:
134148
- name: Prepare environment
135149
run: make update-rust-tooling prepare-integration-test
136150

137-
- name: Run integration tests on Scylla ${{ steps.scylla-version.outputs.value }}
151+
- name: Run integration tests on Scylla ${{ steps.scylla-version-value.outputs.value }}
138152
id: run-integration-tests
139-
run: SCYLLA_VERSION="release:${{ steps.scylla-version.outputs.value }}" make run-test-integration-scylla
153+
run: SCYLLA_VERSION="release:${{ steps.scylla-version-value.outputs.value }}" make run-test-integration-scylla
140154

141155
- name: Upload test logs
142156
uses: actions/upload-artifact@v4
@@ -158,7 +172,7 @@ jobs:
158172

159173
strategy:
160174
matrix:
161-
cassandra-version: [RELEASE-3.X]
175+
cassandra-version: [3-LATEST]
162176
java-version: [8]
163177
fail-fast: false
164178

@@ -172,11 +186,6 @@ jobs:
172186
java-version: ${{ matrix.java-version }}
173187
distribution: "adopt"
174188

175-
- name: Setup Python 3
176-
uses: actions/setup-python@v5
177-
with:
178-
python-version: "3.11"
179-
180189
- name: Update apt cache
181190
run: sudo apt-get update -y
182191

@@ -185,32 +194,38 @@ jobs:
185194

186195
- name: Get cassandra version
187196
id: cassandra-version
197+
uses: scylladb-actions/get-version@v0.4.5
198+
with:
199+
source: github-tag
200+
repo: apache/cassandra
201+
prefix: cassandra-
202+
out-no-prefix: true
203+
github-token: ${{ secrets.GITHUB_TOKEN }}
204+
filters: '^[0-9]+$.^[0-9]+$.^[0-9]+$ and 3.LAST.LAST'
205+
206+
- name: Resolve cassandra version
207+
id: cassandra-version-value
188208
run: |
189-
if [[ "${{ matrix.cassandra-version }}" == "RELEASE-3.X" ]]; then
190-
echo "value=$(python3 ci/version_fetch.py --version-index 1 cassandra3-stable:1 | tr -d '\"')" | tee -a $GITHUB_OUTPUT
191-
elif [[ "${{ matrix.cassandra-version }}" == "RELEASE-4.X" ]]; then
192-
echo "value=$(python3 ci/version_fetch.py --version-index 1 cassandra4-stable:1 | tr -d '\"')" | tee -a $GITHUB_OUTPUT
193-
else
194-
echo "Unknown cassandra version name `${{ matrix.cassandra-version }}`"
195-
fi
209+
value=${{ fromJson(steps.cassandra-version.outputs.versions)[0] }}
210+
echo "value=${value#cassandra-}" | tee -a "$GITHUB_OUTPUT"
196211
197212
- name: Pull CCM image from the cache
198213
uses: actions/cache/restore@v4
199214
id: pull-image
200215
with:
201216
path: ~/.ccm/repository
202-
key: image-cassandra-${{ runner.os }}-${{ steps.cassandra-version.outputs.value }}
217+
key: image-cassandra-${{ runner.os }}-${{ steps.cassandra-version-value.outputs.value }}
203218

204-
- name: Download Cassandra (${{ steps.cassandra-version.outputs.value }}) image
219+
- name: Download Cassandra (${{ steps.cassandra-version-value.outputs.value }}) image
205220
if: steps.pull-image.outputs.cache-hit != 'true'
206-
run: CASSANDRA_VERSION="${{ steps.cassandra-version.outputs.value }}" make download-ccm-cassandra-image
221+
run: CASSANDRA_VERSION="${{ steps.cassandra-version-value.outputs.value }}" make download-ccm-cassandra-image
207222

208223
- name: Save CCM image cache
209224
uses: actions/cache/save@v4
210225
if: steps.pull-image.outputs.cache-hit != 'true'
211226
with:
212227
path: ~/.ccm/repository
213-
key: image-cassandra-${{ runner.os }}-${{ steps.cassandra-version.outputs.value }}
228+
key: image-cassandra-${{ runner.os }}-${{ steps.cassandra-version-value.outputs.value }}
214229

215230
- name: Pull integration test binary
216231
uses: actions/cache/restore@v4
@@ -227,9 +242,9 @@ jobs:
227242
- name: Prepare environment
228243
run: make update-rust-tooling prepare-integration-test
229244

230-
- name: Run integration tests on Cassandra ${{ steps.cassandra-version.outputs.value }}
245+
- name: Run integration tests on Cassandra ${{ steps.cassandra-version-value.outputs.value }}
231246
id: run-integration-tests
232-
run: CASSANDRA_VERSION="${{ steps.cassandra-version.outputs.value }}" make run-test-integration-cassandra
247+
run: CASSANDRA_VERSION="${{ steps.cassandra-version-value.outputs.value }}" make run-test-integration-cassandra
233248

234249
- name: Upload test logs
235250
uses: actions/upload-artifact@v4

CMakeLists.txt

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -304,8 +304,7 @@ set(CPACK_MONOLITHIC_INSTALL ON)
304304
set(CPACK_VERBATIM_VARIABLES ON)
305305

306306
# Normalize package output names so generated artifacts share a consistent
307-
# `scylla_cpp_driver_<version>_<platform>` family. macOS DMGs use explicit
308-
# per-component file names to avoid CPack's default `-<component>` suffix.
307+
# `scylla_cpp_driver_<version>_<platform>.{deb,rpm,pkg,msi}` pattern.
309308
set(CPACK_MONOLITHIC_INSTALL OFF)
310309
if(WIN32)
311310
set(CPACK_MONOLITHIC_INSTALL ON)
@@ -384,11 +383,7 @@ elseif(APPLE)
384383
set(CPACK_GENERATOR "productbuild;DragNDrop")
385384
set(CPACK_DMG_COMPONENT_INSTALL ON)
386385
set(CPACK_PACKAGE_FILE_NAME
387-
"${SCYLLA_DRIVER_ARTIFACT_BASE_NAME}_${PROJECT_VERSION_STRING}")
388-
set(CPACK_DMG_${SCYLLA_DRIVER_RUNTIME_COMPONENT_NAME_UPPER}_FILE_NAME
389-
"${SCYLLA_DRIVER_RUNTIME_COMPONENT_NAME}_${PROJECT_VERSION_STRING}")
390-
set(CPACK_DMG_${SCYLLA_DRIVER_DEV_COMPONENT_NAME_UPPER}_FILE_NAME
391-
"${SCYLLA_DRIVER_DEV_COMPONENT_NAME}_${PROJECT_VERSION_STRING}")
386+
"${SCYLLA_DRIVER_ARTIFACT_BASE_NAME}_${PROJECT_VERSION_STRING}_macos")
392387
set(CPACK_PRODUCTBUILD_IDENTIFIER "com.scylladb.cpp-rs-driver")
393388
set(CPACK_PRODUCTBUILD_SIGNING_IDENTITY "")
394389
set(CPACK_PRODUCTBUILD_COMPONENT_INSTALL ON)

Makefile

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ SHELL := bash
77
ifeq ($(OS),Windows_NT)
88
SHELL := pwsh.exe
99
.SHELLFLAGS := -NoProfile -Command $$ErrorActionPreference = 'Stop';
10+
else
11+
export PATH := $(HOME)/.local/bin:$(PATH)
1012
endif
1113

1214
UNAME_S := $(shell uname -s)
@@ -244,11 +246,11 @@ install-clang-format-if-missing: update-apt-cache-if-needed
244246
install-ccm-if-missing:
245247
@ccm list >/dev/null 2>&1 || (
246248
echo "CCM not found in the system, install it."
247-
pip3 install --user https://github.com/scylladb/scylla-ccm/archive/${CCM_COMMIT_ID}.zip
249+
pip3 install --user "git+https://github.com/scylladb/scylla-ccm.git@${CCM_COMMIT_ID}"
248250
)
249251

250252
install-ccm:
251-
@pip3 install --user https://github.com/scylladb/scylla-ccm/archive/${CCM_COMMIT_ID}.zip
253+
@pip3 install --user "git+https://github.com/scylladb/scylla-ccm.git@${CCM_COMMIT_ID}"
252254

253255
install-java8-if-missing:
254256
@dpkg -l openjdk-8-jre >/dev/null 2>&1 && exit 0

0 commit comments

Comments
 (0)