Skip to content

Schedule Durable tests #1812

Schedule Durable tests

Schedule Durable tests #1812

name: Schedule Durable tests
on:
schedule:
- cron: "0 0/8 * * *" # Every 8 hours on the hour
workflow_dispatch:
inputs:
environment:
type: choice
description: Durable infrastructure to run tests against
required: true
default: dev
options:
- dev
- qa
- tnet
- prod
test_selector:
type: string
description: Path regex passed to Jest to select which tests to run
required: true
default: correctness/fast
env:
AWS_REGION: ${{ secrets.AWS_REGION }}
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
jobs:
publish-suite:
name: Publish Suite
runs-on: ubuntu-latest
outputs:
build_tag: ${{ steps.generate-build-tag.outputs.build_tag }}
steps:
-
uses: actions/checkout@v3
-
name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
-
name: Login to Public ECR
uses: docker/login-action@v2
with:
registry: public.ecr.aws
username: ${{ env.AWS_ACCESS_KEY_ID }}
password: ${{ env.AWS_SECRET_ACCESS_KEY }}
env:
AWS_REGION: us-east-1
-
name: Generate build tag
id: generate-build-tag
run: |
# Choose unique name for this build
BUILD_TAG="$(echo ${{ github.sha }} | head -c 8)-${{ github.run_id }}"
echo "Build tag:"
echo ${BUILD_TAG}
echo "build_tag=${BUILD_TAG}" >> $GITHUB_OUTPUT
cat $GITHUB_OUTPUT
-
name: Build and Publish
run: make BUILD_TAG=${{ steps.generate-build-tag.outputs.build_tag }} publish-suite
schedule-job:
name: Schedule test job
runs-on: ubuntu-latest
needs:
- publish-suite
strategy:
fail-fast: false
matrix:
network: [dev, qa, tnet, prod]
steps:
-
uses: actions/checkout@v3
-
name: Get branch name
run: echo "branch=${GITHUB_HEAD_REF:-${GITHUB_REF#refs/heads/}}" >> $GITHUB_OUTPUT
id: get_branch
-
name: Schedule ${{ matrix.network }}
# A scheduled run will not include any inputs, so we treat it as needing to test all networks.
if: ${{ github.event.inputs.environment == null || github.event.inputs.environment == matrix.network }}
env:
BUILD_TAG: ${{ needs.publish-suite.outputs.build_tag }}
DURABLE_ENV: ${{ matrix.network }}
# This allows running durable tests using the "run-durable.yml" workflow from the same branch. If there are no
# changes to that workflow, then it'll be the same as "main", but if there are changes, we want the two
# workflows to run as a pair. The CD manager will pass the branch name along as an input to the
# "workflow_dispatch" API call.
DURABLE_TEST_BRANCH: ${{ steps.get_branch.outputs.branch }}
run: |
# For scheduled events, "test_selector" will be null. Run all tests for QA but only "fast" ones for other
# envs.
test_selector=${{ github.event.inputs.test_selector || 'correctness/fast' }}
if [[ ${{ github.event.inputs.test_selector == null }} == 'true' ]]; then
if [[ ${{ matrix.network == 'qa' }} == 'true' ]]; then
test_selector="correctness"
fi
fi
make TEST_SELECTOR="$test_selector" schedule-durable-tests