Skip to content

Add a JSON Schema benchmark case #258

Add a JSON Schema benchmark case

Add a JSON Schema benchmark case #258

Workflow file for this run

name: PR Benchmark Preview
permissions:
contents: write
pull-requests: write
on:
pull_request:
branches: ["main"]
paths:
- "bench/**"
- "schemas/**"
jobs:
build-schemas:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
repository: ${{ github.event.pull_request.head.repo.full_name || github.repository }}
ref: ${{ github.head_ref }}
- name: Setup environment
uses: ./.github/actions/environments
- name: Build schemas
shell: bash
env:
TTSC_CACHE_DIR: ${{ runner.temp }}/ttsc-cache
TTSC_GO_CACHE_DIR: ${{ runner.temp }}/ttsc-go-build
run: pnpm schemas:build
- name: Upload schemas
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: schemas-build
path: schemas/dist/
retention-days: 1
bench-stack:
needs: build-schemas
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
repository: ${{ github.event.pull_request.head.repo.full_name || github.repository }}
ref: ${{ github.head_ref }}
- name: Download schemas
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
with:
name: schemas-build
path: schemas/dist/
- name: Setup environment
uses: ./.github/actions/environments
- name: Run stack benchmark
run: pnpm bench:stack
- name: Upload stack results
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: stack-results
path: bench/stack.json
bench-download:
needs: build-schemas
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
repository: ${{ github.event.pull_request.head.repo.full_name || github.repository }}
ref: ${{ github.head_ref }}
- name: Download schemas
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
with:
name: schemas-build
path: schemas/dist/
- name: Setup environment
uses: ./.github/actions/environments
- name: Run download benchmark
env:
TTSC_CACHE_DIR: ${{ runner.temp }}/ttsc-cache
TTSC_GO_CACHE_DIR: ${{ runner.temp }}/ttsc-go-build
run: pnpm bench:download
- name: Upload download results
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: download-results
path: |
bench/download.json
schemas/libraries/**/download_compiled/**
bench-bench:
needs: build-schemas
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
repository: ${{ github.event.pull_request.head.repo.full_name || github.repository }}
ref: ${{ github.head_ref }}
- name: Download schemas
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
with:
name: schemas-build
path: schemas/dist/
- name: Setup environment
uses: ./.github/actions/environments
- name: Run bench benchmark
run: pnpm bench:bench
- name: Upload bench results
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: bench-results
path: bench/bench.json
collect-results:
needs: [bench-stack, bench-download, bench-bench]
if: github.event.pull_request.head.repo.full_name == github.repository
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
ref: ${{ github.head_ref }}
- parallel:
- name: Download bench results
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
with:
name: bench-results
path: bench
- name: Download stack results
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
with:
name: stack-results
path: bench
- name: Download download results
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
with:
name: download-results
path: .
- name: Commit & Push changes
uses: actions-js/push@master
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
branch: ${{ github.head_ref }}
message: "Update bench results"