mirror of
https://github.com/yewstack/yew.git
synced 2025-12-08 21:26:25 +00:00
* modernize github workflows this mainly fixes some inconsistencies in style, outdated or wrong comments and action version - replace Legit-Labs/action-download-artifact with actions/download-artifact - fix Swatinem/rust-cache arguments - fix benchmark transformations - expand feature soundness lints - wording and capitalization in comments * fix no_run on crate level doc * fix some more small issues
138 lines
4.1 KiB
YAML
138 lines
4.1 KiB
YAML
name: Benchmark
|
|
|
|
on:
|
|
push:
|
|
paths-ignore:
|
|
- "website/**"
|
|
branches:
|
|
- master
|
|
pull_request:
|
|
paths-ignore:
|
|
- "website/**"
|
|
types: [labeled, synchronize, opened, reopened]
|
|
|
|
# Cancel outstanding benchmarks on pull requests
|
|
# https://docs.github.com/en/actions/writing-workflows/workflow-syntax-for-github-actions#example-using-a-fallback-value
|
|
concurrency:
|
|
group: ${{ github.head_ref || github.run_id }}
|
|
cancel-in-progress: true
|
|
|
|
jobs:
|
|
benchmark:
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
with:
|
|
path: "yew"
|
|
|
|
- uses: actions/checkout@v4
|
|
with:
|
|
repository: krausest/js-framework-benchmark
|
|
path: "js-framework-benchmark"
|
|
|
|
- name: Setup toolchain
|
|
uses: dtolnay/rust-toolchain@master
|
|
with:
|
|
toolchain: stable
|
|
targets: wasm32-unknown-unknown
|
|
|
|
- name: Setup wasm-pack
|
|
uses: jetli/wasm-pack-action@v0.4.0
|
|
|
|
- name: Setup Node
|
|
uses: actions/setup-node@v4
|
|
with:
|
|
node-version: ">=18"
|
|
cache: "npm"
|
|
cache-dependency-path: js-framework-benchmark/package-lock.json
|
|
|
|
- name: Restore Rust cache for yew packages
|
|
uses: Swatinem/rust-cache@v2
|
|
with:
|
|
shared-key: yew-packages
|
|
workspaces: |
|
|
yew
|
|
|
|
- name: Setup chrome
|
|
id: setup-chrome
|
|
uses: browser-actions/setup-chrome@v1
|
|
with:
|
|
install-chromedriver: true
|
|
|
|
- name: Setup js-framework-benchmark
|
|
working-directory: js-framework-benchmark
|
|
run: |
|
|
npm ci
|
|
npm run install-server
|
|
npm run install-webdriver-ts
|
|
|
|
- name: Setup benchmark-struct benchmark
|
|
run: |
|
|
ls -lauh
|
|
rm *.js
|
|
rm *.wasm
|
|
echo "STRUCT_BUILD_DIR=$PWD" >> $GITHUB_ENV
|
|
working-directory: js-framework-benchmark/frameworks/keyed/yew/bundled-dist/
|
|
|
|
- name: Build benchmark-struct app
|
|
working-directory: yew/tools/benchmark-struct
|
|
run: |
|
|
wasm-pack build \
|
|
--release \
|
|
--target web \
|
|
--no-typescript \
|
|
--out-name js-framework-benchmark-yew \
|
|
--out-dir $STRUCT_BUILD_DIR
|
|
|
|
- name: Show built benchmark-struct benchmark files
|
|
run: |
|
|
ls -lauh js-framework-benchmark/frameworks/keyed/yew/bundled-dist/
|
|
|
|
- name: Setup yew-hooks benchmark
|
|
run: |
|
|
ls -lauh
|
|
rm *.js
|
|
rm *.wasm
|
|
echo "HOOKS_BUILD_DIR=$PWD" >> $GITHUB_ENV
|
|
working-directory: js-framework-benchmark/frameworks/keyed/yew-hooks/bundled-dist/
|
|
|
|
- name: Build benchmark-hooks app
|
|
working-directory: yew/tools/benchmark-hooks
|
|
run: |
|
|
wasm-pack build \
|
|
--release \
|
|
--target web \
|
|
--no-typescript \
|
|
--out-name js-framework-benchmark-yew-hooks \
|
|
--out-dir $HOOKS_BUILD_DIR
|
|
|
|
- name: Show built benchmark-hooks benchmark files
|
|
run: |
|
|
ls -lauh js-framework-benchmark/frameworks/keyed/yew-hooks/bundled-dist/
|
|
|
|
- name: Run js-framework-benchmark server
|
|
working-directory: js-framework-benchmark
|
|
run: |
|
|
npm start &
|
|
sleep 5
|
|
|
|
- name: Run js-framework-benchmark/webdriver-ts npm run bench
|
|
working-directory: js-framework-benchmark/webdriver-ts
|
|
run: xvfb-run npm run bench -- --framework keyed/yew keyed/yew-hooks --runner playwright --chromeBinary "${{ steps.setup-chrome.outputs.chrome-path }}"
|
|
|
|
- name: Transform results to be fit for display benchmark-action/github-action-benchmark@v1
|
|
run: |
|
|
mkdir artifacts/
|
|
jq -s . js-framework-benchmark/webdriver-ts/results/*.json | cargo run --manifest-path yew/Cargo.toml --release -p process-benchmark-results > artifacts/results.json
|
|
echo "$EVENT_INFO" > artifacts/.PR_INFO
|
|
env:
|
|
EVENT_INFO: ${{ toJSON(github.event) }}
|
|
|
|
- name: Upload result artifacts
|
|
uses: actions/upload-artifact@v4
|
|
with:
|
|
name: results
|
|
path: artifacts/
|
|
if-no-files-found: error
|