Skip to content

Try to supports WASI targets. #536

Try to supports WASI targets.

Try to supports WASI targets. #536

Workflow file for this run

---
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 --all-features
env:
RUSTFLAGS: '--cfg releasing'
test-native-stable:
name: Run Native Tests (Stable)
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 test
run: cargo test --all-features --all
env:
RUSTFLAGS: '--cfg releasing'
test-native-msrv:
name: Run Native Tests (MSRV)
runs-on: ubuntu-latest
steps:
- name: Checkout Project
uses: actions/checkout@v4
- name: Setup Rust
uses: dtolnay/rust-toolchain@1.66.0
with:
components: rustfmt, clippy
- name: Restore Rust Cache
uses: Swatinem/rust-cache@v2
# We only run tests on core packages, examples can be upgraded to be incompatible of msrv.
- name: Run cargo test
run: |
cargo test --all-features --package stylist-core
cargo test --all-features --package stylist-macros
cargo test --all-features --package stylist
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/trunk-action@v0.4.0
with:
version: 'latest'
- name: Run cargo build --all --target=wasm32-unknown-unknown
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-stable
- test-native-msrv
- 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'