Skip to content

feat: Travis to GitHub Actions CI #25

feat: Travis to GitHub Actions CI

feat: Travis to GitHub Actions CI #25

name: Integration Tests
on:
pull_request:
branches: [ 1.x ]
workflow_dispatch:
inputs:
test_profile:
description: 'Test profile to run'
required: false
default: 'medium'
type: choice
options:
- medium
- long
# cancel same workflows in progress for pull request branches
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: ${{ github.ref != 'refs/heads/1.x' }}
jobs:
cassandra-tests:
name: Cassandra ${{ matrix.cassandra-version }}
runs-on: ubuntu-latest
strategy:
matrix:
cassandra-version: ['3.11', '4.0', '4.1', '5.0']
fail-fast: false
services:
cassandra:
image: cassandra:${{ matrix.cassandra-version }}
ports:
- 9042:9042
env:
CASSANDRA_CLUSTER_NAME: test-cluster
CASSANDRA_DC: datacenter1
CASSANDRA_ENDPOINT_SNITCH: GossipingPropertyFileSnitch
options: >-
--health-cmd "cqlsh -e 'describe cluster'"
--health-interval 10s
--health-timeout 10s
--health-retries 20
steps:
- name: Checkout code
uses: actions/checkout@v6
- name: Set up JDK 8
uses: actions/setup-java@v5
with:
java-version: '8'
distribution: 'temurin'
cache: 'maven'
- name: Wait for Cassandra to be ready
run: |
echo "Waiting for Cassandra to be ready..."
for i in {1..30}; do
if docker exec $(docker ps -q -f ancestor=cassandra:${{ matrix.cassandra-version }}) cqlsh -e "describe cluster" > /dev/null 2>&1; then
echo "Cassandra is ready!"
break
fi
echo "Waiting... ($i/30)"
sleep 10
done
- name: Display Cassandra info
run: |
docker exec $(docker ps -q -f ancestor=cassandra:${{ matrix.cassandra-version }}) nodetool status
- name: Build project
run: mvn clean install -DskipTests -B -V
- name: Run integration tests
run: |
PROFILE_ARG=""
if [ "${{ github.event.inputs.test_profile }}" = "long" ] || [ "${{ github.event_name }}" = "schedule" ]; then
PROFILE_ARG="-Pmedium -Plong"
elif [ "${{ github.event.inputs.test_profile }}" = "medium" ]; then
PROFILE_ARG="-Pmedium"
fi
mvn verify $PROFILE_ARG -B -V \
-Dmaven.test.failure.ignore=true \
-Dmax.simulacron.clusters=2 \
-Dmax.ccm.clusters=1
env:
CASSANDRA_VERSION: ${{ matrix.cassandra-version }}
- name: Publish Test Results
uses: EnricoMi/publish-unit-test-result-action@v2
if: always()
with:
files: |
**/target/surefire-reports/TEST-*.xml
**/target/failsafe-reports/TEST-*.xml
check_name: Integration Test Results (Cassandra ${{ matrix.cassandra-version }})
- name: Upload test results
if: always()
uses: actions/upload-artifact@v6
with:
name: integration-test-results-cassandra-${{ matrix.cassandra-version }}
path: |
**/target/surefire-reports/
**/target/failsafe-reports/
retention-days: 7
dse-tests:
name: DSE ${{ matrix.dse-version }}
runs-on: ubuntu-latest
strategy:
matrix:
dse-version: ['5.1.49', '6.8.62', '6.9.18']
fail-fast: false
services:
dse:
image: datastax/dse-server:${{ matrix.dse-version }}
ports:
- 9042:9042
env:
DS_LICENSE: accept
CLUSTER_NAME: test-cluster
DC: datacenter1
options: >-
--health-cmd "cqlsh -e 'describe cluster'"
--health-interval 10s
--health-timeout 10s
--health-retries 20
steps:
- name: Checkout code
uses: actions/checkout@v6
- name: Set up JDK 8
uses: actions/setup-java@v5
with:
java-version: '8'
distribution: 'temurin'
cache: 'maven'
- name: Wait for DSE to be ready
run: |
echo "Waiting for DSE to be ready..."
for i in {1..30}; do
if docker exec $(docker ps -q -f ancestor=datastax/dse-server:${{ matrix.dse-version }}) cqlsh -e "describe cluster" > /dev/null 2>&1; then
echo "DSE is ready!"
break
fi
echo "Waiting... ($i/30)"
sleep 10
done
- name: Display DSE info
run: |
docker exec $(docker ps -q -f ancestor=datastax/dse-server:${{ matrix.dse-version }}) nodetool status
- name: Build project
run: mvn clean install -DskipTests -B -V
- name: Run integration tests
run: |
PROFILE_ARG=""
if [ "${{ github.event.inputs.test_profile }}" = "long" ] || [ "${{ github.event_name }}" = "schedule" ]; then
PROFILE_ARG="-Pmedium -Plong"
elif [ "${{ github.event.inputs.test_profile }}" = "medium" ]; then
PROFILE_ARG="-Pmedium"
fi
mvn verify $PROFILE_ARG -B -V \
-Dmaven.test.failure.ignore=true \
-Dmax.simulacron.clusters=2 \
-Dmax.ccm.clusters=1
env:
DSE_VERSION: ${{ matrix.dse-version }}
- name: Publish Test Results
uses: EnricoMi/publish-unit-test-result-action@v2
if: always()
with:
files: |
**/target/surefire-reports/TEST-*.xml
**/target/failsafe-reports/TEST-*.xml
check_name: Integration Test Results (DSE ${{ matrix.dse-version }})
- name: Upload test results
if: always()
uses: actions/upload-artifact@v6
with:
name: integration-test-results-dse-${{ matrix.dse-version }}
path: |
**/target/surefire-reports/
**/target/failsafe-reports/
retention-days: 7