Preparing build for the 0.3.0 release (#322) #279
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
| # | |
| # Licensed to the Apache Software Foundation (ASF) under one | |
| # or more contributor license agreements. See the NOTICE file | |
| # distributed with this work for additional information | |
| # regarding copyright ownership. The ASF licenses this file | |
| # to you under the Apache License, Version 2.0 (the | |
| # "License"); you may not use this file except in compliance | |
| # with the License. You may obtain a copy of the License at | |
| # | |
| # http://www.apache.org/licenses/LICENSE-2.0 | |
| # | |
| # Unless required by applicable law or agreed to in writing, software | |
| # distributed under the License is distributed on an "AS IS" BASIS, | |
| # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |
| # See the License for the specific language governing permissions and | |
| # limitations under the License. | |
| # | |
| name: CI | |
| on: | |
| pull_request: | |
| branches: [trunk] | |
| push: | |
| branches: [trunk] | |
| # Cancel in-progress runs for PRs when new commits are pushed | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.ref }} | |
| cancel-in-progress: ${{ github.event_name == 'pull_request' }} | |
| permissions: | |
| contents: read | |
| jobs: | |
| # Build Cassandra dtest jars once for all test jobs to reuse | |
| build-dtest-jars: | |
| name: Build dtest jars | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: read | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v5 | |
| - name: Setup Java 11 | |
| uses: actions/setup-java@v5 | |
| with: | |
| java-version: "11" | |
| distribution: "temurin" | |
| cache: "gradle" | |
| - name: Install prerequisites | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y ant | |
| - name: Setup network aliases for multi-node tests | |
| run: | | |
| for i in {2..20}; do | |
| sudo ip addr add 127.0.0.$i/8 dev lo | |
| done | |
| - name: Cache dtest jars | |
| id: cache-dtest-jars | |
| uses: actions/cache@v4 | |
| with: | |
| path: | | |
| dtest-jars/ | |
| cassandra-tarballs/ | |
| key: dtest-jars-${{ hashFiles('scripts/build-dtest-jars.sh', 'gradle/wrapper/gradle-wrapper.properties') }} | |
| - name: Dtest jars cache status | |
| run: | | |
| if [ "${{ steps.cache-dtest-jars.outputs.cache-hit }}" == "true" ]; then | |
| echo "✅ Dtest jars restored from cache (saves ~25 minutes)" | |
| else | |
| echo "⚠️ Cache miss - will build dtest jars (~25 minutes)" | |
| fi | |
| - name: Build dtest jars | |
| if: steps.cache-dtest-jars.outputs.cache-hit != 'true' | |
| run: | | |
| ./scripts/build-dtest-jars.sh | |
| - name: Upload dtest jars artifact | |
| uses: actions/upload-artifact@v5 | |
| with: | |
| name: dtest-jars | |
| path: dtest-jars/ | |
| retention-days: 90 | |
| - name: Upload cassandra tarballs artifact | |
| uses: actions/upload-artifact@v5 | |
| with: | |
| name: cassandra-tarballs | |
| path: cassandra-tarballs/ | |
| retention-days: 30 | |
| # Run checkstyle checks for code style validation | |
| checkstyle: | |
| name: Checkstyle | |
| runs-on: ubuntu-latest | |
| needs: build-dtest-jars | |
| permissions: | |
| contents: read | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v5 | |
| - name: Setup Java 11 | |
| uses: actions/setup-java@v5 | |
| with: | |
| java-version: "11" | |
| distribution: "temurin" | |
| cache: "gradle" | |
| - name: Setup Gradle | |
| uses: gradle/actions/setup-gradle@v5 | |
| with: | |
| cache-read-only: ${{ github.ref != 'refs/heads/trunk' }} | |
| - name: Download dtest jars | |
| uses: actions/download-artifact@v5 | |
| with: | |
| name: dtest-jars | |
| path: dtest-jars/ | |
| - name: Run checkstyle | |
| run: | | |
| ./gradlew checkstyle --stacktrace | |
| env: | |
| CASSANDRA_DEP_DIR: ${{ github.workspace }}/dtest-jars | |
| - name: Upload checkstyle reports | |
| if: always() | |
| uses: actions/upload-artifact@v5 | |
| with: | |
| name: checkstyle-reports | |
| path: "**/build/reports/checkstyle/" | |
| retention-days: 30 | |
| # Run unit tests with static analysis on all Java versions | |
| unit-tests: | |
| name: Unit tests (Java ${{ matrix.java }}) | |
| runs-on: ubuntu-latest | |
| needs: build-dtest-jars | |
| permissions: | |
| contents: read | |
| checks: write | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| java: ["11", "17"] | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v5 | |
| - name: Setup Java ${{ matrix.java }} | |
| uses: actions/setup-java@v5 | |
| with: | |
| java-version: ${{ matrix.java }} | |
| distribution: "temurin" | |
| cache: "gradle" | |
| - name: Setup Gradle | |
| uses: gradle/actions/setup-gradle@v5 | |
| with: | |
| cache-read-only: ${{ github.ref != 'refs/heads/trunk' }} | |
| - name: Download dtest jars | |
| uses: actions/download-artifact@v5 | |
| with: | |
| name: dtest-jars | |
| path: dtest-jars/ | |
| - name: Run build with static analysis | |
| run: | | |
| ./gradlew build -x integrationTest -x checkstyleMain -x checkstyleTest -x checkstyleTestFixtures -x javadoc --stacktrace | |
| env: | |
| CASSANDRA_DEP_DIR: ${{ github.workspace }}/dtest-jars | |
| - name: Upload test results | |
| if: always() | |
| uses: actions/upload-artifact@v5 | |
| with: | |
| name: unit-test-results-java-${{ matrix.java }} | |
| path: | | |
| **/build/test-results/test/** | |
| **/build/test-results/containerTest/** | |
| **/build/reports/tests/ | |
| retention-days: 30 | |
| - name: Upload static analysis reports | |
| if: always() | |
| uses: actions/upload-artifact@v5 | |
| with: | |
| name: static-analysis-reports-java-${{ matrix.java }} | |
| path: | | |
| **/build/reports/spotbugs/ | |
| **/build/reports/rat/ | |
| **/build/reports/jacoco/ | |
| retention-days: 30 | |
| # Run lightweight integration tests on full matrix | |
| integration-tests-lightweight: | |
| name: Integration tests lightweight (Java ${{ matrix.java }}, C* ${{ matrix.cassandra }}) | |
| runs-on: ubuntu-latest | |
| needs: [build-dtest-jars, unit-tests] | |
| permissions: | |
| contents: read | |
| checks: write | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| java: ["11", "17"] | |
| cassandra: ["4.0", "4.1", "5.0", "5.1"] | |
| include: | |
| - cassandra: "4.0" | |
| dtestVersion: "4.0.20" | |
| - cassandra: "4.1" | |
| dtestVersion: "4.1.11" | |
| - cassandra: "5.0" | |
| dtestVersion: "5.0.6" | |
| - cassandra: "5.1" | |
| dtestVersion: "5.1" | |
| # Exclude jdk17 for 4.0/4.1 as they don't support 17 | |
| exclude: | |
| - cassandra: "4.0" | |
| java: "17" | |
| - cassandra: "4.1" | |
| java: "17" | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v5 | |
| - name: Setup Java ${{ matrix.java }} | |
| uses: actions/setup-java@v5 | |
| with: | |
| java-version: ${{ matrix.java }} | |
| distribution: "temurin" | |
| cache: "gradle" | |
| - name: Setup Gradle | |
| uses: gradle/actions/setup-gradle@v5 | |
| with: | |
| cache-read-only: ${{ github.ref != 'refs/heads/trunk' }} | |
| - name: Install prerequisites | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y ant | |
| - name: Setup network aliases for multi-node tests | |
| run: | | |
| for i in {2..20}; do | |
| sudo ip addr add 127.0.0.$i/8 dev lo | |
| sudo echo 127.0.0.${i} localhost${i} | sudo tee -a /etc/hosts | |
| done | |
| - name: Download dtest jars | |
| uses: actions/download-artifact@v5 | |
| with: | |
| name: dtest-jars | |
| path: dtest-jars/ | |
| - name: Install dtest jars to local Maven | |
| run: | | |
| ./scripts/install-shaded-dtest-jar-local.sh | |
| env: | |
| CASSANDRA_DEP_DIR: ${{ github.workspace }}/dtest-jars | |
| - name: Run lightweight integration tests | |
| run: | | |
| ./gradlew --no-daemon \ | |
| -PdtestVersion=${{ matrix.dtestVersion }} \ | |
| -Dcassandra.sidecar.versions_to_test="${{ matrix.cassandra }}" \ | |
| integrationTestLightWeight \ | |
| --stacktrace | |
| env: | |
| CASSANDRA_DEP_DIR: ${{ github.workspace }}/dtest-jars | |
| INTEGRATION_MAX_PARALLEL_FORKS: 3 | |
| INTEGRATION_MAX_HEAP_SIZE: 2500M | |
| - name: Upload test results | |
| if: always() | |
| uses: actions/upload-artifact@v5 | |
| with: | |
| name: integration-lightweight-results-java-${{ matrix.java }}-cassandra-${{ matrix.cassandra }} | |
| path: | | |
| **/build/test-results/integrationTest*/** | |
| **/build/reports/tests/integrationTest*/ | |
| retention-days: 30 | |
| # Run heavyweight integration tests on full matrix | |
| integration-tests-heavyweight: | |
| name: Integration tests heavyweight (Java ${{ matrix.java }}, C* ${{ matrix.cassandra }}) | |
| runs-on: ubuntu-latest | |
| needs: [build-dtest-jars, unit-tests] | |
| permissions: | |
| contents: read | |
| checks: write | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| java: ["11", "17"] | |
| cassandra: ["4.0", "4.1", "5.0", "5.1"] | |
| include: | |
| - cassandra: "4.0" | |
| dtestVersion: "4.0.16" | |
| - cassandra: "4.1" | |
| dtestVersion: "4.1.6" | |
| - cassandra: "5.0" | |
| dtestVersion: "5.0.3" | |
| - cassandra: "5.1" | |
| dtestVersion: "5.1" | |
| # Exclude jdk17 for 4.0/4.1 as they don't support 17 | |
| exclude: | |
| - cassandra: "4.0" | |
| java: "17" | |
| - cassandra: "4.1" | |
| java: "17" | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v5 | |
| - name: Setup Java ${{ matrix.java }} | |
| uses: actions/setup-java@v5 | |
| with: | |
| java-version: ${{ matrix.java }} | |
| distribution: "temurin" | |
| cache: "gradle" | |
| - name: Setup Gradle | |
| uses: gradle/actions/setup-gradle@v5 | |
| with: | |
| cache-read-only: ${{ github.ref != 'refs/heads/trunk' }} | |
| - name: Install prerequisites | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y ant | |
| - name: Setup network aliases for multi-node tests | |
| run: | | |
| for i in {2..20}; do | |
| sudo ip addr add 127.0.0.$i/8 dev lo | |
| sudo echo 127.0.0.${i} localhost${i} | sudo tee -a /etc/hosts | |
| done | |
| cat /etc/hosts | |
| - name: Download dtest jars | |
| uses: actions/download-artifact@v5 | |
| with: | |
| name: dtest-jars | |
| path: dtest-jars/ | |
| - name: Download cassandra tarballs | |
| uses: actions/download-artifact@v5 | |
| with: | |
| name: cassandra-tarballs | |
| path: cassandra-tarballs/ | |
| - name: Install dtest jars to local Maven | |
| run: | | |
| ./scripts/install-shaded-dtest-jar-local.sh | |
| env: | |
| CASSANDRA_DEP_DIR: ${{ github.workspace }}/dtest-jars | |
| - name: Run heavyweight integration tests | |
| run: | | |
| ./gradlew --no-daemon \ | |
| -PdtestVersion=${{ matrix.dtestVersion }} \ | |
| -PtarballVersion=${{ matrix.cassandra }} \ | |
| -Dcassandra.sidecar.versions_to_test="${{ matrix.cassandra }}" \ | |
| jar integrationTestHeavyWeight \ | |
| --stacktrace | |
| env: | |
| CASSANDRA_DEP_DIR: ${{ github.workspace }}/dtest-jars | |
| INTEGRATION_MAX_PARALLEL_FORKS: 3 | |
| INTEGRATION_MAX_HEAP_SIZE: 3600M | |
| - name: Upload test results | |
| if: always() | |
| uses: actions/upload-artifact@v5 | |
| with: | |
| name: integration-heavyweight-results-java-${{ matrix.java }}-cassandra-${{ matrix.cassandra }} | |
| path: | | |
| **/build/test-results/integrationTest*/** | |
| **/build/reports/tests/integrationTest*/ | |
| retention-days: 30 | |
| # Run Java 8 client unit tests for client compatibility | |
| unit-tests-java8: | |
| name: Unit tests (Java 8 - Client only) | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: read | |
| checks: write | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v5 | |
| - name: Setup Java 8 | |
| uses: actions/setup-java@v5 | |
| with: | |
| java-version: "8" | |
| distribution: "temurin" | |
| cache: "gradle" | |
| - name: Setup Gradle | |
| uses: gradle/actions/setup-gradle@v5 | |
| with: | |
| cache-read-only: ${{ github.ref != 'refs/heads/trunk' }} | |
| - name: Run build | |
| run: | | |
| ./gradlew build --stacktrace | |
| - name: Upload test results | |
| if: always() | |
| uses: actions/upload-artifact@v5 | |
| with: | |
| name: unit-test-results-java-8 | |
| path: | | |
| **/build/test-results/test/** | |
| **/build/reports/tests/ | |
| retention-days: 30 | |
| # Build and verify Debian package | |
| deb-build-install: | |
| name: Deb package build and install | |
| runs-on: ubuntu-latest | |
| needs: [unit-tests, checkstyle] | |
| permissions: | |
| contents: read | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v5 | |
| - name: Setup Java 11 | |
| uses: actions/setup-java@v5 | |
| with: | |
| java-version: "11" | |
| distribution: "temurin" | |
| cache: "gradle" | |
| - name: Setup Gradle | |
| uses: gradle/actions/setup-gradle@v5 | |
| with: | |
| cache-read-only: ${{ github.ref != 'refs/heads/trunk' }} | |
| - name: Build Debian package | |
| run: | | |
| ./gradlew --info clean buildDeb | |
| - name: Install Debian package | |
| run: | | |
| sudo apt-get update && sudo apt --fix-broken install | |
| DEBIAN_FRONTEND=noninteractive sudo apt install -y ./build/distributions/apache-cassandra-sidecar*.deb | |
| - name: Verify installation | |
| run: | | |
| test -f /opt/apache-cassandra-sidecar/bin/cassandra-sidecar | |
| test -f /opt/apache-cassandra-sidecar/conf/sidecar.yaml | |
| test -f /opt/apache-cassandra-sidecar/conf/logback.xml | |
| test -f /opt/apache-cassandra-sidecar/LICENSE.txt | |
| test -f /opt/apache-cassandra-sidecar/lib/cassandra-sidecar-*.jar | |
| # Build and verify RPM package | |
| rpm-build-install: | |
| name: RPM package build and install | |
| runs-on: ubuntu-latest | |
| needs: [unit-tests, checkstyle] | |
| permissions: | |
| contents: read | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v5 | |
| - name: Setup Java 11 | |
| uses: actions/setup-java@v5 | |
| with: | |
| java-version: "11" | |
| distribution: "temurin" | |
| cache: "gradle" | |
| - name: Setup Gradle | |
| uses: gradle/actions/setup-gradle@v5 | |
| with: | |
| cache-read-only: ${{ github.ref != 'refs/heads/trunk' }} | |
| - name: Install dnf | |
| run: | | |
| sudo apt-get update && sudo apt-get install -y dnf | |
| - name: Build RPM package | |
| run: | | |
| ./gradlew -i buildRpm | |
| - name: Install RPM package | |
| run: | | |
| sudo dnf install -y ./build/distributions/apache-cassandra-sidecar*.rpm | |
| - name: Verify installation | |
| run: | | |
| test -f /opt/apache-cassandra-sidecar/bin/cassandra-sidecar | |
| test -f /opt/apache-cassandra-sidecar/conf/sidecar.yaml | |
| test -f /opt/apache-cassandra-sidecar/conf/logback.xml | |
| test -f /opt/apache-cassandra-sidecar/LICENSE.txt | |
| test -f /opt/apache-cassandra-sidecar/lib/cassandra-sidecar-*.jar | |
| # Build Docker image | |
| docker-build: | |
| name: Docker build | |
| runs-on: ubuntu-latest | |
| needs: [unit-tests, checkstyle] | |
| permissions: | |
| contents: read | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v5 | |
| - name: Setup Java 11 | |
| uses: actions/setup-java@v5 | |
| with: | |
| java-version: "11" | |
| distribution: "temurin" | |
| cache: "gradle" | |
| - name: Setup Gradle | |
| uses: gradle/actions/setup-gradle@v5 | |
| with: | |
| cache-read-only: ${{ github.ref != 'refs/heads/trunk' }} | |
| - name: Build Docker image with Jib | |
| run: | | |
| ./gradlew --info clean :server:jibDockerBuild | |
| # Build documentation | |
| docs-build: | |
| name: Documentation build | |
| runs-on: ubuntu-latest | |
| needs: [unit-tests, checkstyle] | |
| permissions: | |
| contents: read | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v5 | |
| - name: Setup Java 11 | |
| uses: actions/setup-java@v5 | |
| with: | |
| java-version: "11" | |
| distribution: "temurin" | |
| cache: "gradle" | |
| - name: Setup Gradle | |
| uses: gradle/actions/setup-gradle@v5 | |
| with: | |
| cache-read-only: ${{ github.ref != 'refs/heads/trunk' }} | |
| - name: Build documentation | |
| run: | | |
| ./gradlew docs:asciidoctor | |
| - name: Verify documentation | |
| run: | | |
| test -f docs/build/user.html | |
| test -f docs/build/development.html |