Support protocol v5 and CI improvements #506
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: ZDM Tests | |
| on: | |
| push: | |
| branches: [ "main" ] | |
| pull_request: | |
| branches: [ "main" ] | |
| # Allows you to run this workflow manually from the Actions tab | |
| workflow_dispatch: | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} | |
| cancel-in-progress: true | |
| env: | |
| SIMULACRON_VERSION: 0.10.0 | |
| GO_VERSION: 1.24.2 | |
| jobs: | |
| dependencies: | |
| name: Fetch dependencies | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/cache@v4 | |
| id: restore-go | |
| with: | |
| path: ~/deps/godl | |
| key: ${{ runner.os }}-deps-godl-${{ env.GO_VERSION }} | |
| - uses: actions/cache@v4 | |
| id: restore-simulacron | |
| with: | |
| path: ~/deps/simulacron | |
| key: ${{ runner.os }}-deps-simulacron-${{ env.SIMULACRON_VERSION }} | |
| - if: ${{ steps.restore-go.outputs.cache-hit != 'true' }} | |
| name: Download Go | |
| continue-on-error: true | |
| run: | | |
| mkdir -p ~/deps/godl | |
| cd ~/deps/godl | |
| wget -O go.tar.gz https://go.dev/dl/go${{ env.GO_VERSION }}.linux-amd64.tar.gz | |
| - if: ${{ steps.restore-simulacron.outputs.cache-hit != 'true' }} | |
| name: Download simulacron | |
| continue-on-error: true | |
| run: | | |
| mkdir -p ~/deps/simulacron | |
| cd ~/deps/simulacron | |
| wget -O simulacron.jar https://github.com/datastax/simulacron/releases/download/${{ env.SIMULACRON_VERSION }}/simulacron-standalone-${{ env.SIMULACRON_VERSION }}.jar | |
| # Runs a NoSQLBench job in docker-compose with 3 proxy nodes | |
| # Verifies the written data matches in both ORIGIN and TARGET clusters | |
| nosqlbench-tests: | |
| name: NoSQLBench Tests | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v2 | |
| - name: Start docker-compose | |
| id: compose | |
| run: | | |
| docker compose -f docker-compose-tests.yml up --abort-on-container-exit --exit-code-from=nosqlbench4 | |
| - name: Test Summary | |
| if: ${{ failure() }} | |
| run: | | |
| docker container ls --all | grep zdm_tests_nb | awk '{print $1}' | xargs -I {} docker container cp {}:/logs reports | |
| cat reports/*.summary >> $GITHUB_STEP_SUMMARY | |
| # Runs all the unit tests under the proxy module (all the *_test.go files) | |
| unit-tests: | |
| name: Unit Tests | |
| needs: dependencies | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v2 | |
| - uses: actions/cache@v4 | |
| id: restore-go | |
| with: | |
| path: ~/deps/godl | |
| key: ${{ runner.os }}-deps-godl-${{ env.GO_VERSION }} | |
| - name: Run | |
| run: | | |
| sudo apt update | |
| sudo apt -y install default-jre gcc git wget | |
| sudo tar -xzf ~/deps/godl/go.tar.gz -C /usr/local/ | |
| export PATH=$PATH:/usr/local/go/bin | |
| export PATH=$PATH:`go env GOPATH`/bin | |
| go install github.com/jstemmer/go-junit-report/v2@latest | |
| go test -v 2>&1 ./proxy/... | go-junit-report -set-exit-code -iocopy -out report-unit.xml | |
| - name: Test Summary | |
| uses: test-summary/action@v1 | |
| if: always() | |
| with: | |
| paths: | | |
| report-unit.xml | |
| # Runs mock tests defined under integration-tests | |
| # These tests use Simulacron and in-memory CQLServer | |
| integration-tests-mock: | |
| name: Mock Tests | |
| needs: dependencies | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v2 | |
| - uses: actions/cache@v4 | |
| id: restore-go | |
| with: | |
| path: ~/deps/godl | |
| key: ${{ runner.os }}-deps-godl-${{ env.GO_VERSION }} | |
| - uses: actions/cache@v4 | |
| id: restore-simulacron | |
| with: | |
| path: ~/deps/simulacron | |
| key: ${{ runner.os }}-deps-simulacron-${{ env.SIMULACRON_VERSION }} | |
| - name: Run | |
| run: | | |
| sudo apt update | |
| sudo apt -y install openjdk-8-jdk gcc git wget | |
| sudo tar -xzf ~/deps/godl/go.tar.gz -C /usr/local/ | |
| export PATH=$PATH:/usr/local/go/bin | |
| export PATH=$PATH:`go env GOPATH`/bin | |
| go install github.com/jstemmer/go-junit-report/v2@latest | |
| cp ~/deps/simulacron/simulacron.jar . | |
| export SIMULACRON_PATH=`pwd`/simulacron.jar | |
| go test -timeout 180m -v 2>&1 ./integration-tests | go-junit-report -set-exit-code -iocopy -out report-integration-mock.xml | |
| - name: Test Summary | |
| uses: test-summary/action@v1 | |
| if: always() | |
| with: | |
| paths: | | |
| report-integration-mock.xml | |
| # Runs integration tests using CCM | |
| integration-tests-ccm: | |
| name: CCM Tests | |
| needs: dependencies | |
| runs-on: ubuntu-latest | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| cassandra_version: [ '2.2.19', '3.11.19', '4.1.9', '5.0.6' ] | |
| steps: | |
| - uses: actions/checkout@v2 | |
| - uses: actions/cache@v4 | |
| id: restore-go | |
| with: | |
| path: ~/deps/godl | |
| key: ${{ runner.os }}-deps-godl-${{ env.GO_VERSION }} | |
| - uses: actions/cache@v4 | |
| id: restore-cache-ccm | |
| with: | |
| path: ~/.ccm/repository | |
| key: ${{ runner.os }}-ccm-${{ matrix.cassandra_version }} | |
| - name: Run | |
| run: | | |
| sudo apt update | |
| sudo apt -y install openjdk-8-jdk gcc git wget pip | |
| sudo apt -y install openjdk-11-jdk gcc git wget pip | |
| export JAVA_HOME=/usr/lib/jvm/java-11-openjdk-amd64 | |
| export JAVA8_HOME=/usr/lib/jvm/java-8-openjdk-amd64 | |
| export JAVA11_HOME=/usr/lib/jvm/java-11-openjdk-amd64 | |
| export PATH=$JAVA_HOME/bin:$PATH | |
| java -version | |
| sudo tar -xzf ~/deps/godl/go.tar.gz -C /usr/local/ | |
| export PATH=$PATH:/usr/local/go/bin | |
| export PATH=$PATH:`go env GOPATH`/bin | |
| go install github.com/jstemmer/go-junit-report/v2@latest | |
| CCM_VERSION="0e20102c1cad99104969239f1ac375b6fcaa7bbc" | |
| export CCM_VERSION | |
| echo "Install CCM ${CCM_VERSION}" | |
| pip install "git+https://github.com/apache/cassandra-ccm.git@${CCM_VERSION}" | |
| which ccm | |
| sudo ln -s /home/runner/.local/bin/ccm /usr/local/bin/ccm | |
| /usr/local/bin/ccm list | |
| go test -timeout 180m -v 2>&1 ./integration-tests -RUN_MOCKTESTS=false -RUN_CCMTESTS=true -CASSANDRA_VERSION=${{ matrix.cassandra_version }} | go-junit-report -set-exit-code -iocopy -out report-integration-ccm.xml | |
| - uses: actions/cache/save@v4 | |
| if: always() | |
| with: | |
| path: ~/.ccm/repository | |
| key: ${{ runner.os }}-ccm-${{ matrix.cassandra_version }} | |
| - name: Test Summary | |
| uses: test-summary/action@v1 | |
| if: always() | |
| with: | |
| paths: | | |
| report-integration-ccm.xml | |
| # Runs the mock tests with go's race checker to spot potential data races | |
| race-checker: | |
| name: Race Checker | |
| needs: dependencies | |
| runs-on: ubuntu-latest | |
| if: ${{ false }} # temporarily disabled | |
| steps: | |
| - uses: actions/checkout@v2 | |
| - uses: actions/cache@v4 | |
| id: restore-simulacron | |
| with: | |
| path: ~/deps/simulacron | |
| key: ${{ runner.os }}-deps-simulacron-${{ env.SIMULACRON_VERSION }} | |
| - uses: actions/cache@v4 | |
| id: restore-go | |
| with: | |
| path: ~/deps/godl | |
| key: ${{ runner.os }}-deps-godl-${{ env.GO_VERSION }} | |
| - name: Run | |
| run: | | |
| sudo apt update | |
| sudo apt -y install openjdk-8-jdk gcc git pip wget | |
| sudo tar -xzf ~/deps/godl/go.tar.gz -C /usr/local/ | |
| export PATH=$PATH:/usr/local/go/bin | |
| export PATH=$PATH:`go env GOPATH`/bin | |
| go install github.com/jstemmer/go-junit-report/v2@latest | |
| cp ~/deps/simulacron/simulacron.jar . | |
| export SIMULACRON_PATH=`pwd`/simulacron.jar | |
| go test -race -timeout 180m -v 2>&1 ./integration-tests | go-junit-report -set-exit-code -iocopy -out report-integration-race.xml | |
| - name: Test Summary | |
| uses: test-summary/action@v1 | |
| if: always() | |
| with: | |
| paths: | | |
| report-integration-race.xml | |
| # Performs static analysis to check for things like context leaks | |
| go-vet: | |
| name: Go Vet | |
| needs: dependencies | |
| runs-on: ubuntu-latest | |
| if: ${{ false }} # temporarily disabled | |
| steps: | |
| - uses: actions/checkout@v2 | |
| - uses: actions/cache@v4 | |
| id: restore-go | |
| with: | |
| path: ~/deps/godl | |
| key: ${{ runner.os }}-deps-godl-${{ env.GO_VERSION }} | |
| - name: Run | |
| run: | | |
| sudo apt update | |
| sudo apt -y install openjdk-8-jdk gcc git pip wget | |
| sudo tar -xzf ~/deps/godl/go.tar.gz -C /usr/local/ | |
| export PATH=$PATH:/usr/local/go/bin | |
| export PATH=$PATH:`go env GOPATH`/bin | |
| go vet ./... |