Skip to content

Commit

Permalink
Merge branch 'master' into allow-more-literals-in-html
Browse files Browse the repository at this point in the history
  • Loading branch information
its-the-shrimp authored Oct 28, 2023
2 parents 790f0cc + d790e1b commit 558b30c
Show file tree
Hide file tree
Showing 80 changed files with 1,409 additions and 1,026 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/auto-approve-maintainer-pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
uses: JamesSingleton/[email protected]
with:
organization: "yewstack"
username: ${{ github.actor }}
username: ${{ github.event.pull_request.user.login }}
token: ${{ secrets.GITHUB_TOKEN }}

- name: Auto approve
Expand Down
71 changes: 71 additions & 0 deletions .github/workflows/benchmark-core.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
---
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@v3
with:
repository: "yewstack/yew"
ref: master
path: yew-master

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

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

- name: Restore Rust cache for master
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

- name: Run pull request benchmark
run: cargo bench -q > ../output.log
working-directory: current-pr/tools/benchmark-core

- 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

- name: Write Pull Request ID
run: |
echo "${{ github.event.number }}" > .PR_NUMBER
- name: Upload Artifact
uses: actions/upload-artifact@v3
with:
name: benchmark-core
path: |
.PR_NUMBER
yew-master/tools/output.log
current-pr/tools/output.log
retention-days: 1
100 changes: 100 additions & 0 deletions .github/workflows/post-benchmark-core.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
---
name: Post Comment for Benchmark - core

on:
workflow_run:
workflows: ["Benchmark - core"]
types:
- completed

jobs:
post-benchmark-core:
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@v3

- name: Download Artifact
uses: Legit-Labs/action-download-artifact@v2
with:
github_token: "${{ secrets.GITHUB_TOKEN }}"
workflow: benchmark-core.yml
run_id: ${{ github.event.workflow_run.id }}
name: benchmark-core
path: "benchmark-core/"

- name: Make pull request comment
run: |
cat - >>comment.txt <<EOF
### Benchmark - core
#### Yew Master
\`\`\`
EOF
cat benchmark-core/yew-master/tools/output.log >>comment.txt
cat - >>comment.txt <<EOF
\`\`\`
#### Pull Request
\`\`\`
EOF
cat benchmark-core/current-pr/tools/output.log >>comment.txt
cat - >>comment.txt <<EOF
\`\`\`
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
- name: Post Comment
uses: actions/github-script@v6
with:
script: |
const fs = require('fs');
const commentInfo = {
...context.repo,
issue_number: ${{ env.PR_NUMBER }},
};
const comment = {
...commentInfo,
body: fs.readFileSync("comment.txt", 'utf-8'),
};
function isCommentByBot(comment) {
return comment.user.type === "Bot" && comment.body.includes("### Benchmark - core");
}
let commentId = null;
const comments = (await github.rest.issues.listComments(commentInfo)).data;
for (let i = comments.length; i--; ) {
const c = comments[i];
if (isCommentByBot(c)) {
commentId = c.id;
break;
}
}
if (commentId) {
try {
await github.rest.issues.updateComment({
...context.repo,
comment_id: commentId,
body: comment.body,
});
} catch (e) {
commentId = null;
}
}
if (!commentId) {
await github.rest.issues.createComment(comment);
}
4 changes: 2 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
- Assert there are no circular references. [[@WorldSEnder](https://github.com/WorldSEnder), [#3025](https://github.com/yewstack/yew/pull/3025)]
## 🚨 Breaking changes

- Remove special handing of struct fields of type `Option` in `derive(Properties)`. [[@Tim Kurdov](https://github.com/Tim Kurdov), [#3398](https://github.com/yewstack/yew/pull/3398)]
- Remove special handling of struct fields of type `Option` in `derive(Properties)`. [[@Tim Kurdov](https://github.com/Tim Kurdov), [#3398](https://github.com/yewstack/yew/pull/3398)]
- Agent v2. [[@Kaede Hoshikawa](https://github.com/Kaede Hoshikawa), [#2773](https://github.com/yewstack/yew/pull/2773)]
- Update signature of use_prepared_state/use_transitive_state. [[@Muhammad Hamza](https://github.com/Muhammad Hamza), [#3376](https://github.com/yewstack/yew/pull/3376)]
- Make signature of use_future_with consistent. [[@Muhammad Hamza](https://github.com/Muhammad Hamza), [#3372](https://github.com/yewstack/yew/pull/3372)]
Expand Down Expand Up @@ -210,7 +210,7 @@
- Fix clippy lints from 1.54.0. [[@Xavientois](https://github.com/Xavientois), [#1976](https://github.com/yewstack/yew/pull/1976)]
- Fix scheduler main queue delay (#1953). [[@intendednull](https://github.com/intendednull), [#1954](https://github.com/yewstack/yew/pull/1954)]
- Fix case warning on derived properties. [[@nitnelave](https://github.com/nitnelave), [#1929](https://github.com/yewstack/yew/pull/1929)]
- yew-macro: fix inability to set the autoplay atribute. [[@bakape](https://github.com/bakape), [#1866](https://github.com/yewstack/yew/pull/1866)]
- yew-macro: fix inability to set the autoplay attribute. [[@bakape](https://github.com/bakape), [#1866](https://github.com/yewstack/yew/pull/1866)]
- Fix duplicate `with props` error messages.. [[@teymour-aldridge](https://github.com/teymour-aldridge), [#1730](https://github.com/yewstack/yew/pull/1730)]
- Remove extra braces in html_nested macro. [[@Madoshakalaka](https://github.com/Madoshakalaka), [#2169](https://github.com/yewstack/yew/pull/2169)]
- Remove unused punct field from props. [[@Xavientois](https://github.com/Xavientois), [#1969](https://github.com/yewstack/yew/pull/1969)]
Expand Down
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ and follow the repository's README.

## Writing APIs

When building new APIs, think about what it would be like to use them. Would this API cause confusing and hard to pin error mesages? Would this API integrate well with other APIs? Is it intuitive to use this API?
When building new APIs, think about what it would be like to use them. Would this API cause confusing and hard to pin error messages? Would this API integrate well with other APIs? Is it intuitive to use this API?

Below, you can find some useful guidance and best practices on how to write APIs. These are only _guidelines_ and while they are helpful and should be followed where possible, in some cases, it may not be possible to do so.

Expand Down
Loading

0 comments on commit 558b30c

Please sign in to comment.