Skip to content

Commit

Permalink
Merge branch 'master' into patch-1
Browse files Browse the repository at this point in the history
  • Loading branch information
ranile authored Oct 12, 2024
2 parents e129a07 + 4978b99 commit 826c25a
Show file tree
Hide file tree
Showing 245 changed files with 11,156 additions and 7,668 deletions.
62 changes: 62 additions & 0 deletions .github/workflows/benchmark-core.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
name: Benchmark - core

on:
pull_request:
branches: [master]
paths:
- .github/workflows/benchmark-core.yml
- "packages/yew/**"
- "tools/benchmark-core/**"

jobs:
benchmark-core:
name: Benchmark - core
runs-on: ubuntu-latest

steps:
- name: Checkout master
uses: actions/checkout@v4
with:
repository: "yewstack/yew"
ref: master
path: yew-master

- name: Checkout pull request
uses: actions/checkout@v4
with:
path: current-pr

- name: Setup toolchain
uses: dtolnay/rust-toolchain@master
with:
toolchain: stable

- name: Restore Rust cache for yew packages
uses: Swatinem/rust-cache@v2
with:
shared-key: yew-packages
workspaces: |
yew-master
current-pr
- name: Run pull request benchmark
working-directory: current-pr/tools/benchmark-core
run: cargo bench -q > ../output.log

- name: Run master benchmark
working-directory: yew-master/tools/benchmark-core
run: cargo bench -q > ../output.log

- name: Write Pull Request ID
run: |
echo "${{ github.event.number }}" > .PR_NUMBER
- name: Upload Artifact
uses: actions/upload-artifact@v4
with:
name: benchmark-core
path: |
.PR_NUMBER
yew-master/tools/output.log
current-pr/tools/output.log
retention-days: 1
21 changes: 8 additions & 13 deletions .github/workflows/benchmark-ssr.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
---
name: Benchmark - SSR

on:
Expand Down Expand Up @@ -37,32 +36,28 @@ jobs:
toolchain: stable
targets: wasm32-unknown-unknown

- name: Restore Rust cache for master
- name: Restore Rust cache for yew packages
uses: Swatinem/rust-cache@v2
with:
working-directory: yew-master
key: master

- name: Restore Rust cache for current pull request
uses: Swatinem/rust-cache@v2
with:
working-directory: current-pr
key: pr
shared-key: yew-packages
workspaces: |
yew-master
current-pr
- name: Run pull request benchmark
run: cargo run --profile=bench -- --output-path ../output.json
working-directory: current-pr/tools/benchmark-ssr
run: cargo run --profile=bench -- --output-path ../output.json

- name: Run master benchmark
run: cargo run --profile=bench -- --output-path ../output.json
working-directory: yew-master/tools/benchmark-ssr
run: cargo run --profile=bench -- --output-path ../output.json

- name: Write Pull Request ID
run: |
echo "${{ github.event.number }}" > .PR_NUMBER
- name: Upload Artifact
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: benchmark-ssr
path: |
Expand Down
61 changes: 37 additions & 24 deletions .github/workflows/benchmark.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,15 @@ on:
- "website/**"
types: [labeled, synchronize, opened, reopened]

permissions:
# deployments permission to deploy GitHub pages website
deployments: write
# contents permission to update benchmark contents in gh-pages branch
contents: write
# 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:
if: github.event_name != 'pull_request' || contains(github.event.pull_request.labels.*.name, 'performance')
runs-on: ubuntu-latest

steps:
Expand All @@ -37,35 +38,45 @@ jobs:
toolchain: stable
targets: wasm32-unknown-unknown

- uses: jetli/[email protected]
with:
version: "latest"
- name: Setup wasm-pack
uses: jetli/[email protected]

- name: Setup Node
uses: actions/setup-node@v3
uses: actions/setup-node@v4
with:
node-version: 18
node-version: ">=18"
cache: "npm"
cache-dependency-path: js-framework-benchmark/package-lock.json

- uses: Swatinem/rust-cache@v2
- 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
- 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
- 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
- name: Build benchmark-struct app
working-directory: yew/tools/benchmark-struct
run: |
wasm-pack build \
Expand All @@ -75,19 +86,19 @@ jobs:
--out-name js-framework-benchmark-yew \
--out-dir $STRUCT_BUILD_DIR
- name: show built benchmark-struct benchmark files
- name: Show built benchmark-struct benchmark files
run: |
ls -lauh js-framework-benchmark/frameworks/keyed/yew/bundled-dist/
- name: setup yew-hooks benchmark
- 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
- name: Build benchmark-hooks app
working-directory: yew/tools/benchmark-hooks
run: |
wasm-pack build \
Expand All @@ -97,31 +108,33 @@ jobs:
--out-name js-framework-benchmark-yew-hooks \
--out-dir $HOOKS_BUILD_DIR
- name: show built benchmark-hooks benchmark files
- 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
- name: Run js-framework-benchmark server
working-directory: js-framework-benchmark
run: |
npm start &
sleep 5
- name: js-framework-benchmark/webdriver-ts npm run bench
- 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
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
- 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
echo "$EVENT_INFO" > artifacts/.PR_INFO
env:
EVENT_INFO: ${{ toJSON(github.event) }}

- name: Upload result artifacts
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: results
path: artifacts/
if-no-files-found: error
include-hidden-files: true
retention-days: 1
10 changes: 4 additions & 6 deletions .github/workflows/build-api-docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,6 @@ on:
jobs:
build:
runs-on: ubuntu-latest
env:
PR_INFO_FILE: ".PR_INFO"
steps:
- uses: actions/checkout@v4

Expand Down Expand Up @@ -46,7 +44,7 @@ jobs:
cp -r target/doc/* api-docs/dist/next
- name: Upload build artifact
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: api-docs
path: api-docs/
Expand All @@ -55,12 +53,12 @@ jobs:
- if: github.event_name == 'pull_request'
name: Build pr info
run: |
echo "${{ github.event.number }}" > $PR_INFO_FILE
echo "${{ github.event.number }}" > .PR_INFO
- if: github.event_name == 'pull_request'
name: Upload pr info
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: pr-info
path: "${{ env.PR_INFO_FILE }}"
path: .PR_INFO
retention-days: 1
16 changes: 7 additions & 9 deletions .github/workflows/build-website.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,20 +17,18 @@ jobs:
build:
name: Build Website
runs-on: ubuntu-latest
env:
PR_INFO_FILE: ".PR_INFO"
steps:
- uses: actions/checkout@v4

- name: Setup node
uses: actions/setup-node@v3
uses: actions/setup-node@v4
with:
node-version: "16"
node-version: "18"

- name: Install dependencies
run: |
cd website
npm install
npm ci
- name: Run prettier
run: |
Expand All @@ -48,7 +46,7 @@ jobs:
npm run build
- name: Upload build artifact
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: website
path: website/build/
Expand All @@ -57,12 +55,12 @@ jobs:
- if: github.event_name == 'pull_request'
name: Build pr info
run: |
echo "${{ github.event.number }}" > $PR_INFO_FILE
echo "${{ github.event.number }}" > .PR_INFO
- if: github.event_name == 'pull_request'
name: Upload pr info
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: pr-info
path: "${{ env.PR_INFO_FILE }}"
path: .PR_INFO
retention-days: 1
24 changes: 9 additions & 15 deletions .github/workflows/clippy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@ jobs:
feature-soundness:
name: Feature Soundness
runs-on: ubuntu-latest
# if normal clippy doesn't succeed, do not try to lint feature soundness
needs: clippy

strategy:
fail-fast: false
matrix:
Expand All @@ -32,27 +35,16 @@ jobs:
components: clippy

- uses: Swatinem/rust-cache@v2
with:
shared-key: clippy

- name: Lint feature soundness
if: matrix.profile == 'dev'
run: bash ../../ci/feature-soundness.sh
working-directory: packages/yew
run: bash ./ci/feature-soundness.sh

- name: Lint feature soundness
if: matrix.profile == 'release'
run: bash ../../ci/feature-soundness-release.sh
working-directory: packages/yew

- name: Run release clippy
if: matrix.profile == 'release'
run: |
ls packages | xargs -I {} \
cargo clippy \
-p {} \
--all-targets \
--all-features \
--workspace \
-- -D warnings
run: bash ./ci/feature-soundness-release.sh

clippy:
name: Clippy Workspace
Expand All @@ -73,6 +65,8 @@ jobs:
components: clippy

- uses: Swatinem/rust-cache@v2
with:
shared-key: clippy

- name: Run clippy
run: |
Expand Down
Loading

0 comments on commit 826c25a

Please sign in to comment.