Skip to content

ci: redo cicd

ci: redo cicd #24

name: Build
on:
push:
branches: [ master ]
pull_request:
branches: [ master ]
env:
CARGO_TERM_COLOR: always
CCM_COMMIT_ID: a93125bc6ad7dd5c9694331e89dc1fb212431ffe
jobs:
compile-ccm-bin:
name: Compile CCM and store in cache
runs-on: ubuntu-latest
steps:
- name: Check CCM binary
uses: actions/cache@v4
id: check-ccm-bin
with:
path: /tmp/ccm
key: ccm-bin-${{ env.CCM_COMMIT_ID }}
- name: Setup Python 3
if: steps.ccm-cache.outputs.cache-hit != 'true'
uses: actions/setup-python@v5
with:
python-version: '3.11'
- name: Compile CCM
if: steps.ccm-cache.outputs.cache-hit != 'true'
run: |
set -e
apt update && apt install patchelf
pip3 install https://github.com/scylladb/scylla-ccm/archive/${{ env.CCM_COMMIT_ID }}.zip
pip3 install nuitka==2.4.8
CCM_BIN=`whereis ccm | awk '{print $2}'`
python -m nuitka --onefile --standalone --output-filename=ccm $CCM_BIN
chmod +x ./ccm
- name: Save CCM binary into cache
if: steps.ccm-cache.outputs.cache-hit != 'true'
uses: actions/cache/save@v4
with:
path: ./ccm
key: ccm-bin-${{ env.CCM_COMMIT_ID }}
build-lint-and-unit-test:
name: Build, lint and run unit tests
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install libssl1.1 libssl-dev libuv1-dev libkrb5-dev libc6-dbg libclang-15-dev
- name: Build integration suit
run: cmake -DCASS_BUILD_INTEGRATION_TESTS=ON -DCASS_USE_STATIC_LIBS=ON . && (make -j 4 || make)
- name: Cargo check
working-directory: ./scylla-rust-wrapper
run: cargo check
- name: Cargo clippy check
working-directory: ./scylla-rust-wrapper
run: cargo clippy --verbose --all-targets -- -D warnings -Aclippy::uninlined_format_args
- name: Cargo format check
working-directory: ./scylla-rust-wrapper
run: cargo fmt --verbose --all -- --check
- name: Run unit and proxy tests
working-directory: ./scylla-rust-wrapper
run: cargo test
- name: Save integration test binary
if: success()
uses: actions/cache/save@v4
id: save-integration-test-bin
with:
path: cassandra-integration-tests
key: integration-test-bin-${{ github.sha }}
scylla-integration-tests:
name: Scylla ITs
runs-on: ubuntu-latest
needs: [build-lint-and-unit-test,compile-ccm-bin]
timeout-minutes: 90
strategy:
matrix:
scylla-version: [ENTERPRISE-RELEASE, ENTERPRISE-PRIOR-RELEASE, OSS-RELEASE, OSS-PRIOR-RELEASE]
fail-fast: false
steps:
- name: Setup Python 3
uses: actions/setup-python@v5
with:
python-version: '3.11'
- name: Get scylla version
id: scylla-version
run: |
if [[ "${{ matrix.scylla-version }}" == "ENTERPRISE-RELEASE" ]]; then
echo "value=$(python3 ci/version_fetch.py --version-index 1 scylla-enterprise-stable:1)" >> $GITHUB_OUTPUT
elif [[ "${{ matrix.scylla-version }}" == "ENTERPRISE-PRIOR-RELEASE" ]]; then
echo "value=$(python3 ci/version_fetch.py --version-index 2 scylla-enterprise-stable:2)" >> $GITHUB_OUTPUT
elif [[ "${{ matrix.scylla-version }}" == "ENTERPRISE-RC" ]]; then
echo "value=$(python3 ci/version_fetch.py --version-index 1 scylla-enterprise-rc)" >> $GITHUB_OUTPUT
elif [[ "${{ matrix.scylla-version }}" == "OSS-RELEASE" ]]; then
echo "value=$(python3 ci/version_fetch.py --version-index 1 scylla-oss-stable:1)" >> $GITHUB_OUTPUT
elif [[ "${{ matrix.scylla-version }}" == "OSS-PRIOR-RELEASE" ]]; then
echo "value=$(python3 ci/version_fetch.py --version-index 2 scylla-oss-stable:2)" >> $GITHUB_OUTPUT
elif [[ "${{ matrix.scylla-version }}" == "OSS-RC" ]]; then
echo "value=$(python3 ci/version_fetch.py --version-index 1 scylla-oss-rc)" >> $GITHUB_OUTPUT
else
echo "Unknown scylla version name `${{ matrix.scylla-version }}`"
exit 1
fi
- name: Restore CCM image cache
uses: actions/cache/restore@v4
id: ccm-cache
with:
path: ~/.ccm/repository
key: ccm-cassandra-${{ runner.os }}-${{ steps.scylla-version.outputs.value }}
- name: Restore CCM binary
uses: actions/cache/restore@v4
with:
path: /usr/local/bin/ccm
key: ccm-bin-${{ env.CCM_COMMIT_ID }}
- name: Restore integration test binary
uses: actions/cache/restore@v4
id: restore-integration-test-bin
with:
path: cassandra-integration-tests
key: integration-test-bin-${{ github.sha }}
- name: Install valgrind
run: |
sudo snap install valgrind --classic
- name: Run integration tests on Scylla ${{ steps.scylla-version.outputs.value }}
env:
# Ignored tests are added in the end, after the "-" sign.
Tests: "ClusterTests.*\
:BasicsTests.*\
:PreparedTests.*\
:CassandraTypes/CassandraTypesTests/*.Integration_Cassandra_*\
:BatchSingleNodeClusterTests*:BatchCounterSingleNodeClusterTests*:BatchCounterThreeNodeClusterTests*\
:ErrorTests.*\
:SslNoClusterTests*:SslNoSslOnClusterTests*\
:SchemaMetadataTest.*KeyspaceMetadata:SchemaMetadataTest.*MetadataIterator:SchemaMetadataTest.*View*\
:TracingTests.*\
:ByNameTests.*\
:CompressionTests.*\
:LoggingTests.*\
:-PreparedTests.Integration_Cassandra_PreparedIDUnchangedDuringReprepare\
:ExecutionProfileTest.InvalidName"
run: |
sudo sh -c "echo 2097152 >> /proc/sys/fs/aio-max-nr"
sudo apt-get update && sudo apt-get install -y libc6-dbg
valgrind --error-exitcode=123 --leak-check=full --errors-for-leak-kinds=definite ./cassandra-integration-tests --scylla --version=release:${{ steps.scylla-version.outputs.value }} --category=CASSANDRA --verbose=ccm --gtest_filter="$Tests"
- name: Save CCM image cache
uses: actions/cache/save@v4
if: steps.ccm-cache.outputs.cache-hit != 'true'
with:
path: ~/.ccm/repository
key: ccm-cassandra-${{ runner.os }}-${{ steps.scylla-version.outputs.value }}
- name: Upload test logs
uses: actions/upload-artifact@v4
if: success() || failure()
with:
name: test-logs-scylla-${{ matrix.cassandra-version }}
path: ./log/*
- name: Upload CCM logs
uses: actions/upload-artifact@v4
if: ${{ failure() }}
with:
name: ccm-log-scylla-${{ matrix.scylla-version }}
path: /tmp/ccm*/ccm*/node*/logs/*
cassandra-integration-tests:
runs-on: ubuntu-latest
needs: [build-lint-and-unit-test,compile-ccm-bin]
strategy:
matrix:
cassandra-version: [RELEASE-3.X, RELEASE-4.X]
java-version: [8]
fail-fast: false
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up JDK ${{ matrix.java-version }}
uses: actions/setup-java@v4
with:
java-version: ${{ matrix.java-version }}
distribution: 'adopt'
- name: Get cassandra version
id: cassandra-version
run: |
if [[ "${{ matrix.cassandra-version }}" == "RELEASE-3.X" ]]; then
echo "value=$(python3 ci/version_fetch.py --version-index 1 cassandra3-stable:1)" >> $GITHUB_OUTPUT
elif [[ "${{ matrix.cassandra-version }}" == "RELEASE-4.X" ]]; then
echo "value=$(python3 ci/version_fetch.py --version-index 1 cassandra4-stable:1)" >> $GITHUB_OUTPUT
else
echo "Unknown cassandra version name `${{ matrix.cassandra-version }}`"
fi
- name: Restore CCM image cache
uses: actions/cache/restore@v4
id: ccm-cache
with:
path: ~/.ccm/repository
key: ccm-cassandra-${{ runner.os }}-${{ steps.cassandra-version.outputs.value }}
- name: Restore integration test binary
uses: actions/cache/restore@v4
id: restore-integration-test-bin
with:
path: cassandra-integration-tests
key: integration-test-bin-${{ github.sha }}
- name: Install valgrind
run: |
sudo snap install valgrind --classic
- name: Run integration tests on Cassandra ${{ steps.cassandra-version.outputs.value }}
env:
# Ignored tests are added in the end, after the "-" sign.
Tests: "ClusterTests.*\
:BasicsTests.*\
:PreparedTests.*\
:CassandraTypes/CassandraTypesTests/*.Integration_Cassandra_*\
:ErrorTests.*\
:SslClientAuthenticationTests*:SslNoClusterTests*:SslNoSslOnClusterTests*:SslTests*\
:SchemaMetadataTest.*KeyspaceMetadata:SchemaMetadataTest.*MetadataIterator:SchemaMetadataTest.*View*\
:TracingTests.*\
:ByNameTests.*\
:CompressionTests.*\
:LoggingTests.*\
:-PreparedTests.Integration_Cassandra_PreparedIDUnchangedDuringReprepare\
:PreparedTests.Integration_Cassandra_FailFastWhenPreparedIDChangesDuringReprepare\
:SslTests.Integration_Cassandra_ReconnectAfterClusterCrashAndRestart\
:ExecutionProfileTest.InvalidName\
:*NoCompactEnabledConnection"
run: |
sudo sh -c "echo 2097152 >> /proc/sys/fs/aio-max-nr"
sudo apt-get update && sudo apt-get install -y libc6-dbg
valgrind --error-exitcode=123 --leak-check=full --errors-for-leak-kinds=definite ./cassandra-integration-tests --version=${{ steps.cassandra-version.outputs.value }} --category=CASSANDRA --verbose=ccm --gtest_filter="$Tests"
- name: Save CCM image cache
uses: actions/cache/save@v4
if: steps.ccm-cache.outputs.cache-hit != 'true'
with:
path: ~/.ccm/repository
key: ccm-cassandra-${{ runner.os }}-${{ steps.cassandra-version.outputs.value }}
- name: Upload test logs
uses: actions/upload-artifact@v4
if: success() || failure()
with:
name: test-logs-cassandra-${{ matrix.cassandra-version }}
path: ./log/*
- name: Upload CCM logs
uses: actions/upload-artifact@v4
if: ${{ failure() }}
with:
name: ccm-log-cassandra-${{ matrix.java-version }}-${{ matrix.cassandra-version }}
path: /tmp/ccm*/ccm*/node*/logs/*