Skip to content

Typo fix

Typo fix #726

Workflow file for this run

name: Tests
on:
pull_request:
push:
branches: [master]
jobs:
native_tests:
strategy:
fail-fast: false
matrix:
rust-version: [1.64, stable, nightly]
name: Native Tests
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ matrix.rust-version }}
- uses: actions/cache@v3
with:
path: |
~/.cargo/registry
~/.cargo/git
target
key: cargo-${{ runner.os }}-native-tests-${{ hashFiles('**/Cargo.toml') }}
restore-keys: |
cargo-${{ runner.os }}-doc-tests-
cargo-${{ runner.os }}-
- name: Run tests
run: cargo test --workspace --exclude gloo-net
browser_tests:
strategy:
fail-fast: false
matrix:
rust-version: [1.64, stable, nightly]
name: Browser Tests
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ matrix.rust-version }}
target: wasm32-unknown-unknown
- name: Install wasm-pack
run: curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf | sh
- name: Setup trunk
uses: jetli/[email protected]
with:
version: 'latest'
- uses: actions/cache@v3
with:
path: |
~/.cargo/registry
~/.cargo/git
target
key: cargo-${{ runner.os }}-browser-tests-${{ hashFiles('**/Cargo.toml') }}
restore-keys: |
cargo-${{ runner.os }}-browser-tests-
cargo-${{ runner.os }}-
- name: Run tests
run: |
for x in $(ls crates); do
# gloo-net is tested separately
if [[ "$x" == "net" ]]; then
continue
fi
if [[ "$x" == "worker-macros" ]]; then
continue
fi
wasm-pack test --headless --firefox --chrome crates/$x --all-features
wasm-pack test --headless --firefox --chrome crates/$x --no-default-features
done
node_tests:
strategy:
fail-fast: false
matrix:
rust-version: [1.64, stable, nightly]
name: Node Tests
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ matrix.rust-version }}
target: wasm32-unknown-unknown
- name: Install wasm-pack
run: curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf | sh
- uses: actions/cache@v3
with:
path: |
~/.cargo/registry
~/.cargo/git
target
key: cargo-${{ runner.os }}-node-tests-${{ hashFiles('**/Cargo.toml') }}
restore-keys: |
cargo-${{ runner.os }}-node-tests-
cargo-${{ runner.os }}-
- name: Run tests
run: |
for x in $(ls crates); do
# gloo-net is tested separately
if [[ "$x" == "net" ]]; then
continue
fi
wasm-pack test --node crates/$x --all-features
wasm-pack test --node crates/$x --no-default-features
done
test-history-wasi:
name: Test gloo-history WASI
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
rust-version: [1.64, stable, nightly]
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ matrix.rust-version }}
target: wasm32-wasi
- name: Install wasmtime
run: |
wget https://github.com/bytecodealliance/wasmtime/releases/download/v15.0.1/wasmtime-v15.0.1-x86_64-linux.tar.xz
tar xf wasmtime-v15.0.1-x86_64-linux.tar.xz
mv wasmtime-v15.0.1-x86_64-linux/wasmtime ~/wasmtime
rm -rf wasmtime-v15.0.1-x86_64-linux.tar.xz wasmtime-v15.0.1-x86_64-linux
chmod +x ~/wasmtime
- uses: actions/cache@v3
with:
path: |
~/.cargo/registry
~/.cargo/git
target
key: cargo-${{ runner.os }}-node-tests-${{ hashFiles('**/Cargo.toml') }}
restore-keys: |
cargo-${{ runner.os }}-node-tests-
cargo-${{ runner.os }}-
- name: Build and run example history-wasi
run: |
cargo build --package example-history-wasi --target wasm32-wasi
~/wasmtime --trap-unknown-imports target/wasm32-wasi/debug/example-history-wasi.wasm
test-worker:
name: Test gloo-worker
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
# example: [ markdown, prime ]
example: [markdown]
rust-version: [1.64, stable, nightly]
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ matrix.rust-version }}
target: wasm32-unknown-unknown
- name: Install wasm-pack
run: curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf | sh
- name: Setup trunk
uses: jetli/[email protected]
with:
version: 'latest'
- uses: actions/cache@v3
with:
path: |
~/.cargo/registry
~/.cargo/git
target
key: cargo-${{ runner.os }}-browser-tests-${{ hashFiles('**/Cargo.toml') }}
restore-keys: |
cargo-${{ runner.os }}-test-worker-
cargo-${{ runner.os }}-
- name: Build and Run Test Server
run: |
cargo build -p example-${{ matrix.example }} --bin example_${{ matrix.example }}_test_server
nohup target/debug/example_${{ matrix.example }}_test_server examples/${{ matrix.example }}/dist &
- name: Build Test Worker
run: |
trunk build examples/${{ matrix.example }}/index.html
- name: Run tests for gloo worker
run: |
wasm-pack test --headless --chrome --firefox examples/${{ matrix.example }}
test-net:
strategy:
fail-fast: false
matrix:
rust-version: [1.64, stable, nightly]
name: Test gloo-net
runs-on: ubuntu-latest
services:
httpbin:
image: kennethreitz/httpbin@sha256:599fe5e5073102dbb0ee3dbb65f049dab44fa9fc251f6835c9990f8fb196a72b
ports:
- 8080:80
echo_server:
image: jmalloc/echo-server@sha256:e43a10c9ecbd025df7ed6dac1e45551ce7bd676142600b0734fe7dcd10a47abe
ports:
- 8081:8080
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@master
with:
toolchain: stable
target: wasm32-unknown-unknown
- name: Install wasm-pack
run: curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf | sh
- uses: actions/cache@v3
with:
path: |
~/.cargo/registry
~/.cargo/git
target
key: cargo-${{ runner.os }}-test-${{ hashFiles('**/Cargo.toml') }}
restore-keys: |
cargo-${{ runner.os }}-test-
cargo-${{ runner.os }}-
- name: Run browser tests
env:
HTTPBIN_URL: 'http://localhost:8080'
WS_ECHO_SERVER_URL: 'ws://localhost:8081'
SSE_ECHO_SERVER_URL: 'http://localhost:8081/.sse'
run: |
cd crates/net
wasm-pack test --chrome --firefox --headless --all-features
- uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ matrix.rust-version }}
target: wasm32-unknown-unknown
- name: Run native tests
env:
HTTPBIN_URL: 'http://localhost:8080'
WS_ECHO_SERVER_URL: 'ws://localhost:8081'
SSE_ECHO_SERVER_URL: 'http://localhost:8081/.sse'
run: cargo test -p gloo-net --all-features