Skip to content

fix: withSchema not applying for delete query using clause. #327

fix: withSchema not applying for delete query using clause.

fix: withSchema not applying for delete query using clause. #327

Workflow file for this run

name: bench
permissions:
contents: read
on:
push:
branches:
- master
paths-ignore:
- '.github/workflows/preview.yml'
- 'assets/**'
- 'docs/**'
- 'example/**'
- 'site/**'
- '.gitignore'
- '.node-version'
- '.npmrc'
- '.nvmrc'
- '.prettierignore'
- '.prettierrc.json'
- '*.md'
- 'deno*'
- 'jsr*'
- 'LICENSE'
- 'outdated-typescript.d.ts'
pull_request:
paths-ignore:
- '.github/workflows/preview.yml'
- 'assets/**'
- 'docs/**'
- 'example/**'
- 'site/**'
- '.gitignore'
- '.node-version'
- '.npmrc'
- '.nvmrc'
- '.prettierignore'
- '.prettierrc.json'
- '*.md'
- 'deno*'
- 'jsr*'
- 'LICENSE'
- 'outdated-typescript.d.ts'
workflow_dispatch:
jobs:
typescript:
name: TypeScript Benchmarks
permissions:
pull-requests: write
runs-on: ubuntu-latest
steps:
- name: Harden Runner
uses: step-security/harden-runner@95d9a5deda9de15063e7595e9719c11c38c90ae2 # v2.13.2
with:
egress-policy: audit
- uses: actions/checkout@1af3b93b6815bc44a9784bd300feb67ff0d1eeb3 # v6.0.0
- name: Install pnpm
uses: pnpm/action-setup@41ff72655975bd51cab0327fa583b6e92b6d3061 # v4.2.0
- name: Use Node.js
uses: actions/setup-node@2028fbc5c25fe9cf00d9f06a71cc4710d4507903 # v6.0.0
with:
cache: 'pnpm'
node-version: lts/*
- name: Install dependencies
run: pnpm install
- name: Run benchmarks
id: bench
run: |
# Run the benchmark command and capture its exit code
pnpm bench:ts > /tmp/benchmark_output.txt 2>&1
exit_code=$?
# Process the output
summary_output=$(cat /tmp/benchmark_output.txt | grep -v "> " | sed '/./,$!d')
# Set a boolean output indicating if it failed with exit code 1
if [ $exit_code -eq 1 ]; then
echo "benchmark_failed=true" >> $GITHUB_OUTPUT
else
echo "benchmark_failed=false" >> $GITHUB_OUTPUT
fi
echo "full_summary<<EOF" >> $GITHUB_OUTPUT
echo "$summary_output" >> $GITHUB_OUTPUT
echo "EOF" >> $GITHUB_OUTPUT
- name: Analyze Results
id: analyze
run: |
full_summary="${{ steps.bench.outputs.full_summary }}"
# This powerful awk script performs two actions:
# 1. It finds blocks missing a Delta line and calculates it.
# 2. It filters for all blocks where the final delta is not zero.
changed_blocks=$(echo "$full_summary" | awk '
BEGIN { RS="" } # Process the input in blocks separated by blank lines
{
block_text = $0 # Store the original block text
is_changed = 0
# If a block is missing a Delta line, calculate it
if ($0 ~ /Baseline:/ && $0 !~ /Delta:/) {
# Extract numeric values for Result and Baseline
match($0, /Result: ([0-9.]+)/, r)
match($0, /Baseline: ([0-9.]+)/, b)
result_val = r[1]
baseline_val = b[1]
# Calculate the delta, avoiding division by zero
if (baseline_val > 0) {
delta = ((result_val / baseline_val) - 1) * 100
# Append the newly calculated, formatted Delta line to the block
block_text = sprintf("%s\n📊 Delta: %+.2f%%", block_text, delta)
}
}
# Now, check the (potentially modified) block for a non-zero delta.
# This works for both pre-existing deltas and the ones we just calculated.
if (block_text ~ /Delta:/ && block_text !~ /Delta: (\+)?0\.00%/) {
# Filter out any summary lines that are not part of a benchmark block
if (block_text ~ /🏌️/) {
print block_text "\n" # Print the complete, changed block
}
}
}')
if [ -n "$changed_blocks" ]; then
echo "has_changes=true" >> $GITHUB_OUTPUT
echo "changed_blocks<<EOF" >> $GITHUB_OUTPUT
echo "$changed_blocks" >> $GITHUB_OUTPUT
echo "EOF" >> $GITHUB_OUTPUT
else
echo "has_changes=false" >> $GITHUB_OUTPUT
fi
- name: PR Comment on Changes
if: steps.analyze.outputs.has_changes == 'true' && github.event_name == 'pull_request' && github.event.pull_request.head.repo.fork == false
uses: thollander/actions-comment-pull-request@24bffb9b452ba05a4f3f77933840a6a841d1b32b # v3.0.1
with:
comment-tag: typescript-benchmarks
message: |
<details>
<summary>⏱️ <strong>Benchmark changes detected</strong> following ${{ github.event.pull_request.head.sha }}</summary>
The following benchmarks have changed from the baseline:
```
${{ steps.analyze.outputs.changed_blocks }}
```
</details>
- name: PR Comment on No Changes
if: steps.analyze.outputs.has_changes == 'false' && github.event_name == 'pull_request' && github.event.pull_request.head.repo.fork == false
uses: thollander/actions-comment-pull-request@24bffb9b452ba05a4f3f77933840a6a841d1b32b # v3.0.1
with:
comment-tag: typescript-benchmarks
message: ✅ ⏱️ **No benchmark changes detected** following ${{ github.event.pull_request.head.sha }}.
- name: Fail job if benchmark command failed
if: steps.bench.outputs.benchmark_failed == 'true'
run: |
echo "Benchmark command failed with exit code 1"
exit 1