Skip to content

Action inputs to dispatch n-runs of a single test in CI #3

Action inputs to dispatch n-runs of a single test in CI

Action inputs to dispatch n-runs of a single test in CI #3

Workflow file for this run

name: All Tests
on:
pull_request:
push:
branches:
- main
- release/**
- cloud/**
workflow_dispatch:
inputs:
commit:
description: "Commit SHA"
required: true
run_single_functional_test:
description: "Whether to run a single test. If so, the rest of the input fields are required."
type: boolean
default: false
n_runs:
description: "[Single Test Only] Number of times to repeat the single test per database type"
type: number
default: 1
test_name:
description: "[Single Test Only] Name of the test suite to run, include -testify.m flag here if desired (i.e. 'TestAcquireShard_DeadlineExceededErrorSuite' or 'TestFunctionalSuite -testify.m=TestUpdateWorkflow')"
type: string
timeout_minutes:
description: "[Single Test Only] test timeout in minutes"
type: number
default: 120
concurrency: # Auto-cancel existing runs in the PR when a new commit is pushed
group: run-tests-${{ github.head_ref || github.run_id }}
cancel-in-progress: true
env:
# For workflow_dispatch: use the given commit.
# For pull_request: use the head of the PR branch (not the merge branch which is the default!)
# For push: use the pushed commit.
COMMIT: ${{ github.event.inputs.commit || github.event.pull_request.head.sha || github.sha }}
PR_BASE_COMMIT: ${{ github.event.pull_request.base.sha }}
DOCKER_COMPOSE_FILE: ./develop/github/docker-compose.yml
TEMPORAL_VERSION_CHECK_DISABLED: 1
BUILDKITE_ANALYTICS_TOKEN: ${{ secrets.BUILDKITE_ANALYTICS_TOKEN }}
jobs:
misc-checks:
if: ${{ inputs.run_single_functional_test != true }}
name: Misc checks
strategy:
fail-fast: false
matrix:
runs-on: [ubuntu-20.04]
runs-on: ${{ matrix.runs-on }}
steps:
- run: echo "misc checks"
set-up-functional-test:
name: Set up functional test
runs-on: ubuntu-20.04
outputs:
shard_indices: ${{ steps.generate_output.outputs.shard_indices }}
total_shards: ${{ steps.generate_output.outputs.shards }}
github_timeout: ${{ steps.generate_output.outputs.github_timeout }}
test_timeout: ${{ steps.generate_output.outputs.test_timeout }}
single_test_args: ${{ steps.generate_output.outputs.single_test_args }}
steps:
- id: generate_output
run: |
shards=3
timeout=30
if [[ "${{ inputs.run_single_functional_test }}" == "true" ]]; then
shards=1
timeout=${{ inputs.timeout_minutes }}
single_test_args="-test.run ${{ inputs.test_name }} -count ${{ inputs.n_runs }}"
fi
{
echo "shard_indices=[$(seq -s, 0 $((shards-1)))]"
echo "shards=$shards"
echo "github_timeout=$((timeout+5))"
echo "test_timeout=${timeout}m"
echo "single_test_args=$single_test_args"
} >> "$GITHUB_OUTPUT"