Skip to content

Commit

Permalink
Merge branch 'master' into immutable
Browse files Browse the repository at this point in the history
  • Loading branch information
cecton authored May 27, 2022
2 parents f63be01 + 7dc7195 commit 0bf27e3
Show file tree
Hide file tree
Showing 164 changed files with 4,049 additions and 1,777 deletions.
2 changes: 0 additions & 2 deletions .cargo/config

This file was deleted.

6 changes: 6 additions & 0 deletions .cargo/config.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
[target.'cfg(target_arch = "wasm32")']
runner = 'wasm-bindgen-test-runner'

[unstable]
doctest-xcompile = true
# [unstable] must be the last section -- ci/write-optimisation-flags.sh relies on it
1 change: 0 additions & 1 deletion .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ Fixes #0000 <!-- replace with issue number or remove if not applicable -->

<!-- For further details, please read CONTRIBUTING.md -->

- [ ] I have run `cargo make pr-flow`
- [ ] I have reviewed my own code
- [ ] I have added tests
<!-- If this is a bug fix, these tests will fail if the bug is present (to stop it from cropping up again) -->
Expand Down
2 changes: 1 addition & 1 deletion .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,5 @@ updates:
- package-ecosystem: "npm"
directory: "/website"
schedule:
interval: "daily"
interval: "monthly"
target-branch: "master"
3 changes: 2 additions & 1 deletion .github/workflows/auto-approve-maintainer-pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ on: pull_request_target
jobs:
auto-approve:
runs-on: ubuntu-latest
if: github.event.pull_request.draft == false
steps:
- name: Check if organization member
id: is_organization_member
Expand All @@ -16,6 +17,6 @@ jobs:

- name: Auto approve
uses: hmarr/auto-approve-action@v2
if: ${{ steps.is_organization_member.outputs.result == 'true' || github.actor == 'dependabot' }}
if: ${{ steps.is_organization_member.outputs.result == 'true' || github.actor == 'dependabot[bot]' }}
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
74 changes: 49 additions & 25 deletions .github/workflows/main-checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ jobs:
uses: actions-rs/cargo@v1
with:
command: clippy
args: --all-targets -- -D warnings
args: --all-targets --all-features -- -D warnings

- name: Lint feature soundness
run: |
Expand All @@ -51,12 +51,11 @@ jobs:

- uses: Swatinem/rust-cache@v1


- name: Run clippy
uses: actions-rs/cargo@v1
with:
command: clippy
args: --all-targets --release -- -D warnings
args: --all-targets --all-features --release -- -D warnings

- name: Lint feature soundness
run: |
Expand All @@ -67,46 +66,60 @@ jobs:
cargo clippy --release --all-features --all-targets -- --deny=warnings
working-directory: packages/yew

spell_check:
name: spellcheck
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Check spelling
run: |
sudo apt-get install aspell
ci/spellcheck.sh list
doc_tests:
name: Documentation Tests
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: Swatinem/rust-cache@v1

- uses: actions-rs/toolchain@v1
with:
toolchain: stable
target: wasm32-unknown-unknown
override: true
profile: minimal

- uses: Swatinem/rust-cache@v1
- name: Install wasm-bindgen-test-runner
run: cargo install --git https://github.com/hamza1311/wasm-bindgen --branch respect-rustdoc-tmp-paths wasm-bindgen-cli

- name: Check spelling
run: |
sudo apt-get install aspell
ci/spellcheck.sh list
- uses: actions/checkout@v2

- uses: actions-rs/toolchain@v1
with:
toolchain: nightly
target: wasm32-unknown-unknown
override: true
profile: minimal

- uses: browser-actions/setup-geckodriver@latest
- uses: nanasess/setup-chromedriver@v1

- name: Run doctest
uses: actions-rs/cargo@v1
with:
command: test
args: --doc
args: --doc --workspace --exclude yew --exclude changelog --exclude website-test --exclude ssr_router --exclude simple_ssr --target wasm32-unknown-unknown

- name: Run website code snippet tests
uses: actions-rs/cargo@v1
with:
command: test
args: -p website-test
args: -p website-test --target wasm32-unknown-unknown

- name: Run doctest - yew with features
uses: actions-rs/cargo@v1
with:
command: test
args: --doc --features doc_test --features wasm_test


args: -p yew --doc --all-features --target wasm32-unknown-unknown

integration_tests:
name: Integration Tests on ${{ matrix.toolchain }}
Expand All @@ -128,23 +141,31 @@ jobs:
override: true
profile: minimal

- uses: jetli/wasm-pack-action@v0.3.0
with:
version: "latest"
- uses: browser-actions/setup-geckodriver@latest
- uses: nanasess/setup-chromedriver@v1

- uses: Swatinem/rust-cache@v1

- name: Install wasm-bindgen-cli
shell: bash
run: |
if [ ! -f "Cargo.lock" ]; then
cargo fetch
fi
VERSION=`cargo pkgid --frozen wasm-bindgen | cut -d ":" -f 3`
cargo install --version $VERSION wasm-bindgen-cli
- name: Run tests - yew
run: |
cd packages/yew
wasm-pack test --chrome --firefox --headless -- --features "wasm_test"
CHROMEDRIVER=$(which chromedriver) cargo test --features csr,hydration,ssr --target wasm32-unknown-unknown
GECKODRIVER=$(which geckodriver) cargo test --features csr,hydration,ssr --target wasm32-unknown-unknown
- name: Run tests - yew-router
run: |
cd packages/yew-router
wasm-pack test --chrome --firefox --headless
CHROMEDRIVER=$(which chromedriver) cargo test --target wasm32-unknown-unknown
GECKODRIVER=$(which geckodriver) cargo test --target wasm32-unknown-unknown
unit_tests:
name: Unit Tests on ${{ matrix.toolchain }}
Expand All @@ -170,13 +191,17 @@ jobs:

- uses: Swatinem/rust-cache@v1

- name: Run tests
- name: Run native tests
uses: actions-rs/cargo@v1
with:
command: test
args: --all-targets --workspace --exclude yew --exclude website-test

args: --all-targets --workspace --exclude yew --exclude website-test --exclude ssr_router --exclude simple_ssr

- name: Run native tests for yew
uses: actions-rs/cargo@v1
with:
command: test
args: -p yew --features "csr,ssr,hydration,tokio"

test-lints:
name: Test lints on nightly
Expand All @@ -192,7 +217,6 @@ jobs:

- uses: Swatinem/rust-cache@v1


- name: Run tests
uses: actions-rs/cargo@v1
with:
Expand Down
50 changes: 4 additions & 46 deletions .github/workflows/post-size-cmp.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@ jobs:
runs-on: ubuntu-latest

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

- if: github.event.workflow_run.event == 'pull_request'
name: Download Artifact
uses: Legit-Labs/action-download-artifact@v2
Expand All @@ -24,52 +27,7 @@ jobs:
path: "size-cmp-info/"

- name: Make pull request comment
run: |
from typing import Dict, List, Optional
import os
import json
with open("size-cmp-info/.SIZE_CMP_INFO") as f:
content = json.loads(f.read())
joined_sizes = content["sizes"]
issue_number = content["issue_number"]
lines: List[str] = []
lines.append("### Size Comparison")
lines.append("")
lines.append("| examples | master (KB) | pull request (KB) | diff |")
lines.append("| --- | --- | --- | --- | ")
for (i, sizes) in joined_sizes:
(master_size, pr_size) = sizes
diff: Optional[int] = None
if master_size is not None and pr_size is not None:
diff = pr_size - master_size
master_size_str = "N/A" if master_size is None else (
f"{master_size / 1024:.3f}" if master_size != 0 else "0"
)
pr_size_str = "N/A" if pr_size is None else (
f"{pr_size / 1024:.3f}" if pr_size != 0 else "0"
)
diff_str = "N/A" if diff is None else (
f"{diff / 1024:.3f}" if diff < 0 else (
f"+{diff / 1024:.3f}" if diff > 0 else "0"
)
)
lines.append(f"| {i} | {master_size_str} | {pr_size_str} | {diff_str} |")
output = "\n".join(lines)
with open(os.environ["GITHUB_ENV"], "a+") as f:
f.write(f"YEW_EXAMPLE_SIZES={json.dumps(output)}\n")
f.write(f"PR_NUMBER={issue_number}\n")
shell: python3 {0}
run: python3 ci/make_example_size_cmt.py

- name: Post Comment
uses: actions/github-script@v6
Expand Down
47 changes: 7 additions & 40 deletions .github/workflows/publish-examples.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,62 +12,29 @@ jobs:
env:
# leave empty for /
PUBLIC_URL_PREFIX: ""
RUSTUP_TOOLCHAIN: nightly

steps:
- uses: actions/checkout@v2
- uses: actions-rs/toolchain@v1
with:
toolchain: stable
toolchain: nightly
target: wasm32-unknown-unknown
components: rust-src
override: true
profile: minimal

- name: Write optimisation flags
run: ./ci/write-optimisation-flags.sh

- uses: Swatinem/rust-cache@v1

- uses: jetli/trunk-action@v0.1.0
with:
# Optional version of trunk to install(eg. 'v0.8.1', 'latest')
version: 'latest'



- name: Build examples
run: |
output="$(pwd)/dist"
mkdir "$output"
for path in examples/*; do
if [[ ! -d $path ]]; then
continue
fi
example=$(basename "$path")
# multi_thread doesn't work yet. See <https://github.com/thedodd/trunk/issues/40>.
if [[ "$example" == "agents" ]]; then
continue
fi
# web_worker_fib does not compile with trunk. See <https://github.com/thedodd/trunk/issues/46>.
if [[ "$example" == "web_worker_fib" ]]; then
continue
fi
# ssr does not need trunk
if [[ "$example" == "simple_ssr" ]]; then
continue
fi
echo "building: $example"
(
cd "$path"
dist_dir="$output/$example"
trunk build --release --dist "$dist_dir" --public-url "$PUBLIC_URL_PREFIX/$example"
)
done
run: ./ci/build-examples.sh

- name: Deploy to Firebase
uses: siku2/action-hosting-deploy@v0
Expand Down
30 changes: 3 additions & 27 deletions .github/workflows/size-cmp.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ on:
branches: [master]
paths:
- .github/workflows/size-cmp.yml
- ci/collect_sizes.py
- "ci/**"
- "packages/**"
- "examples/**"
- "Cargo.toml"
Expand Down Expand Up @@ -56,35 +56,11 @@ jobs:
version: 'latest'

- name: Write optimisation flags for master
run: |
cat >> .cargo/config << EOF
[unstable]
build-std = ["std", "panic_abort"]
build-std-features = ["panic_immediate_abort"]
EOF
cat >> Cargo.toml << EOF
[profile.release]
lto = true
codegen-units = 1
panic = "abort"
opt-level = "z"
EOF
run: ./ci/write-optimisation-flags.sh
working-directory: yew-master

- name: Write optimisation flags for pull request
run: |
cat >> .cargo/config << EOF
[unstable]
build-std = ["std", "panic_abort"]
build-std-features = ["panic_immediate_abort"]
EOF
cat >> Cargo.toml << EOF
[profile.release]
lto = true
codegen-units = 1
panic = "abort"
opt-level = "z"
EOF
run: ./ci/write-optimisation-flags.sh
working-directory: current-pr

- name: Build master examples
Expand Down
Loading

0 comments on commit 0bf27e3

Please sign in to comment.