emoji-picker-element/.github/workflows/benchmarks.yml

88 lines
3.2 KiB
YAML

# Largely borrowed from https://github.com/lit/lit/blob/56e8efd/.github/workflows/benchmarks.yml
name: Benchmarks
on: [pull_request]
jobs:
benchmarks:
name: benchmarks
# We can't currently run benchmarks on PRs from forked repos, because the
# tachometer action reports results by posting a comment, and we can't post
# comments without a github token.
if: github.event.pull_request == null || github.event.pull_request.head.repo.full_name == github.repository
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v1
with:
node-version: 14
# via https://github.com/actions/cache/blob/0638051/examples.md#node---yarn
- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "::set-output name=dir::$(yarn cache dir)"
- uses: actions/cache@v2
id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`)
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
- name: yarn install
if: steps.cache.outputs.cache-hit != 'true'
run: |
yarn --immutable --ignore-scripts
# install the chromedriver corresponding to whatever version of chrome is installed
yarn add --ignore-scripts chromedriver@^$(google-chrome --version | awk '{print $3}' | cut -d. -f1)
PERF=1 yarn build:rollup
./bin/setup-benchmark.sh
# first-load
- name: Benchmark first-load
run: |
./node_modules/.bin/tach \
--config ./test/benchmark/first-load.tachometer.json \
--json-file ./test/benchmark/first-load.results.json
- name: Report first-load
uses: andrewiggins/tachometer-reporter-action@v2
with:
report-id: emoji-picker-element-first-load
path: test/benchmark/first-load.results.json
pr-bench-name: this-change
base-bench-name: tip-of-tree
# second-load
- name: Benchmark second-load
run: |
./node_modules/.bin/tach \
--config ./test/benchmark/second-load.tachometer.json \
--json-file ./test/benchmark/second-load.results.json
- name: Report second-load
uses: andrewiggins/tachometer-reporter-action@v2
with:
report-id: emoji-picker-element-second-load
path: test/benchmark/second-load.results.json
pr-bench-name: this-change
base-bench-name: tip-of-tree
# database-interactions
- name: Benchmark database-interactions
run: |
./node_modules/.bin/tach \
--config ./test/benchmark/database-interactions.tachometer.json \
--json-file ./test/benchmark/database-interactions.results.json
- name: Report database-interactions
uses: andrewiggins/tachometer-reporter-action@v2
with:
report-id: emoji-picker-element-database-interactions
path: test/benchmark/database-interactions.results.json
pr-bench-name: this-change
base-bench-name: tip-of-tree