Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
111 changes: 63 additions & 48 deletions .github/workflows/build-lint-and-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -60,64 +60,78 @@ jobs:

strategy:
matrix:
scylla-version: [ENTERPRISE-RELEASE, ENTERPRISE-PRIOR-RELEASE]
scylla-version: [LATEST, PRIOR, LTS-LATEST, LTS-PRIOR]
fail-fast: false

steps:
- name: Checkout
uses: actions/checkout@v4

- name: Setup Python 3
uses: actions/setup-python@v5
with:
python-version: "3.11"

- name: Update apt cache
run: sudo apt-get update -y

- name: Install CCM
run: make install-ccm-if-missing

- name: Select scylla filter
id: scylla-filter
run: |
make install-ccm-if-missing
# Select the latest stable patch on each release line and drop
# prerelease tags before taking the requested position.
case "${{ matrix.scylla-version }}" in
LATEST)
printf 'value=%s\n' '^[0-9]{4}$.^[2-9][0-9]*$.LAST and *.*.^[0-9]+$ and LAST' >> "$GITHUB_OUTPUT"
;;
PRIOR)
printf 'value=%s\n' '^[0-9]{4}$.^[2-9][0-9]*$.LAST and *.*.^[0-9]+$ and LAST-1' >> "$GITHUB_OUTPUT"
;;
LTS-LATEST)
printf 'value=%s\n' '^[0-9]{4}$.1.LAST and *.*.^[0-9]+$ and LAST' >> "$GITHUB_OUTPUT"
;;
LTS-PRIOR)
printf 'value=%s\n' '^[0-9]{4}$.1.LAST and *.*.^[0-9]+$ and LAST-1' >> "$GITHUB_OUTPUT"
;;
*)
echo "Unknown scylla version name ${{ matrix.scylla-version }}"
exit 1
;;
esac

- name: Get scylla version
id: scylla-version
uses: scylladb-actions/get-version@v0.4.5
with:
source: dockerhub-imagetag
repo: scylladb/scylla
filters: ${{ steps.scylla-filter.outputs.value }}

- name: Resolve scylla version
id: scylla-version-value
run: |
if [[ "${{ matrix.scylla-version }}" == "ENTERPRISE-RELEASE" ]]; then
echo "value=$(python3 ci/version_fetch.py --version-index 1 scylla-enterprise-stable:1 | tr -d '\"')" | tee -a $GITHUB_OUTPUT
elif [[ "${{ matrix.scylla-version }}" == "ENTERPRISE-PRIOR-RELEASE" ]]; then
echo "value=$(python3 ci/version_fetch.py --version-index 2 scylla-enterprise-stable:2 | tr -d '\"')" | tee -a $GITHUB_OUTPUT
elif [[ "${{ matrix.scylla-version }}" == "ENTERPRISE-RC" ]]; then
echo "value=$(python3 ci/version_fetch.py --version-index 1 scylla-enterprise-rc | tr -d '\"')" | tee -a $GITHUB_OUTPUT
elif [[ "${{ matrix.scylla-version }}" == "OSS-RELEASE" ]]; then
echo "value=$(python3 ci/version_fetch.py --version-index 1 scylla-oss-stable:1 | tr -d '\"')" | tee -a $GITHUB_OUTPUT
elif [[ "${{ matrix.scylla-version }}" == "OSS-PRIOR-RELEASE" ]]; then
echo "value=$(python3 ci/version_fetch.py --version-index 2 scylla-oss-stable:2 | tr -d '\"')" | tee -a $GITHUB_OUTPUT
elif [[ "${{ matrix.scylla-version }}" == "OSS-RC" ]]; then
echo "value=$(python3 ci/version_fetch.py --version-index 1 scylla-oss-rc | tr -d '\"')" | tee -a $GITHUB_OUTPUT
elif echo "${{ matrix.scylla-version }}" | grep -P '^[0-9\.]+'; then # If you want to run specific version do just that
echo "value=${{ matrix.scylla-version }}" | tee -a $GITHUB_OUTPUT
else
echo "Unknown scylla version name `${{ matrix.scylla-version }}`"
value='${{ fromJson(steps.scylla-version.outputs.versions)[0] }}'
if [ -z "$value" ]; then
echo "No Scylla version resolved for ${{ matrix.scylla-version }}" >&2
exit 1
fi
echo "value=$value" | tee -a "$GITHUB_OUTPUT"

- name: Pull CCM image from the cache
uses: actions/cache/restore@v4
id: pull-image
with:
path: ~/.ccm/scylla-repository
key: image-scylla-${{ runner.os }}-${{ steps.scylla-version.outputs.value }}
key: image-scylla-${{ runner.os }}-${{ steps.scylla-version-value.outputs.value }}

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

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

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

- name: Run integration tests on Scylla ${{ steps.scylla-version.outputs.value }}
- name: Run integration tests on Scylla ${{ steps.scylla-version-value.outputs.value }}
id: run-integration-tests
run: SCYLLA_VERSION="release:${{ steps.scylla-version.outputs.value }}" make run-test-integration-scylla
run: SCYLLA_VERSION="release:${{ steps.scylla-version-value.outputs.value }}" make run-test-integration-scylla

- name: Upload test logs
uses: actions/upload-artifact@v4
Expand All @@ -158,7 +172,7 @@ jobs:

strategy:
matrix:
cassandra-version: [RELEASE-3.X]
cassandra-version: [3-LATEST]
java-version: [8]
fail-fast: false

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

- name: Setup Python 3
uses: actions/setup-python@v5
with:
python-version: "3.11"

- name: Update apt cache
run: sudo apt-get update -y

Expand All @@ -185,32 +194,38 @@ jobs:

- name: Get cassandra version
id: cassandra-version
uses: scylladb-actions/get-version@v0.4.5
with:
source: github-tag
repo: apache/cassandra
prefix: cassandra-
out-no-prefix: true
github-token: ${{ secrets.GITHUB_TOKEN }}
filters: '^[0-9]+$.^[0-9]+$.^[0-9]+$ and 3.LAST.LAST'

- name: Resolve cassandra version
id: cassandra-version-value
run: |
if [[ "${{ matrix.cassandra-version }}" == "RELEASE-3.X" ]]; then
echo "value=$(python3 ci/version_fetch.py --version-index 1 cassandra3-stable:1 | tr -d '\"')" | tee -a $GITHUB_OUTPUT
elif [[ "${{ matrix.cassandra-version }}" == "RELEASE-4.X" ]]; then
echo "value=$(python3 ci/version_fetch.py --version-index 1 cassandra4-stable:1 | tr -d '\"')" | tee -a $GITHUB_OUTPUT
else
echo "Unknown cassandra version name `${{ matrix.cassandra-version }}`"
fi
value=${{ fromJson(steps.cassandra-version.outputs.versions)[0] }}
echo "value=${value#cassandra-}" | tee -a "$GITHUB_OUTPUT"

- name: Pull CCM image from the cache
uses: actions/cache/restore@v4
id: pull-image
with:
path: ~/.ccm/repository
key: image-cassandra-${{ runner.os }}-${{ steps.cassandra-version.outputs.value }}
key: image-cassandra-${{ runner.os }}-${{ steps.cassandra-version-value.outputs.value }}

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

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

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

- name: Run integration tests on Cassandra ${{ steps.cassandra-version.outputs.value }}
- name: Run integration tests on Cassandra ${{ steps.cassandra-version-value.outputs.value }}
id: run-integration-tests
run: CASSANDRA_VERSION="${{ steps.cassandra-version.outputs.value }}" make run-test-integration-cassandra
run: CASSANDRA_VERSION="${{ steps.cassandra-version-value.outputs.value }}" make run-test-integration-cassandra

- name: Upload test logs
uses: actions/upload-artifact@v4
Expand Down
9 changes: 2 additions & 7 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -304,8 +304,7 @@ set(CPACK_MONOLITHIC_INSTALL ON)
set(CPACK_VERBATIM_VARIABLES ON)

# Normalize package output names so generated artifacts share a consistent
# `scylla_cpp_driver_<version>_<platform>` family. macOS DMGs use explicit
# per-component file names to avoid CPack's default `-<component>` suffix.
# `scylla_cpp_driver_<version>_<platform>.{deb,rpm,pkg,msi}` pattern.
set(CPACK_MONOLITHIC_INSTALL OFF)
if(WIN32)
set(CPACK_MONOLITHIC_INSTALL ON)
Expand Down Expand Up @@ -384,11 +383,7 @@ elseif(APPLE)
set(CPACK_GENERATOR "productbuild;DragNDrop")
set(CPACK_DMG_COMPONENT_INSTALL ON)
set(CPACK_PACKAGE_FILE_NAME
"${SCYLLA_DRIVER_ARTIFACT_BASE_NAME}_${PROJECT_VERSION_STRING}")
set(CPACK_DMG_${SCYLLA_DRIVER_RUNTIME_COMPONENT_NAME_UPPER}_FILE_NAME
"${SCYLLA_DRIVER_RUNTIME_COMPONENT_NAME}_${PROJECT_VERSION_STRING}")
set(CPACK_DMG_${SCYLLA_DRIVER_DEV_COMPONENT_NAME_UPPER}_FILE_NAME
"${SCYLLA_DRIVER_DEV_COMPONENT_NAME}_${PROJECT_VERSION_STRING}")
"${SCYLLA_DRIVER_ARTIFACT_BASE_NAME}_${PROJECT_VERSION_STRING}_macos")
set(CPACK_PRODUCTBUILD_IDENTIFIER "com.scylladb.cpp-rs-driver")
set(CPACK_PRODUCTBUILD_SIGNING_IDENTITY "")
set(CPACK_PRODUCTBUILD_COMPONENT_INSTALL ON)
Expand Down
22 changes: 20 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,17 @@ SPACE := ${EMPTY} ${EMPTY}

SHELL := bash
.SHELLFLAGS := -ec

CCM_INSTALL_DIR ?= $(HOME)/.local/share/scylla-ccm
CCM_REPOSITORY ?= https://github.com/scylladb/scylla-ccm.git

ifeq ($(OS),Windows_NT)
SHELL := pwsh.exe
.SHELLFLAGS := -NoProfile -Command $$ErrorActionPreference = 'Stop';
else
export PATH := $(CCM_INSTALL_DIR):$(HOME)/.local/bin:$(PATH)
export PERL5LIB := $(CCM_INSTALL_DIR):$(PERL5LIB)
export PYTHONPATH := $(CCM_INSTALL_DIR):$(PYTHONPATH)
endif

UNAME_S := $(shell uname -s)
Expand Down Expand Up @@ -244,11 +252,21 @@ install-clang-format-if-missing: update-apt-cache-if-needed
install-ccm-if-missing:
@ccm list >/dev/null 2>&1 || (
echo "CCM not found in the system, install it."
pip3 install --user https://github.com/scylladb/scylla-ccm/archive/${CCM_COMMIT_ID}.zip
$(MAKE) install-ccm
)

install-ccm:
@pip3 install --user https://github.com/scylladb/scylla-ccm/archive/${CCM_COMMIT_ID}.zip
@echo "Installing CCM from ${CCM_REPOSITORY}@${CCM_COMMIT_ID}"
rm -rf "${CCM_INSTALL_DIR}.tmp"
mkdir -p "$$(dirname "${CCM_INSTALL_DIR}")"
git clone --filter=blob:none --depth 1 --no-checkout "${CCM_REPOSITORY}" "${CCM_INSTALL_DIR}.tmp"
git -C "${CCM_INSTALL_DIR}.tmp" fetch --depth 1 origin "${CCM_COMMIT_ID}"
git -C "${CCM_INSTALL_DIR}.tmp" checkout --detach FETCH_HEAD
pip3 install --user ruamel-yaml psutil requests packaging boto3 tqdm urllib3
chmod +x "${CCM_INSTALL_DIR}.tmp/ccm"
rm -rf "${CCM_INSTALL_DIR}"
mv "${CCM_INSTALL_DIR}.tmp" "${CCM_INSTALL_DIR}"
ccm list >/dev/null

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