Files
discordeno/.github/workflows/benchmark.yml
Jonathan Ho aba7de6e3b benchmark test (#2830)
* ci: test

* ci: add script

* ci: change to js

* ci: test

* ci: fix error

* ci: fix script

* chore: add benchmark

* ci: fix need input

* fix: read file with dir

* ci: change push to trigger on main only

* ci: try new method

* ci: fix "true"

* chore: fix set output

* fix: set output

* ci: increase number of try

* chore: clean up dir

* fix needs

* bench: add memory bench

* bench: import memory bench

* bench: fix v19 syntax

* bench: more fix

* bench: add filter

* bench: minor fix

* ci: read file in sync

* chore: yarn install

* chore: add db to ignore

* refactor(bench): use loader

* bench: only bench on one event

* bench: add type to db event

* chore(bench): better type

* bench: add rest simplifyUrl bench

* chore: add microtime

* refactor: add fall back

* Revert "ci: change push to trigger on main only"

This reverts commit 04df971025.

* chore: yarn install

* ci: trigger push event only on main branch

* chore(bench): use node-fetch

* refactor(bench): make it work with other function and event

* chore(bench): better name
2023-03-31 07:57:53 +00:00

52 lines
1.6 KiB
YAML

name: Benchmark
on:
workflow_call:
outputs:
cpuMatch:
value: ${{ jobs.benchmark.outputs.cpuMatch }}
jobs:
benchmark:
name: Benchmark
runs-on: ubuntu-latest
outputs:
cpuMatch: ${{ steps.cpuCheck.outputs.match }}
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 18
- name: Check cpu model
id: cpuCheck
run: node ./scripts/checkCpuModel.js
- name: Get yarn cache directory path
if: ${{ steps.cpuCheck.outputs.match == 'true' }}
id: yarn-cache-dir-path
run: echo "dir=$(yarn config get cacheFolder)" >> $GITHUB_OUTPUT
- uses: actions/cache@v3
if: ${{ steps.cpuCheck.outputs.match == 'true' }}
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
- run: yarn install --immutable
if: ${{ steps.cpuCheck.outputs.match == 'true' }}
- name: Build
if: ${{ steps.cpuCheck.outputs.match == 'true' }}
run: yarn build
#
- name: Download db from benchmark repo
if: ${{ steps.cpuCheck.outputs.match == 'true' }}
run: wget https://github.com/discordeno/benchmarks/raw/main/db.tar.gz
- name: Decompress db
if: ${{ steps.cpuCheck.outputs.match == 'true' }}
run: tar -xzvf db.tar.gz
- name: Benchmark
if: ${{ steps.cpuCheck.outputs.match == 'true' }}
run: node --expose-gc ./packages/benchmark/dist/index.js