name: Reusable test on: workflow_call: inputs: runs_on: description: Runner to run the job on required: true type: string container: description: "The container object as a JSON string (leave empty to run natively)" required: true type: string compiler: description: 'Compiler the binaries were built with ("gcc", "clang" or "apple-clang")' required: true type: string sanitizers: description: 'Sanitizers the binaries were built with ("address", "thread", "undefinedbehavior" or empty)' required: false type: string default: "" build_type: description: Build type required: true type: string run_unit_tests: description: Whether to run unit tests required: true type: boolean run_integration_tests: description: Whether to run integration tests required: true type: boolean defaults: run: shell: bash jobs: unit_tests: name: Unit testing runs-on: ${{ inputs.runs_on }} container: ${{ inputs.container != '' && fromJson(inputs.container) || null }} if: ${{ inputs.run_unit_tests }} steps: - name: Cleanup workspace if: ${{ runner.os == 'macOS' }} uses: XRPLF/actions/cleanup-workspace@c7d9ce5ebb03c752a354889ecd870cadfc2b1cd4 - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 with: fetch-depth: 0 - name: Generate build identifier uses: ./.github/actions/build-identifier id: build_identifier with: build_type: ${{ inputs.build_type }} compiler: ${{ inputs.compiler }} # code_coverage is run inside build environment code_coverage: false sanitizers: ${{ inputs.sanitizers }} - uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1 with: name: clio_tests_${{ steps.build_identifier.outputs.build_identifier }} - name: Make clio_tests executable run: chmod +x ./clio_tests - name: Run clio_tests continue-on-error: true id: run_clio_tests run: ./clio_tests - name: Create an issue if: ${{ steps.run_clio_tests.outcome == 'failure' && inputs.sanitizers != '' }} uses: XRPLF/actions/create-issue@2b8bc36af85b88bca0dd7bfac2e2dc05f94ad712 with: title: "[${{ inputs.compiler }} ${{ inputs.sanitizers }}] reported issues" body: "Clio tests failed one or more sanitizers checks when built with `${{ inputs.compiler }}` and the `${{ inputs.sanitizers }}` sanitizers." labels: "bug" assignees: "godexsoft,kuznetsss,mathbunnyru" - name: Fail the job if clio_tests failed if: ${{ steps.run_clio_tests.outcome == 'failure' }} run: exit 1 integration_tests: name: Integration testing runs-on: ${{ inputs.runs_on }} container: ${{ inputs.container != '' && fromJson(inputs.container) || null }} if: ${{ inputs.run_integration_tests }} services: scylladb: image: ${{ inputs.container != '' && 'scylladb/scylla:2026.1' || '' }} options: >- --health-cmd "cqlsh -e 'describe cluster'" --health-interval 10s --health-timeout 5s --health-retries 5 steps: - name: Cleanup workspace if: ${{ runner.os == 'macOS' }} uses: XRPLF/actions/cleanup-workspace@c7d9ce5ebb03c752a354889ecd870cadfc2b1cd4 - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 with: fetch-depth: 0 - name: Generate build identifier uses: ./.github/actions/build-identifier id: build_identifier with: build_type: ${{ inputs.build_type }} compiler: ${{ inputs.compiler }} # code_coverage is run inside build environment code_coverage: false sanitizers: ${{ inputs.sanitizers }} - name: Delete and start colima (macOS) # This is a temporary workaround for colima issues on macOS runners if: ${{ runner.os == 'macOS' }} run: | colima delete --force colima start - name: Remove leftover scylladb container (macOS) # A previous run that didn't clean up (e.g. a cancelled job) can leave the # container behind, otherwise the name is still taken on the persistent runner. if: ${{ runner.os == 'macOS' }} run: docker rm --force scylladb || true - name: Spin up scylladb (macOS) if: ${{ runner.os == 'macOS' }} timeout-minutes: 1 run: | docker run \ --detach \ --name scylladb \ --health-cmd "cqlsh -e 'describe cluster'" \ --health-interval 10s \ --health-timeout 5s \ --health-retries 5 \ --publish 9042:9042 \ --memory 16G \ scylladb/scylla:2026.1 - name: Wait for scylladb container to be healthy (macOS) if: ${{ runner.os == 'macOS' }} timeout-minutes: 1 run: | until [ "$(docker inspect -f '{{.State.Health.Status}}' scylladb)" == "healthy" ]; do sleep 1 done - uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1 with: name: clio_integration_tests_${{ steps.build_identifier.outputs.build_identifier }} - name: Run clio_integration_tests run: | chmod +x ./clio_integration_tests ./clio_integration_tests ${{ runner.os != 'macOS' && '--backend_host=scylladb' || '' }} - name: Show docker logs and stop scylladb if: ${{ always() && runner.os == 'macOS' }} run: | docker logs scylladb docker rm --force scylladb || true