Skip to content

Commit

Permalink
Split the huge workspace into smaller & improve CI (#2774)
Browse files Browse the repository at this point in the history
* Split repository into multiple workspaces, update CI

* pull_request_target for build-website workflow

This should allow the workflow to read secrets instead of requiring a different, publish-website workflow to be needed to publish the side

* pull_request_target for build-api-docs workflow

This should allow the workflow to read secrets instead of requiring a different, publish-api-docs workflow to be needed to publish the side

* use `paths` instead of `path_ignore` for examples

* cleanup main-checks.yml

* it's rustfmt, not fmt

* correct paths for workflow files

* it's rustfmt, not fmt: part 2 electric bolgoo

* me idiot: part infinity

* ???

* main checks should be the same then?

* ??? part 2

* it should work now

* more fixes

* checkout before using file, actually use stable for wasm-bindgen-cli

* Revert "pull_request_target for build-api-docs workflow"

This reverts commit 3897729.

* Revert "pull_request_target for build-website workflow"

This reverts commit 1638a0c.

* Benchmark workflow uses pull_request event

* pull_request for size-cmp
  • Loading branch information
hamza1311 committed Jul 6, 2022
1 parent 11424bd commit 2e4a919
Show file tree
Hide file tree
Showing 20 changed files with 2,093 additions and 136 deletions.
1 change: 0 additions & 1 deletion .cargo/config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,3 @@ runner = 'wasm-bindgen-test-runner'

[unstable]
doctest-xcompile = true
# [unstable] must be the last section -- ci/write-optimisation-flags.sh relies on it
18 changes: 10 additions & 8 deletions .github/workflows/benchmark.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ on:
- 'website/**'
branches:
- master
pull_request_target:
pull_request:
paths-ignore:
- 'website/**'
types: [labeled, synchronize, opened, reopened]
Expand All @@ -32,6 +32,8 @@ jobs:
# gh-pages branch is updated and pushed automatically with extracted benchmark data
- name: Store benchmark result
uses: benchmark-action/github-action-benchmark@v1
# This needs access to secersts so only run it on push to master
if: github.event_name == 'push'
with:
name: "Yew master branch benchmarks (Lower is better)"
tool: "customSmallerIsBetter"
Expand All @@ -42,11 +44,8 @@ jobs:
# Push and deploy GitHub pages branch automatically
alert-threshold: "200%"
alert-comment-cc-users: "@yewstack/yew"
comment-always: ${{ github.event_name != 'pull_request_target' || contains(github.event.pull_request.labels.*.name, 'performance') }}
comment-on-alert: true
# Don't push to gh-pages if its a pull request
auto-push: ${{ github.event_name != 'pull_request_target' }}
save-data-file: ${{ github.event_name != 'pull_request_target' }}
auto-push: true
save-data-file: true

benchmark:
runs-on: ubuntu-latest
Expand Down Expand Up @@ -243,11 +242,14 @@ jobs:
- name: Build process-benchmark-results
shell: bash
run: |
cd yew
cd yew/tools
cargo build --release -p process-benchmark-results
- name: transform results to be fit for display benchmark-action/github-action-benchmark@v1
uses: mathiasvr/command-output@v1
id: results
with:
run: cat js-framework-benchmark/webdriver-ts/results/results.json | ./yew/target/release/process-benchmark-results
run: cat js-framework-benchmark/webdriver-ts/results/results.json | ./yew/tools/target/release/process-benchmark-results

- name: Show output JSON
run: echo ${{ steps.results.outputs.stdout }}
1 change: 1 addition & 0 deletions .github/workflows/inspect-next-changelogs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ jobs:

- name: Build changelog generator
run: cargo build --release -p changelog
working-directory: tools

- name: Read yew changelog in this step
run: ./target/release/changelog yew minor -t ${{ secrets.GITHUB_TOKEN }}
Expand Down
93 changes: 39 additions & 54 deletions .github/workflows/main-checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,24 @@ name: Main Checks

on:
pull_request:
paths:
- '.github/workflows/main-checks.yml'
- 'ci/**'
- 'packages/**/*'
- 'Cargo.toml'
push:
branches: [master]

jobs:

clippy:
name: Clippy
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
profile:
- dev
- release
steps:
- uses: actions/checkout@v2
- uses: actions-rs/toolchain@v1
Expand All @@ -25,34 +35,15 @@ jobs:
uses: actions-rs/cargo@v1
with:
command: clippy
args: --all-targets --features "csr,ssr,hydration,tokio" -- -D warnings
args: --all-targets --features "csr,ssr,hydration,tokio" --profile ${{ matrix.profile }} -- -D warnings

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


clippy-release:
name: Clippy on release profile
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions-rs/toolchain@v1
with:
toolchain: stable
override: true
profile: minimal
components: clippy

- uses: Swatinem/rust-cache@v1

- name: Run clippy
uses: actions-rs/cargo@v1
with:
command: clippy
args: --all-targets --features "csr,ssr,hydration,tokio" --release -- -D warnings

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

Expand All @@ -70,6 +61,7 @@ jobs:
name: Documentation Tests
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: Swatinem/rust-cache@v1

- uses: actions-rs/toolchain@v1
Expand All @@ -78,10 +70,16 @@ jobs:
override: true
profile: minimal

- name: Install wasm-bindgen-test-runner
run: cargo install --git https://github.com/hamza1311/wasm-bindgen --branch respect-rustdoc-tmp-paths wasm-bindgen-cli
# perhaps extract it into its own little action?
- uses: actions-rs/toolchain@v1
# for wasm-bindgen-cli, always use stable rust
with:
toolchain: stable
profile: minimal

- uses: actions/checkout@v2
- name: Install wasm-bindgen-cli
shell: bash
run: ./ci/install-wasm-bindgen-cli.sh

- uses: actions-rs/toolchain@v1
with:
Expand All @@ -97,13 +95,11 @@ jobs:
uses: actions-rs/cargo@v1
with:
command: test
args: --doc --workspace --exclude yew --exclude changelog --exclude website-test --exclude ssr_router --exclude simple_ssr --target wasm32-unknown-unknown
args: --doc --workspace --exclude yew --target wasm32-unknown-unknown

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

- name: Run doctest - yew with features
uses: actions-rs/cargo@v1
Expand All @@ -116,20 +112,27 @@ jobs:
runs-on: ubuntu-latest

strategy:
fail-fast: false
matrix:
toolchain:
# anyway to dynamically grep the MSRV from Cargo.toml?
- 1.60.0 # MSRV
- 1.60.0
- stable

steps:
- uses: actions/checkout@v2

- uses: Swatinem/rust-cache@v1

- uses: actions-rs/toolchain@v1
# for wasm-bindgen-cli, always use stable rust
with:
toolchain: stable
profile: minimal

- name: Install wasm-bindgen-cli
shell: bash
run: ./ci/install-wasm-bindgen-cli.sh

- uses: actions-rs/toolchain@v1
with:
toolchain: ${{ matrix.toolchain }}
Expand All @@ -140,24 +143,6 @@ jobs:
- 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 decided to change syntax after 1.61
if [ "$VERSION" = "" ]; then
VERSION=$(cargo pkgid --frozen wasm-bindgen | cut -d "@" -f 2)
fi
cargo +stable install --version $VERSION wasm-bindgen-cli
- name: Run tests - yew
run: |
cd packages/yew
Expand All @@ -174,10 +159,10 @@ jobs:
name: Unit Tests on ${{ matrix.toolchain }}
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
toolchain:
# anyway to dynamically grep the MSRV from Cargo.toml?
- 1.60.0 # MSRV
- 1.60.0
- stable
- nightly

Expand All @@ -198,7 +183,7 @@ jobs:
uses: actions-rs/cargo@v1
with:
command: test
args: --all-targets --workspace --exclude yew --exclude website-test --exclude ssr_router --exclude simple_ssr
args: --all-targets --workspace --exclude yew

- name: Run native tests for yew
uses: actions-rs/cargo@v1
Expand Down
9 changes: 3 additions & 6 deletions .github/workflows/publish-examples.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ name: Publish Examples
on:
push:
branches: [master]
paths-ignore:
- "**/*.md"
- "website/**"
paths:
- 'ci/**'
- 'examples/**'

jobs:
publish:
Expand All @@ -24,9 +24,6 @@ jobs:
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
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/publish-yew-agent.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ jobs:

- name: Build changelog generator
run: cargo build --release -p changelog
working-directory: tools

- name: Generate changelog
uses: mathiasvr/command-output@v1
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/publish-yew-only.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ jobs:

- name: Build changelog generator
run: cargo build --release -p changelog
working-directory: tools

- name: Generate changelog
uses: mathiasvr/command-output@v1
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/publish-yew-router-only.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ jobs:

- name: Build changelog generator
run: cargo build --release -p changelog
working-directory: tools

- name: Generate changelog
uses: mathiasvr/command-output@v1
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/publish-yew-router.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ jobs:

- name: Build changelog generator
run: cargo build --release -p changelog
working-directory: tools

- name: Generate changelog
uses: mathiasvr/command-output@v1
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/publish-yew.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ jobs:

- name: Build changelog generator
run: cargo build --release -p changelog
working-directory: tools

- name: Generate changelog
uses: mathiasvr/command-output@v1
Expand Down
8 changes: 0 additions & 8 deletions .github/workflows/size-cmp.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,14 +55,6 @@ jobs:
with:
version: 'latest'

- name: Write optimisation flags for master
run: ./ci/write-optimisation-flags.sh
working-directory: yew-master

- name: Write optimisation flags for pull request
run: ./ci/write-optimisation-flags.sh
working-directory: current-pr

- name: Build master examples
run: find examples/*/index.html | xargs -I '{}' trunk build --release '{}' || exit 0
working-directory: yew-master
Expand Down
55 changes: 55 additions & 0 deletions .github/workflows/tools-examples.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
name: Tools & Examples

on:
pull_request:
paths:
- '.github/workflows/tools-examples.yml'
- 'tools/**/*'
- 'examples/**/*'
push:
branches: [ master ]


jobs:
clippy-fmt:
name: Clippy & Format
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
workspace:
- tools
- examples
runs:
- clippy
- rustfmt
include:
- toolchain: stable
runs: clippy
- toolchain: nightly
runs: rustfmt

steps:
- uses: actions/checkout@v2
- uses: actions-rs/toolchain@v1
with:
toolchain: ${{ matrix.toolchain }}
override: true
profile: minimal
components: ${{ matrix.runs }}

- uses: Swatinem/rust-cache@v1

- name: Run clippy for ${{ matrix.workspace }}
if: matrix.runs == 'clippy'
uses: actions-rs/cargo@v1
with:
command: clippy
args: --all-targets --all-features --manifest-path ${{ matrix.workspace }}/Cargo.toml -- -D warnings

- name: Run fmt for ${{ matrix.workspace }}
if: matrix.runs == 'rustfmt'
uses: actions-rs/cargo@v1
with:
command: fmt
args: --all --manifest-path ${{ matrix.workspace }}/Cargo.toml -- --check

0 comments on commit 2e4a919

Please sign in to comment.