mirror of https://github.com/yewstack/yew
Modernize github workflows (#3711)
* 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
This commit is contained in:
parent
73d519e675
commit
3871418174
|
@ -1,4 +1,3 @@
|
|||
---
|
||||
name: Benchmark - core
|
||||
|
||||
on:
|
||||
|
@ -32,29 +31,21 @@ jobs:
|
|||
with:
|
||||
toolchain: stable
|
||||
|
||||
- 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 bench -q > ../output.log
|
||||
working-directory: current-pr/tools/benchmark-core
|
||||
run: cargo bench -q > ../output.log
|
||||
|
||||
- name: Run master benchmark
|
||||
run: cargo bench -q > ../output.log
|
||||
continue-on-error: true
|
||||
working-directory: yew-master/tools/benchmark-core
|
||||
|
||||
- name: Make sure master's output log exists
|
||||
run: touch yew-master/tools/output.log
|
||||
run: cargo bench -q > ../output.log
|
||||
|
||||
- name: Write Pull Request ID
|
||||
run: |
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
---
|
||||
name: Benchmark - SSR
|
||||
|
||||
on:
|
||||
|
@ -37,25 +36,21 @@ 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: |
|
||||
|
|
|
@ -11,11 +11,11 @@ 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:
|
||||
|
@ -37,31 +37,37 @@ jobs:
|
|||
toolchain: stable
|
||||
targets: wasm32-unknown-unknown
|
||||
|
||||
- uses: jetli/wasm-pack-action@v0.4.0
|
||||
with:
|
||||
version: "latest"
|
||||
- name: Setup wasm-pack
|
||||
uses: jetli/wasm-pack-action@v0.4.0
|
||||
|
||||
- name: Setup Node
|
||||
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
|
||||
|
@ -69,7 +75,7 @@ jobs:
|
|||
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 \
|
||||
|
@ -79,11 +85,11 @@ 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
|
||||
|
@ -91,7 +97,7 @@ jobs:
|
|||
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 \
|
||||
|
@ -101,25 +107,25 @@ 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) }}
|
||||
|
||||
|
|
|
@ -16,8 +16,6 @@ on:
|
|||
jobs:
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
env:
|
||||
PR_INFO_FILE: ".PR_INFO"
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
|
@ -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@v4
|
||||
with:
|
||||
name: pr-info
|
||||
path: "${{ env.PR_INFO_FILE }}"
|
||||
path: .PR_INFO
|
||||
retention-days: 1
|
||||
|
|
|
@ -17,8 +17,6 @@ jobs:
|
|||
build:
|
||||
name: Build Website
|
||||
runs-on: ubuntu-latest
|
||||
env:
|
||||
PR_INFO_FILE: ".PR_INFO"
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
|
@ -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@v4
|
||||
with:
|
||||
name: pr-info
|
||||
path: "${{ env.PR_INFO_FILE }}"
|
||||
path: .PR_INFO
|
||||
retention-days: 1
|
||||
|
|
|
@ -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:
|
||||
|
@ -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
|
||||
|
@ -73,6 +65,8 @@ jobs:
|
|||
components: clippy
|
||||
|
||||
- uses: Swatinem/rust-cache@v2
|
||||
with:
|
||||
shared-key: clippy
|
||||
|
||||
- name: Run clippy
|
||||
run: |
|
||||
|
|
|
@ -28,6 +28,8 @@ jobs:
|
|||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: Swatinem/rust-cache@v2
|
||||
with:
|
||||
shared-key: yew-packages
|
||||
|
||||
# for wasm-bindgen-cli, always use stable rust
|
||||
- name: Setup toolchain
|
||||
|
@ -74,6 +76,8 @@ jobs:
|
|||
- uses: actions/checkout@v4
|
||||
|
||||
- uses: Swatinem/rust-cache@v2
|
||||
with:
|
||||
shared-key: yew-packages
|
||||
|
||||
# for wasm-bindgen-cli, always use stable rust
|
||||
- name: Setup toolchain
|
||||
|
@ -122,8 +126,6 @@ jobs:
|
|||
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Setup toolchain
|
||||
uses: dtolnay/rust-toolchain@master
|
||||
|
@ -131,6 +133,8 @@ jobs:
|
|||
toolchain: ${{ matrix.toolchain }}
|
||||
|
||||
- uses: Swatinem/rust-cache@v2
|
||||
with:
|
||||
shared-key: yew-packages
|
||||
|
||||
- name: Run native tests
|
||||
env:
|
||||
|
@ -159,6 +163,8 @@ jobs:
|
|||
toolchain: nightly
|
||||
|
||||
- uses: Swatinem/rust-cache@v2
|
||||
with:
|
||||
shared-key: yew-packages
|
||||
|
||||
- name: Run tests
|
||||
env:
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
---
|
||||
name: Post Comment for Benchmark - core
|
||||
|
||||
on:
|
||||
|
@ -9,8 +8,8 @@ on:
|
|||
|
||||
jobs:
|
||||
post-benchmark-core:
|
||||
if: github.event.workflow_run.event == 'pull_request'
|
||||
name: Post Comment on Pull Request
|
||||
name: Post Benchmark Comment on Pull Request
|
||||
if: github.event.workflow_run.conclusion == 'success' && github.event.workflow_run.event == 'pull_request'
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
|
@ -18,13 +17,12 @@ jobs:
|
|||
uses: actions/checkout@v4
|
||||
|
||||
- name: Download Artifact
|
||||
uses: Legit-Labs/action-download-artifact@v2
|
||||
uses: actions/download-artifact@v4
|
||||
with:
|
||||
github_token: "${{ secrets.GITHUB_TOKEN }}"
|
||||
workflow: benchmark-core.yml
|
||||
run_id: ${{ github.event.workflow_run.id }}
|
||||
github-token: "${{ secrets.GITHUB_TOKEN }}"
|
||||
run-id: ${{ github.event.workflow_run.id }}
|
||||
name: benchmark-core
|
||||
path: "benchmark-core/"
|
||||
path: benchmark-core/
|
||||
|
||||
- name: Make pull request comment
|
||||
run: |
|
||||
|
@ -45,13 +43,7 @@ jobs:
|
|||
EOF
|
||||
|
||||
- name: Read Pull Request ID
|
||||
run: |
|
||||
PR_NUMBER=$(cat "benchmark-core/.PR_NUMBER")
|
||||
if ! [[ "$PR_NUMBER" =~ ^[0-9]+$ ]]; then
|
||||
echo "pr number invalid"
|
||||
exit 1
|
||||
fi
|
||||
echo "PR_NUMBER=$PR_NUMBER" >> $GITHUB_ENV
|
||||
run: echo "PR_NUMBER=$(cat benchmark-core/.PR_NUMBER)" >> $GITHUB_ENV
|
||||
|
||||
- name: Post Comment
|
||||
uses: actions/github-script@v6
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
---
|
||||
name: Post Comment for Benchmark - SSR
|
||||
|
||||
on:
|
||||
|
@ -9,8 +8,8 @@ on:
|
|||
|
||||
jobs:
|
||||
post-benchmark-ssr:
|
||||
if: github.event.workflow_run.event == 'pull_request'
|
||||
name: Post Comment on Pull Request
|
||||
if: github.event.workflow_run.conclusion == 'success' && github.event.workflow_run.event == 'pull_request'
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
|
@ -18,25 +17,18 @@ jobs:
|
|||
uses: actions/checkout@v4
|
||||
|
||||
- name: Download Artifact
|
||||
uses: Legit-Labs/action-download-artifact@v2
|
||||
uses: actions/download-artifact@v4
|
||||
with:
|
||||
github_token: "${{ secrets.GITHUB_TOKEN }}"
|
||||
workflow: benchmark-ssr.yml
|
||||
run_id: ${{ github.event.workflow_run.id }}
|
||||
github-token: "${{ secrets.GITHUB_TOKEN }}"
|
||||
run-id: ${{ github.event.workflow_run.id }}
|
||||
name: benchmark-ssr
|
||||
path: "benchmark-ssr/"
|
||||
path: benchmark-ssr/
|
||||
|
||||
- name: Make pull request comment
|
||||
run: python3 ci/make_benchmark_ssr_cmt.py
|
||||
|
||||
- name: Read Pull Request ID
|
||||
run: |
|
||||
PR_NUMBER=$(cat "benchmark-ssr/.PR_NUMBER")
|
||||
if ! [[ "$PR_NUMBER" =~ ^[0-9]+$ ]]; then
|
||||
echo "pr number invalid"
|
||||
exit 1
|
||||
fi
|
||||
echo "PR_NUMBER=$PR_NUMBER" >> $GITHUB_ENV
|
||||
run: echo "PR_NUMBER=$(cat benchmark-ssr/.PR_NUMBER)" >> $GITHUB_ENV
|
||||
|
||||
- name: Post Comment
|
||||
uses: actions/github-script@v6
|
||||
|
|
|
@ -8,18 +8,18 @@ on:
|
|||
|
||||
jobs:
|
||||
post-benchmark-results:
|
||||
runs-on: ubuntu-latest
|
||||
if: github.event.workflow_run.conclusion == 'success'
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
# Checkout repo for the github-action-benchmark action
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- name: Download result artifacts
|
||||
uses: Legit-Labs/action-download-artifact@v2
|
||||
uses: actions/download-artifact@v4
|
||||
with:
|
||||
workflow: benchmark.yml
|
||||
run_id: ${{ github.event.workflow_run.id }}
|
||||
github-token: "${{ secrets.GITHUB_TOKEN }}"
|
||||
run-id: ${{ github.event.workflow_run.id }}
|
||||
name: results
|
||||
path: ./artifacts
|
||||
|
||||
|
@ -27,7 +27,7 @@ jobs:
|
|||
uses: mathiasvr/command-output@v1
|
||||
id: test-pr
|
||||
with:
|
||||
run: cat artifacts/PR_INFO
|
||||
run: cat artifacts/.PR_INFO
|
||||
|
||||
# gh-pages branch is updated and pushed automatically with extracted benchmark data
|
||||
- name: Store benchmark result
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
---
|
||||
name: Post Comment for Size Comparison
|
||||
|
||||
on:
|
||||
|
@ -9,30 +8,27 @@ on:
|
|||
|
||||
jobs:
|
||||
post-size-cmp:
|
||||
name: Post Comment on Pull Request
|
||||
name: Post Size Comment on Pull Request
|
||||
if: github.event.workflow_run.conclusion == 'success' && github.event.workflow_run.event == 'pull_request'
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- name: Download Repository
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- if: github.event.workflow_run.event == 'pull_request'
|
||||
name: Download Artifact (master)
|
||||
uses: Legit-Labs/action-download-artifact@v2
|
||||
- name: Download Artifact (master)
|
||||
uses: actions/download-artifact@v4
|
||||
with:
|
||||
github_token: "${{ secrets.GITHUB_TOKEN }}"
|
||||
workflow: size-cmp.yml
|
||||
run_id: ${{ github.event.workflow_run.id }}
|
||||
github-token: "${{ secrets.GITHUB_TOKEN }}"
|
||||
run-id: ${{ github.event.workflow_run.id }}
|
||||
name: size-cmp-master-info
|
||||
path: "size-cmp-master-info/"
|
||||
|
||||
- if: github.event.workflow_run.event == 'pull_request'
|
||||
name: Download Artifact (PR)
|
||||
uses: Legit-Labs/action-download-artifact@v2
|
||||
- name: Download Artifact (PR)
|
||||
uses: actions/download-artifact@v4
|
||||
with:
|
||||
github_token: "${{ secrets.GITHUB_TOKEN }}"
|
||||
workflow: size-cmp.yml
|
||||
run_id: ${{ github.event.workflow_run.id }}
|
||||
github-token: "${{ secrets.GITHUB_TOKEN }}"
|
||||
run-id: ${{ github.event.workflow_run.id }}
|
||||
name: size-cmp-pr-info
|
||||
path: "size-cmp-pr-info/"
|
||||
|
||||
|
|
|
@ -7,41 +7,34 @@ on:
|
|||
|
||||
jobs:
|
||||
publish:
|
||||
if: github.event.workflow_run.conclusion == 'success'
|
||||
runs-on: ubuntu-latest
|
||||
env:
|
||||
PR_INFO_FILE: ".PR_INFO"
|
||||
steps:
|
||||
- if: github.event.workflow_run.conclusion != 'success'
|
||||
name: Abort if build failed
|
||||
run: |
|
||||
echo "build failed"
|
||||
exit 1
|
||||
|
||||
steps:
|
||||
# need to checkout to get "firebase.json", ".firebaserc"
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- name: Download build artifact
|
||||
uses: dawidd6/action-download-artifact@v2
|
||||
uses: actions/download-artifact@v4
|
||||
with:
|
||||
github_token: "${{ secrets.GITHUB_TOKEN }}"
|
||||
workflow: build-api-docs.yml
|
||||
run_id: ${{ github.event.workflow_run.id }}
|
||||
github-token: "${{ secrets.GITHUB_TOKEN }}"
|
||||
run-id: ${{ github.event.workflow_run.id }}
|
||||
name: api-docs
|
||||
path: api-docs/
|
||||
|
||||
- if: github.event.workflow_run.event == 'pull_request'
|
||||
name: Download pr info
|
||||
uses: dawidd6/action-download-artifact@v2
|
||||
uses: actions/download-artifact@v4
|
||||
with:
|
||||
github_token: "${{ secrets.GITHUB_TOKEN }}"
|
||||
workflow: build-api-docs.yml
|
||||
run_id: ${{ github.event.workflow_run.id }}
|
||||
github-token: "${{ secrets.GITHUB_TOKEN }}"
|
||||
run-id: ${{ github.event.workflow_run.id }}
|
||||
name: pr-info
|
||||
path: artifacts
|
||||
|
||||
- if: github.event.workflow_run.event == 'pull_request'
|
||||
name: Apply pull request environment
|
||||
run: |
|
||||
pr_number=$(cat "$PR_INFO_FILE")
|
||||
pr_number=$(cat "artifacts/.PR_INFO")
|
||||
if ! [[ "$pr_number" =~ ^[0-9]+$ ]]; then
|
||||
echo "pr number invalid"
|
||||
exit 1
|
||||
|
|
|
@ -25,6 +25,8 @@ jobs:
|
|||
components: rust-src
|
||||
|
||||
- uses: Swatinem/rust-cache@v2
|
||||
with:
|
||||
shared-key: publish-examples
|
||||
|
||||
- uses: jetli/trunk-action@v0.4.0
|
||||
with:
|
||||
|
|
|
@ -7,41 +7,34 @@ on:
|
|||
|
||||
jobs:
|
||||
publish:
|
||||
if: github.event.workflow_run.conclusion == 'success'
|
||||
runs-on: ubuntu-latest
|
||||
env:
|
||||
PR_INFO_FILE: ".PR_INFO"
|
||||
|
||||
steps:
|
||||
- if: github.event.workflow_run.conclusion != 'success'
|
||||
name: Abort if build failed
|
||||
run: |
|
||||
echo "build failed"
|
||||
exit 1
|
||||
# need to checkout to get "firebase.json", ".firebaserc"
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- name: Download build artifact
|
||||
uses: Legit-Labs/action-download-artifact@v2
|
||||
uses: actions/download-artifact@v4
|
||||
with:
|
||||
github_token: "${{ secrets.GITHUB_TOKEN }}"
|
||||
workflow: build-website.yml
|
||||
run_id: ${{ github.event.workflow_run.id }}
|
||||
github-token: "${{ secrets.GITHUB_TOKEN }}"
|
||||
run-id: ${{ github.event.workflow_run.id }}
|
||||
name: website
|
||||
path: website/build
|
||||
|
||||
- if: github.event.workflow_run.event == 'pull_request'
|
||||
name: Download pr info
|
||||
uses: Legit-Labs/action-download-artifact@v2
|
||||
uses: actions/download-artifact@v4
|
||||
with:
|
||||
github_token: "${{ secrets.GITHUB_TOKEN }}"
|
||||
workflow: build-website.yml
|
||||
run_id: ${{ github.event.workflow_run.id }}
|
||||
github-token: "${{ secrets.GITHUB_TOKEN }}"
|
||||
run-id: ${{ github.event.workflow_run.id }}
|
||||
name: pr-info
|
||||
path: artifacts
|
||||
|
||||
- if: github.event.workflow_run.event == 'pull_request'
|
||||
name: Apply pull request environment
|
||||
run: |
|
||||
pr_number=$(cat "artifacts/$PR_INFO_FILE")
|
||||
pr_number=$(cat "artifacts/.PR_INFO")
|
||||
if ! [[ "$pr_number" =~ ^[0-9]+$ ]]; then
|
||||
echo "pr number invalid"
|
||||
exit 1
|
||||
|
@ -49,10 +42,12 @@ jobs:
|
|||
echo "PR_NUMBER=$pr_number" >> $GITHUB_ENV
|
||||
echo "PR_BRANCH=${{ github.event.workflow_run.head_branch }}" >> $GITHUB_ENV
|
||||
echo "COMMIT_SHA=${{ github.event.workflow_run.head_sha }}" >> $GITHUB_ENV
|
||||
|
||||
- if: github.event.workflow_run.event == 'push'
|
||||
name: Apply push environment
|
||||
run: |
|
||||
echo "CHANNEL_ID=live" >> $GITHUB_ENV
|
||||
|
||||
- name: Deploy to Firebase
|
||||
uses: siku2/action-hosting-deploy@v1
|
||||
with:
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
---
|
||||
name: Size Comparison
|
||||
|
||||
on:
|
||||
|
@ -46,6 +45,8 @@ jobs:
|
|||
|
||||
- name: Restore Rust cache for master
|
||||
uses: Swatinem/rust-cache@v2
|
||||
with:
|
||||
shared-key: size-compare
|
||||
|
||||
- name: Setup Trunk
|
||||
uses: jetli/trunk-action@v0.4.0
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
---
|
||||
name: "Test Website"
|
||||
|
||||
on:
|
||||
|
@ -17,11 +16,6 @@ jobs:
|
|||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- name: Setup toolchain
|
||||
uses: dtolnay/rust-toolchain@master
|
||||
with:
|
||||
toolchain: stable
|
||||
|
||||
# for wasm-bindgen-cli, always use stable rust
|
||||
- name: Setup toolchain
|
||||
uses: dtolnay/rust-toolchain@master
|
||||
|
@ -39,6 +33,8 @@ jobs:
|
|||
targets: wasm32-unknown-unknown
|
||||
|
||||
- uses: Swatinem/rust-cache@v2
|
||||
with:
|
||||
shared-key: yew-packages
|
||||
|
||||
- uses: browser-actions/setup-geckodriver@latest
|
||||
with:
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
target/
|
||||
dist/
|
||||
|
||||
# backup files generated by rustfmt
|
||||
**/*.rs.bk
|
||||
|
|
|
@ -18,6 +18,5 @@ opt-level = "z"
|
|||
[profile.bench]
|
||||
lto = true
|
||||
codegen-units = 1
|
||||
panic = "abort"
|
||||
opt-level = 3
|
||||
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
#!/usr/bin/env bash
|
||||
# Must be run from root of the repo:
|
||||
# yew $ ./ci/build-examples.sh
|
||||
|
||||
|
@ -25,13 +26,6 @@ for path in examples/*; do
|
|||
cd "$path"
|
||||
dist_dir="$output/$example"
|
||||
export RUSTFLAGS="--cfg nightly_yew"
|
||||
if [[ "$example" == "boids" || "$example" == "password_strength" ]]; then
|
||||
# works around issue rust-lang/rust#96486
|
||||
# where the compiler forgets to link some symbols connected to const_eval
|
||||
# only an issue on nightly and with build-std enabled which we do for code size
|
||||
# this deoptimizes only the examples that otherwise fail to build
|
||||
export RUSTFLAGS="-Zshare-generics=n -Clto=thin $RUSTFLAGS"
|
||||
fi
|
||||
|
||||
trunk build --release --dist "$dist_dir" --public-url "$PUBLIC_URL_PREFIX/$example"
|
||||
|
||||
|
|
|
@ -2,19 +2,19 @@
|
|||
set -xe
|
||||
|
||||
# You can extract the feature list with the following command:
|
||||
# cargo hack check --feature-powerset --exclude-features nightly
|
||||
# cargo hack -p yew -p yew-agent -p yew-router --feature-powerset --print-command-list clippy --release -- -D warnings
|
||||
|
||||
# You need to run this script in packages/yew
|
||||
|
||||
cargo clippy --release --no-default-features -- --deny=warnings
|
||||
cargo clippy --release --no-default-features --features csr -- --deny=warnings
|
||||
cargo clippy --release --no-default-features --features default -- --deny=warnings
|
||||
cargo clippy --release --no-default-features --features csr,default -- --deny=warnings
|
||||
cargo clippy --release --no-default-features --features hydration -- --deny=warnings
|
||||
cargo clippy --release --no-default-features --features default,hydration -- --deny=warnings
|
||||
cargo clippy --release --no-default-features --features ssr -- --deny=warnings
|
||||
cargo clippy --release --no-default-features --features csr,ssr -- --deny=warnings
|
||||
cargo clippy --release --no-default-features --features default,ssr -- --deny=warnings
|
||||
cargo clippy --release --no-default-features --features csr,default,ssr -- --deny=warnings
|
||||
cargo clippy --release --no-default-features --features hydration,ssr -- --deny=warnings
|
||||
cargo clippy --release --no-default-features --features default,hydration,ssr -- --deny=warnings
|
||||
cargo clippy --release --manifest-path packages/yew/Cargo.toml --no-default-features -- -D warnings
|
||||
cargo clippy --release --manifest-path packages/yew/Cargo.toml --no-default-features --features default,hydration,ssr -- -D warnings
|
||||
cargo clippy --release --manifest-path packages/yew/Cargo.toml --no-default-features --features csr -- -D warnings
|
||||
cargo clippy --release --manifest-path packages/yew/Cargo.toml --no-default-features --features default -- -D warnings
|
||||
cargo clippy --release --manifest-path packages/yew/Cargo.toml --no-default-features --features csr,default -- -D warnings
|
||||
cargo clippy --release --manifest-path packages/yew/Cargo.toml --no-default-features --features hydration -- -D warnings
|
||||
cargo clippy --release --manifest-path packages/yew/Cargo.toml --no-default-features --features default,hydration -- -D warnings
|
||||
cargo clippy --release --manifest-path packages/yew/Cargo.toml --no-default-features --features ssr -- -D warnings
|
||||
cargo clippy --release --manifest-path packages/yew/Cargo.toml --no-default-features --features csr,ssr -- -D warnings
|
||||
cargo clippy --release --manifest-path packages/yew/Cargo.toml --no-default-features --features default,ssr -- -D warnings
|
||||
cargo clippy --release --manifest-path packages/yew/Cargo.toml --no-default-features --features csr,default,ssr -- -D warnings
|
||||
cargo clippy --release --manifest-path packages/yew/Cargo.toml --no-default-features --features hydration,ssr -- -D warnings
|
||||
cargo clippy --release --manifest-path packages/yew-agent/Cargo.toml -- -D warnings
|
||||
cargo clippy --release --manifest-path packages/yew-router/Cargo.toml -- -D warnings
|
||||
|
|
|
@ -2,19 +2,19 @@
|
|||
set -xe
|
||||
|
||||
# You can extract the feature list with the following command:
|
||||
# cargo hack check --feature-powerset --exclude-features nightly
|
||||
# cargo hack -p yew -p yew-agent -p yew-router --feature-powerset --print-command-list clippy -- -D warnings
|
||||
|
||||
# You need to run this script in packages/yew
|
||||
|
||||
cargo clippy --no-default-features -- --deny=warnings
|
||||
cargo clippy --no-default-features --features csr -- --deny=warnings
|
||||
cargo clippy --no-default-features --features default -- --deny=warnings
|
||||
cargo clippy --no-default-features --features csr,default -- --deny=warnings
|
||||
cargo clippy --no-default-features --features hydration -- --deny=warnings
|
||||
cargo clippy --no-default-features --features default,hydration -- --deny=warnings
|
||||
cargo clippy --no-default-features --features ssr -- --deny=warnings
|
||||
cargo clippy --no-default-features --features csr,ssr -- --deny=warnings
|
||||
cargo clippy --no-default-features --features default,ssr -- --deny=warnings
|
||||
cargo clippy --no-default-features --features csr,default,ssr -- --deny=warnings
|
||||
cargo clippy --no-default-features --features hydration,ssr -- --deny=warnings
|
||||
cargo clippy --no-default-features --features default,hydration,ssr -- --deny=warnings
|
||||
cargo clippy --manifest-path packages/yew/Cargo.toml --no-default-features -- -D warnings
|
||||
cargo clippy --manifest-path packages/yew/Cargo.toml --no-default-features --features default,hydration,ssr -- -D warnings
|
||||
cargo clippy --manifest-path packages/yew/Cargo.toml --no-default-features --features csr -- -D warnings
|
||||
cargo clippy --manifest-path packages/yew/Cargo.toml --no-default-features --features default -- -D warnings
|
||||
cargo clippy --manifest-path packages/yew/Cargo.toml --no-default-features --features csr,default -- -D warnings
|
||||
cargo clippy --manifest-path packages/yew/Cargo.toml --no-default-features --features hydration -- -D warnings
|
||||
cargo clippy --manifest-path packages/yew/Cargo.toml --no-default-features --features default,hydration -- -D warnings
|
||||
cargo clippy --manifest-path packages/yew/Cargo.toml --no-default-features --features ssr -- -D warnings
|
||||
cargo clippy --manifest-path packages/yew/Cargo.toml --no-default-features --features csr,ssr -- -D warnings
|
||||
cargo clippy --manifest-path packages/yew/Cargo.toml --no-default-features --features default,ssr -- -D warnings
|
||||
cargo clippy --manifest-path packages/yew/Cargo.toml --no-default-features --features csr,default,ssr -- -D warnings
|
||||
cargo clippy --manifest-path packages/yew/Cargo.toml --no-default-features --features hydration,ssr -- -D warnings
|
||||
cargo clippy --manifest-path packages/yew-agent/Cargo.toml -- -D warnings
|
||||
cargo clippy --manifest-path packages/yew-router/Cargo.toml -- -D warnings
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
#!/usr/bin/env bash
|
||||
if [ ! -f "Cargo.lock" ]; then
|
||||
cargo fetch
|
||||
fi
|
||||
|
|
|
@ -30,7 +30,7 @@
|
|||
//!
|
||||
//! ## Example
|
||||
//!
|
||||
//! ```rust
|
||||
//! ```rust,no_run
|
||||
//! use yew::prelude::*;
|
||||
//!
|
||||
//! enum Msg {
|
||||
|
@ -68,11 +68,9 @@
|
|||
//! }
|
||||
//! }
|
||||
//!
|
||||
//! # fn dont_execute() {
|
||||
//! fn main() {
|
||||
//! yew::Renderer::<App>::new().render();
|
||||
//! }
|
||||
//! # }
|
||||
//! ```
|
||||
|
||||
#![deny(
|
||||
|
|
|
@ -1,4 +1,7 @@
|
|||
use std::cell::Cell;
|
||||
#[rustversion::since(1.81)]
|
||||
use std::panic::PanicHookInfo as PanicInfo;
|
||||
#[rustversion::before(1.81)]
|
||||
use std::panic::PanicInfo;
|
||||
use std::rc::Rc;
|
||||
|
||||
|
|
|
@ -1,31 +1,65 @@
|
|||
use std::collections::HashMap;
|
||||
use std::io;
|
||||
use std::io::{Read, Write};
|
||||
|
||||
use anyhow::Result;
|
||||
use serde::Serialize;
|
||||
use serde::{Deserialize, Serialize};
|
||||
use serde_json::Value;
|
||||
|
||||
#[derive(Serialize)]
|
||||
struct GhActionBenchmark {
|
||||
name: String,
|
||||
unit: String,
|
||||
value: String,
|
||||
value: Value,
|
||||
}
|
||||
|
||||
// from https://github.com/krausest/js-framework-benchmark/blob/master/webdriver-ts/src/writeResults.ts#L67 function createResultFile
|
||||
#[derive(Deserialize)]
|
||||
struct ResultData {
|
||||
median: Value,
|
||||
// some keys missing
|
||||
}
|
||||
|
||||
#[derive(Deserialize)]
|
||||
struct JsKrauseBenchmarkResult<'r> {
|
||||
framework: &'r str,
|
||||
benchmark: &'r str,
|
||||
r#type: &'r str,
|
||||
values: HashMap<&'r str, ResultData>,
|
||||
}
|
||||
|
||||
fn transform_results(mut result: JsKrauseBenchmarkResult<'_>) -> GhActionBenchmark {
|
||||
let key = if result.r#type == "cpu" {
|
||||
"total"
|
||||
} else {
|
||||
"DEFAULT"
|
||||
};
|
||||
let values = result.values.remove(key).unwrap_or_else(|| {
|
||||
panic!(
|
||||
"Expect benchmark data to be present for type {}. Found keys: {:?}, expected {key:?}",
|
||||
result.r#type,
|
||||
result.values.keys().cloned().collect::<Vec<_>>(),
|
||||
)
|
||||
});
|
||||
assert!(
|
||||
values.median.is_number(),
|
||||
"expected a numerical benchmark value"
|
||||
);
|
||||
GhActionBenchmark {
|
||||
name: format!("{} {}", result.framework, result.benchmark).replace('"', ""),
|
||||
unit: String::default(),
|
||||
value: values.median,
|
||||
}
|
||||
}
|
||||
|
||||
fn main() -> Result<()> {
|
||||
let mut buffer = "".to_string();
|
||||
io::stdin().read_to_string(&mut buffer)?;
|
||||
|
||||
let input_json: Vec<Value> = serde_json::from_str(buffer.as_str())?;
|
||||
let input_json: Vec<_> = serde_json::from_str(buffer.as_str())?;
|
||||
|
||||
let transformed_benchmarks: Vec<GhActionBenchmark> = input_json
|
||||
.into_iter()
|
||||
.map(|v| GhActionBenchmark {
|
||||
name: format!("{} {}", v["framework"], v["benchmark"]).replace('"', ""),
|
||||
unit: String::default(),
|
||||
value: v["median"].to_string(),
|
||||
})
|
||||
.collect();
|
||||
let transformed_benchmarks: Vec<GhActionBenchmark> =
|
||||
input_json.into_iter().map(transform_results).collect();
|
||||
|
||||
let output = serde_json::to_string(&transformed_benchmarks)?;
|
||||
|
||||
|
|
Loading…
Reference in New Issue