Try to supports WASI targets. #560
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
name: Run Tests & Publishing | |
on: [push, pull_request] | |
jobs: | |
rustfmt: | |
name: Check Formatting | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout Project | |
uses: actions/checkout@v4 | |
- name: Setup Rust | |
uses: dtolnay/rust-toolchain@nightly | |
with: | |
components: rustfmt, clippy | |
- name: Restore Rust Cache | |
uses: Swatinem/rust-cache@v2 | |
- name: Run cargo fmt -- --check | |
run: cargo +nightly fmt --all -- --check --unstable-features | |
lint: | |
name: Lint | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout Project | |
uses: actions/checkout@v4 | |
- name: Setup Rust | |
uses: dtolnay/rust-toolchain@stable | |
with: | |
components: rustfmt, clippy | |
- name: Restore Rust Cache | |
uses: Swatinem/rust-cache@v2 | |
- name: Run cargo clippy | |
run: cargo clippy --all --features parser,yew_integration,yew_use_media_query,yew_use_style,ssr,hydration | |
env: | |
RUSTFLAGS: '--cfg releasing' | |
test-native: | |
name: Run Native Tests | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
toolchain: | |
- 1.76.0 | |
- stable | |
- nightly | |
steps: | |
- name: Checkout Project | |
uses: actions/checkout@v4 | |
- name: Setup Rust | |
uses: dtolnay/rust-toolchain@stable | |
with: | |
toolchain: ${{ matrix.toolchain }} | |
components: rustfmt, clippy | |
- name: Restore Rust Cache | |
uses: Swatinem/rust-cache@v2 | |
- name: Run cargo test | |
run: | | |
cargo test -p stylist --all-features | |
cargo test -p stylist-core --all-features | |
cargo test -p stylist-macros --all-features | |
env: | |
RUSTFLAGS: '--cfg releasing' | |
test-web: | |
name: Run Browser Tests | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout Project | |
uses: actions/checkout@v4 | |
- name: Setup Rust | |
uses: dtolnay/rust-toolchain@stable | |
with: | |
targets: wasm32-unknown-unknown | |
components: rustfmt, clippy | |
- name: Restore Rust Cache | |
uses: Swatinem/rust-cache@v2 | |
- name: Setup trunk | |
uses: jetli/[email protected] | |
with: | |
version: 'latest' | |
- name: Build WASM | |
run: cargo build --all --target=wasm32-unknown-unknown | |
env: | |
RUSTFLAGS: '--cfg releasing' | |
- name: Install wasm-pack | |
run: curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf | sh | |
- name: Run Browser Tests | |
run: | | |
wasm-pack test --headless --chrome --firefox examples/yew-integration | |
wasm-pack test --headless --chrome --firefox examples/yew-ssr | |
publish: | |
name: Publish to crates.io | |
runs-on: ubuntu-latest | |
needs: | |
- lint | |
- rustfmt | |
- test-native | |
- test-web | |
if: github.event_name == 'push' && (github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/tags/')) | |
steps: | |
- name: Checkout Project | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Setup Rust | |
uses: dtolnay/rust-toolchain@stable | |
with: | |
components: rustfmt, clippy | |
- name: Restore Rust Cache | |
uses: Swatinem/rust-cache@v2 | |
- name: Run cargo publish --dry-run for stylist-core | |
if: github.event_name == 'push' && github.ref == 'refs/heads/master' | |
run: cargo publish --dry-run --manifest-path packages/stylist-core/Cargo.toml | |
env: | |
RUSTFLAGS: '--cfg releasing' | |
- name: Run cargo publish for stylist-core | |
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/') | |
run: cargo publish --token ${{ secrets.CRATES_IO_TOKEN }} --manifest-path packages/stylist-core/Cargo.toml | |
env: | |
RUSTFLAGS: '--cfg releasing' | |
- name: Wait crates.io to Refresh | |
run: sleep 30s | |
shell: bash | |
# Not possible if stylist-core does not have a compatible version on crates.io | |
# - name: Run cargo publish --dry-run for stylist-macros | |
# if: github.event_name == 'push' && github.ref == 'refs/heads/master' | |
# run: cargo publish --dry-run --manifest-path packages/stylist-macros/Cargo.toml | |
# env: | |
# RUSTFLAGS: "--cfg releasing" | |
- name: Run cargo publish for stylist-macros | |
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/') | |
run: cargo publish --token ${{ secrets.CRATES_IO_TOKEN }} --manifest-path packages/stylist-macros/Cargo.toml | |
env: | |
RUSTFLAGS: '--cfg releasing' | |
- name: Wait crates.io to Refresh | |
run: sleep 30s | |
shell: bash | |
# Not possible if stylist-core or stylist-macros do not have a compatible version on crates.io | |
# - name: Run cargo publish --dry-run for stylist | |
# if: github.event_name == 'push' && github.ref == 'refs/heads/master' | |
# run: cargo publish --dry-run --manifest-path packages/stylist/Cargo.toml | |
# env: | |
# RUSTFLAGS: "--cfg releasing" | |
- name: Run cargo publish for stylist | |
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/') | |
run: cargo publish --token ${{ secrets.CRATES_IO_TOKEN }} --manifest-path packages/stylist/Cargo.toml | |
env: | |
RUSTFLAGS: '--cfg releasing' |