Skip to content

Commit

Permalink
Fix SSR Benchmark. (#2805)
Browse files Browse the repository at this point in the history
  • Loading branch information
futursolo committed Aug 3, 2022
1 parent 7562b65 commit e026b4f
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 6 deletions.
14 changes: 11 additions & 3 deletions .github/workflows/benchmark-ssr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,12 @@ on:
branches: [master]
paths:
- .github/workflows/benchmark-ssr.yml
- "packages/yew"
- "examples/function_router"
- "tools/benchmark-ssr"
- "packages/yew/**"
- "packages/yew-macro/**"
- "packages/yew-router/**"
- "packages/yew-router-macro/**"
- "examples/function_router/**"
- "tools/benchmark-ssr/**"

jobs:
benchmark-ssr:
Expand Down Expand Up @@ -55,11 +58,16 @@ jobs:
run: cargo run --profile=bench --bin benchmark-ssr -- --output-path ./output.json
working-directory: yew-master/tools

- name: Write Pull Request ID
run: |
echo "${{ github.event.number }}" > .PR_NUMBER
- name: Upload Artifact
uses: actions/upload-artifact@v2
with:
name: benchmark-ssr
path: |
.PR_NUMBER
yew-master/tools/output.json
current-pr/tools/output.json
retention-days: 1
13 changes: 11 additions & 2 deletions .github/workflows/post-benchmark-ssr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,15 @@ on:

jobs:
post-benchmark-ssr:
if: github.event.workflow_run.event == 'pull_request'
name: Post Comment on Pull Request
runs-on: ubuntu-latest

steps:
- name: Download Repository
uses: actions/checkout@v2

- if: github.event.workflow_run.event == 'pull_request'
name: Download Artifact
- name: Download Artifact
uses: Legit-Labs/action-download-artifact@v2
with:
github_token: "${{ secrets.GITHUB_TOKEN }}"
Expand All @@ -29,6 +29,15 @@ jobs:
- 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
- name: Post Comment
uses: actions/github-script@v6
with:
Expand Down
1 change: 0 additions & 1 deletion ci/make_benchmark_ssr_cmt.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@ def main() -> None:

with open(os.environ["GITHUB_ENV"], "a+") as f:
f.write(f"YEW_BENCH_SSR={json.dumps(output)}\n")
f.write(f"PR_NUMBER={issue_number}\n")


if __name__ == "__main__":
Expand Down

0 comments on commit e026b4f

Please sign in to comment.