Stress tests #8
This file contains 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: Stress tests | |
on: | |
workflow_dispatch: | |
inputs: | |
ref: | |
type: string | |
description: Git ref to run tests on | |
required: true | |
default: main | |
test-type: | |
description: Type of test to run | |
options: | |
- ci-stress | |
- ci-nightly | |
required: true | |
type: choice | |
test-timeout-minutes: | |
description: 'Timeout for the test, in minutes (stress: 20, nightly: 360)' | |
required: true | |
type: number | |
default: 360 | |
reuse-v8-context: | |
description: Whether to enable the "reuse V8 context" feature | |
required: true | |
type: boolean | |
default: true | |
workflow_call: | |
inputs: | |
test-type: | |
required: true | |
type: string | |
test-timeout-minutes: | |
required: true | |
type: number | |
reuse-v8-context: | |
required: true | |
type: boolean | |
env: | |
TEMPORAL_TESTING_LOG_DIR: /tmp/worker-logs | |
TEMPORAL_TESTING_MEM_LOG_DIR: /tmp/worker-mem-logs | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
REUSE_V8_CONTEXT: ${{ inputs.reuse-v8-context }} | |
IS_MAIN_BRANCH: | | |
${{ | |
github.repository == 'temporalio/sdk-typescript' | |
&& (github.ref == 'refs/heads/main' | |
|| startsWith(github.ref, 'refs/tags/') | |
|| startsWith(github.ref, 'refs/heads/releases')) | |
&& github.event_name != 'pull_request' | |
}} | |
jobs: | |
stress-test: | |
runs-on: buildjet-4vcpu-ubuntu-2204 | |
steps: | |
- name: Print build info | |
run: 'echo test-type: ${{ inputs.test-type }}, test-timeout-minutes: ${{ inputs.test-timeout-minutes }}, reuse-v8-context: $REUSE_V8_CONTEXT' | |
- uses: actions/checkout@v4 | |
with: | |
submodules: recursive | |
- name: Install Node | |
uses: actions/setup-node@v4 | |
with: | |
node-version: 20 | |
- name: Get NPM cache directory | |
id: npm-cache-dir | |
run: echo "dir=$(npm config get cache)" >> ${GITHUB_OUTPUT} | |
- name: Restore NPM cache | |
uses: actions/cache/restore@v4 | |
with: | |
path: ${{ steps.npm-cache-dir.outputs.dir }} | |
key: npm-main-linux-x64-${{ hashFiles('./package-lock.json') }} | |
restore-keys: | | |
npm-main-linux-x64- | |
- name: Install Rust | |
uses: dtolnay/rust-toolchain@stable | |
with: | |
target: x86_64-unknown-linux-gnu | |
- name: Install protoc | |
uses: arduino/setup-protoc@v3 | |
with: | |
# TODO: Upgrade proto once https://github.com/arduino/setup-protoc/issues/99 is fixed | |
version: '23.x' | |
repo-token: ${{ secrets.GITHUB_TOKEN }} | |
- name: Rust Cargo and Build cache | |
uses: Swatinem/rust-cache@v2 | |
with: | |
workspaces: packages/core-bridge -> target | |
prefix-key: corebridge-buildcache | |
shared-key: linux-intel | |
env-vars: '' | |
save-if: env.IS_MAIN_BRANCH == 'true' | |
- name: Download dependencies | |
# Make up to 3 attempts to install NPM dependencies, to work around transient NPM errors | |
run: | | |
npm ci --ignore-scripts --verbose || npm ci --ignore-scripts --verbose || npm ci --ignore-scripts --verbose | |
- name: Compile code | |
run: npm run build | |
env: | |
BUILD_CORE_RELEASE: true | |
- name: Install Temporal CLI | |
uses: temporalio/setup-temporal@v0 | |
- name: Run Temporal CLI | |
shell: bash | |
run: | | |
temporal server start-dev --headless --db-filename /tmp/temporal.sqlite3 &> /tmp/devserver.log & | |
- name: Run tests | |
run: | | |
mkdir -p $TEMPORAL_TESTING_LOG_DIR/tails | |
mkdir -p $TEMPORAL_TESTING_MEM_LOG_DIR | |
timeout ${{ inputs.test-timeout-minutes }}m npm run ${{ inputs.test-type }} | |
- run: for f in $TEMPORAL_TESTING_LOG_DIR/*.log; do tail -20000 $f > $TEMPORAL_TESTING_LOG_DIR/tails/$(basename $f); done | |
if: always() | |
- uses: actions/upload-artifact@v4 | |
if: always() | |
with: | |
name: worker-logs-${{ inputs.reuse-v8-context && 'reuse-v8' || 'no-reuse-v8' }} | |
path: ${{ env.TEMPORAL_TESTING_LOG_DIR }}/tails | |
- uses: actions/upload-artifact@v4 | |
if: always() | |
with: | |
name: worker-mem-logs-${{ inputs.reuse-v8-context && 'reuse-v8' || 'no-reuse-v8' }} | |
path: ${{ env.TEMPORAL_TESTING_MEM_LOG_DIR }} | |
- name: Upload Dev Server logs | |
uses: actions/upload-artifact@v4 | |
if: failure() || cancelled() | |
with: | |
name: integration-tests-${{ inputs.reuse-v8-context && 'reuse' || 'noreuse' }}-devserver-logs | |
path: /tmp/devserver.log | |
# TODO: set up alerting | |
# TODO: record test durations and other metrics like memory usage / cache utilization / CPU | |
# TODO: uses prebuilt binaries from ci.yml |