Add Cassandra integration tests with auto-detected latest version #1884
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Integration tests | |
| permissions: | |
| contents: read | |
| on: | |
| push: | |
| branches: | |
| - master | |
| - 'branch-**' | |
| paths-ignore: | |
| - docs/* | |
| - examples/* | |
| - scripts/* | |
| - .gitignore | |
| - '*.rst' | |
| - '*.ini' | |
| - LICENSE | |
| - .github/dependabot.yml | |
| - .github/pull_request_template.md | |
| - "*.md" | |
| - .github/workflows/docs-* | |
| pull_request: | |
| paths-ignore: | |
| - docs/* | |
| - examples/* | |
| - scripts/* | |
| - .gitignore | |
| - '*.rst' | |
| - '*.ini' | |
| - LICENSE | |
| - .github/dependabot.yml | |
| - .github/pull_request_template.md | |
| - "*.md" | |
| - .github/workflows/docs-* | |
| workflow_dispatch: | |
| jobs: | |
| tests: | |
| name: test ${{ matrix.event_loop_manager }} (${{ matrix.python-version }}) | |
| if: "!contains(github.event.pull_request.labels.*.name, 'disable-integration-tests')" | |
| runs-on: ubuntu-24.04 | |
| env: | |
| SCYLLA_VERSION: release:2025.2 | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| java-version: [8] | |
| python-version: ["3.11", "3.12", "3.13", "3.14", "3.14t"] | |
| event_loop_manager: ["libev", "asyncio", "asyncore"] | |
| exclude: | |
| - python-version: "3.12" | |
| event_loop_manager: "asyncore" | |
| - python-version: "3.13" | |
| event_loop_manager: "asyncore" | |
| - python-version: "3.14" | |
| event_loop_manager: "asyncore" | |
| - python-version: "3.14t" | |
| event_loop_manager: "asyncore" | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - name: Set up JDK ${{ matrix.java-version }} | |
| uses: actions/setup-java@v5 | |
| with: | |
| java-version: ${{ matrix.java-version }} | |
| distribution: 'adopt' | |
| - name: Install libev | |
| run: sudo apt-get install libev4 libev-dev | |
| - name: Install uv | |
| uses: astral-sh/setup-uv@v7 | |
| with: | |
| python-version: ${{ matrix.python-version }} | |
| # This is to get honest accounting of test time vs download time vs build time. | |
| # Not strictly necessary for running tests. | |
| - name: Build driver | |
| run: uv sync | |
| # This is to get honest accounting of test time vs download time vs build time. | |
| # Not strictly necessary for running tests. | |
| - name: Download Scylla | |
| run: | | |
| uv run ccm create scylla-driver-temp -n 1 --scylla --version ${SCYLLA_VERSION} | |
| uv run ccm remove | |
| - name: Test with pytest | |
| env: | |
| EVENT_LOOP_MANAGER: ${{ matrix.event_loop_manager }} | |
| PROTOCOL_VERSION: 4 | |
| run: | | |
| if [[ "${{ matrix.python-version }}" =~ t$ ]]; then | |
| export PYTHON_GIL=0 | |
| fi | |
| uv run pytest tests/integration/standard/ tests/integration/cqlengine/ | |
| tests-cassandra: | |
| name: test cassandra ${{ matrix.event_loop_manager }} (${{ matrix.python-version }}) | |
| if: "!contains(github.event.pull_request.labels.*.name, 'disable-integration-tests')" | |
| runs-on: ubuntu-24.04 | |
| timeout-minutes: 120 | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| python-version: ["3.11"] | |
| event_loop_manager: ["libev", "asyncio"] | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - name: Set up JDK 11 | |
| uses: actions/setup-java@v5 | |
| with: | |
| java-version: 11 | |
| distribution: 'adopt' | |
| - name: Install libev | |
| run: sudo apt-get install libev4 libev-dev | |
| - name: Install uv | |
| uses: astral-sh/setup-uv@v7 | |
| with: | |
| python-version: ${{ matrix.python-version }} | |
| # This is to get honest accounting of test time vs download time vs build time. | |
| # Not strictly necessary for running tests. | |
| - name: Build driver | |
| run: uv sync | |
| - name: Get latest Cassandra version | |
| id: cassandra-version | |
| run: | | |
| CASSANDRA_VERSION=$(curl -s "https://api.github.com/repos/apache/cassandra/tags?per_page=100" | \ | |
| python3 -c " | |
| import sys, json, re | |
| from packaging.version import Version | |
| tags = json.load(sys.stdin) | |
| versions = [re.match(r'^cassandra-(\d+\.\d+\.\d+)$', t['name']).group(1) | |
| for t in tags | |
| if re.match(r'^cassandra-(\d+\.\d+\.\d+)$', t['name'])] | |
| versions.sort(key=lambda v: Version(v), reverse=True) | |
| print(versions[0])") | |
| echo "version=$CASSANDRA_VERSION" >> $GITHUB_OUTPUT | |
| # This is to get honest accounting of test time vs download time vs build time. | |
| # Not strictly necessary for running tests. | |
| - name: Download Cassandra | |
| run: | | |
| uv run ccm create cassandra-driver-temp -n 1 --version ${{ steps.cassandra-version.outputs.version }} | |
| uv run ccm remove | |
| - name: Test with cassandra | |
| env: | |
| EVENT_LOOP_MANAGER: ${{ matrix.event_loop_manager }} | |
| CASSANDRA_VERSION: ${{ steps.cassandra-version.outputs.version }} | |
| MAPPED_CASSANDRA_VERSION: ${{ steps.cassandra-version.outputs.version }} | |
| PROTOCOL_VERSION: 4 | |
| run: | | |
| uv run pytest tests/integration/standard/ |