Fix cassandra-stress: copy binaries from the service container #2
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: cassandra-stress | |
| on: | |
| push: | |
| branches: [main] | |
| paths: | |
| - 'frameworks/database/cassandra-stress/**' | |
| - '.github/workflows/cassandra-stress.yml' | |
| pull_request: | |
| paths: | |
| - 'frameworks/database/cassandra-stress/**' | |
| - '.github/workflows/cassandra-stress.yml' | |
| workflow_dispatch: | |
| permissions: | |
| contents: read | |
| concurrency: | |
| group: cassandra-stress-${{ github.ref }} | |
| cancel-in-progress: true | |
| jobs: | |
| benchmark: | |
| runs-on: ubuntu-latest | |
| services: | |
| cassandra: | |
| image: cassandra:5 | |
| ports: | |
| - 9042:9042 | |
| env: | |
| CASSANDRA_DC: dc1 | |
| # Cassandra's JVM startup is slow (30-60s on a warm image, | |
| # longer on a cold pull), so the healthcheck is generous: | |
| # a 2 min start-period before failures count, with retries | |
| # and interval tuned to match. run.sh additionally gates on | |
| # an explicit cqlsh wait loop before invoking stress. | |
| options: >- | |
| --health-cmd "cqlsh -e 'describe keyspaces'" | |
| --health-interval 15s | |
| --health-timeout 10s | |
| --health-retries 20 | |
| --health-start-period 120s | |
| defaults: | |
| run: | |
| working-directory: frameworks/database/cassandra-stress | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Install cassandra-stress and cqlsh from service container | |
| # Neither cassandra-stress nor cqlsh are packaged in Ubuntu | |
| # 24.04's default apt repos ("E: Unable to locate package | |
| # cassandra-tools"). We pull them out of the running Cassandra | |
| # service container instead — cassandra:5 already ships them | |
| # under /opt/cassandra/bin/. We also need Java for the stress | |
| # JAR to run. | |
| run: | | |
| # Find the service container (GitHub Actions names it | |
| # deterministically using the service key). | |
| CONTAINER=$(docker ps --filter 'name=cassandra' --format '{{.Names}}' | head -n 1) | |
| if [[ -z "${CONTAINER}" ]]; then | |
| echo "ERROR: no cassandra service container running" >&2 | |
| docker ps >&2 | |
| exit 1 | |
| fi | |
| sudo mkdir -p /opt/cassandra | |
| docker cp "${CONTAINER}:/opt/cassandra/." /opt/cassandra/ | |
| sudo ln -sf /opt/cassandra/bin/cassandra-stress /usr/local/bin/cassandra-stress | |
| sudo ln -sf /opt/cassandra/bin/cqlsh /usr/local/bin/cqlsh | |
| cassandra-stress version || true | |
| cqlsh --version | |
| working-directory: ${{ github.workspace }} | |
| - name: Set up Java (runtime for cassandra-stress) | |
| uses: actions/setup-java@v4 | |
| with: | |
| distribution: temurin | |
| java-version: '11' | |
| - name: Run sample benchmark | |
| run: ./run.sh | |
| - name: Upload output as artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: cassandra-stress-output | |
| path: | | |
| frameworks/database/cassandra-stress/output-write.txt | |
| frameworks/database/cassandra-stress/output-read.txt | |
| frameworks/database/cassandra-stress/output-mixed.txt | |
| if-no-files-found: error |