From 4d0ac78d7031ce6a43b53941471ee87663760e0a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Zoe=20Faltib=C3=A0?= Date: Mon, 16 Sep 2024 17:57:25 +0200 Subject: [PATCH 1/3] CI: fix wasm-testing job --- .github/workflows/test.yml | 11 +-- Cargo.lock | 142 ++++++++++++++++++++++++++++++++----- Cargo.toml | 3 + 3 files changed, 132 insertions(+), 24 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index f40b2cd..1de8a16 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -27,14 +27,9 @@ jobs: wasm-testing: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 - - name: Install rust nightly - uses: actions-rs/toolchain@v1 - with: - toolchain: nightly - override: true - - uses: Swatinem/rust-cache@v2 - - uses: jetli/wasm-pack-action@v0.3.0 + - uses: actions/checkout@v4 + - uses: dtolnay/rust-toolchain@stable + - uses: jetli/wasm-pack-action@v0.4.0 - name: Add wasm32 target run: rustup target add wasm32-unknown-unknown - name: Test in headless Chrome diff --git a/Cargo.lock b/Cargo.lock index 5a4774d..caa1eb8 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -21,8 +21,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "759dcbfaf94d838367a86d493ec34ccc8aa6fe365cb7880d6bf89006de24d9c1" dependencies = [ "amplify_syn", - "proc-macro2", - "quote", + "proc-macro2 1.0.81", + "quote 1.0.36", "syn 1.0.109", ] @@ -41,8 +41,8 @@ version = "2.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7736fb8d473c0d83098b5bac44df6a561e20470375cd8bcae30516dc889fd62a" dependencies = [ - "proc-macro2", - "quote", + "proc-macro2 1.0.81", + "quote 1.0.36", "syn 1.0.109", ] @@ -60,6 +60,7 @@ dependencies = [ "base64", "mnemonic", "sha2", + "wasm-bindgen-test", ] [[package]] @@ -83,12 +84,28 @@ version = "3.16.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "79296716171880943b8470b5f8d03aa55eb2e645a4874bdbb28adb49162e012c" +[[package]] +name = "cfg-if" +version = "0.1.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4785bdd1c96b2a846b2bd7cc02e86b6b3dbf14e7e53446c4f54c92a361040822" + [[package]] name = "cfg-if" version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" +[[package]] +name = "console_error_panic_hook" +version = "0.1.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a06aeb73f470f66dcdbf7223caeebb85984942f22f1adb2a088cf9668146bbbc" +dependencies = [ + "cfg-if 1.0.0", + "wasm-bindgen", +] + [[package]] name = "cpufeatures" version = "0.2.12" @@ -118,6 +135,12 @@ dependencies = [ "crypto-common", ] +[[package]] +name = "futures" +version = "0.1.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3a471a38ef8ed83cd6e40aa59c1ffe17db6855c18e3604d9c4ed8c08ebc28678" + [[package]] name = "generic-array" version = "0.14.7" @@ -128,6 +151,15 @@ dependencies = [ "version_check", ] +[[package]] +name = "js-sys" +version = "0.3.69" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "29c15563dc2726973df627357ce0c9ddddbea194836909d655df6a75d2cf296d" +dependencies = [ + "wasm-bindgen", +] + [[package]] name = "libc" version = "0.2.153" @@ -152,6 +184,15 @@ version = "1.19.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3fdb12b2476b595f9358c5161aa467c2438859caa136dec86c26fdd2efe17b92" +[[package]] +name = "proc-macro2" +version = "0.4.30" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cf3d2011ab5c909338f7887f4fc896d35932e29146c12c8d01da6b22a80ba759" +dependencies = [ + "unicode-xid", +] + [[package]] name = "proc-macro2" version = "1.0.81" @@ -161,22 +202,37 @@ dependencies = [ "unicode-ident", ] +[[package]] +name = "quote" +version = "0.6.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6ce23b6b870e8f94f81fb0a363d65d86675884b34a09043c81e5562f11c1f8e1" +dependencies = [ + "proc-macro2 0.4.30", +] + [[package]] name = "quote" version = "1.0.36" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0fa76aaf39101c457836aec0ce2316dbdc3ab723cdda1c6bd4e6ad4208acaca7" dependencies = [ - "proc-macro2", + "proc-macro2 1.0.81", ] +[[package]] +name = "scoped-tls" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e1cf6437eb19a8f4a6cc0f7dca544973b0b78843adbfeb3683d1a94a0024a294" + [[package]] name = "sha2" version = "0.10.8" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "793db75ad2bcafc3ffa7c68b215fee268f537982cd901d132f89c6343f3a3dc8" dependencies = [ - "cfg-if", + "cfg-if 1.0.0", "cpufeatures", "digest", ] @@ -187,8 +243,8 @@ version = "1.0.109" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "72b64191b275b66ffe2469e8af2c1cfe3bafa67b529ead792a6d0160888b4237" dependencies = [ - "proc-macro2", - "quote", + "proc-macro2 1.0.81", + "quote 1.0.36", "unicode-ident", ] @@ -198,8 +254,8 @@ version = "2.0.60" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "909518bc7b1c9b779f1bbf07f2929d35af9f0f37e47c6e9ef7f9dddc1e1821f3" dependencies = [ - "proc-macro2", - "quote", + "proc-macro2 1.0.81", + "quote 1.0.36", "unicode-ident", ] @@ -215,6 +271,12 @@ version = "1.0.12" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b" +[[package]] +name = "unicode-xid" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fc72304796d0818e357ead4e000d19c9c174ab23dc11093ac919054d20a6a7fc" + [[package]] name = "version_check" version = "0.9.4" @@ -227,7 +289,7 @@ version = "0.2.92" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4be2531df63900aeb2bca0daaaddec08491ee64ceecbee5076636a3b026795a8" dependencies = [ - "cfg-if", + "cfg-if 1.0.0", "wasm-bindgen-macro", ] @@ -240,19 +302,32 @@ dependencies = [ "bumpalo", "log", "once_cell", - "proc-macro2", - "quote", + "proc-macro2 1.0.81", + "quote 1.0.36", "syn 2.0.60", "wasm-bindgen-shared", ] +[[package]] +name = "wasm-bindgen-futures" +version = "0.3.27" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "83420b37346c311b9ed822af41ec2e82839bfe99867ec6c54e2da43b7538771c" +dependencies = [ + "cfg-if 0.1.10", + "futures", + "js-sys", + "wasm-bindgen", + "web-sys", +] + [[package]] name = "wasm-bindgen-macro" version = "0.2.92" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a1f8823de937b71b9460c0c34e25f3da88250760bec0ebac694b49997550d726" dependencies = [ - "quote", + "quote 1.0.36", "wasm-bindgen-macro-support", ] @@ -262,8 +337,8 @@ version = "0.2.92" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e94f17b526d0a461a191c78ea52bbce64071ed5c04c9ffe424dcb38f74171bb7" dependencies = [ - "proc-macro2", - "quote", + "proc-macro2 1.0.81", + "quote 1.0.36", "syn 2.0.60", "wasm-bindgen-backend", "wasm-bindgen-shared", @@ -274,3 +349,38 @@ name = "wasm-bindgen-shared" version = "0.2.92" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "af190c94f2773fdb3729c55b007a722abb5384da03bc0986df4c289bf5567e96" + +[[package]] +name = "wasm-bindgen-test" +version = "0.2.50" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a2d9693b63a742d481c7f80587e057920e568317b2806988c59cd71618bc26c1" +dependencies = [ + "console_error_panic_hook", + "futures", + "js-sys", + "scoped-tls", + "wasm-bindgen", + "wasm-bindgen-futures", + "wasm-bindgen-test-macro", +] + +[[package]] +name = "wasm-bindgen-test-macro" +version = "0.2.50" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0789dac148a8840bbcf9efe13905463b733fa96543bfbf263790535c11af7ba5" +dependencies = [ + "proc-macro2 0.4.30", + "quote 0.6.13", +] + +[[package]] +name = "web-sys" +version = "0.3.69" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "77afa9a11836342370f4817622a2f0f418b134426d91a82dfb48f532d2ec13ef" +dependencies = [ + "js-sys", + "wasm-bindgen", +] diff --git a/Cargo.toml b/Cargo.toml index f763273..995ca03 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -19,3 +19,6 @@ amplify = "4.6.0" base64 = "0.22.1" sha2 = "0.10.8" mnemonic = "1.1.1" + +[target.'cfg(target_arch = "wasm32")'.dev-dependencies] +wasm-bindgen-test = "0.2" From c68e5299edb74b7058f4585233ef95e2fa8d6db4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Zoe=20Faltib=C3=A0?= Date: Tue, 17 Sep 2024 13:39:01 +0200 Subject: [PATCH 2/3] add alloc/std features --- Cargo.lock | 35 +++++++++++++++++++++++++---------- Cargo.toml | 16 +++++++++++++--- src/lib.rs | 32 ++++++++++++++++++++++++++++++-- 3 files changed, 68 insertions(+), 15 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index caa1eb8..701ce1d 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -4,10 +4,10 @@ version = 3 [[package]] name = "amplify" -version = "4.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9e711289a6cb28171b4f0e6c8019c69ff9476050508dc082167575d458ff74d0" +version = "4.7.0" +source = "git+https://github.com/zoedberg/rust-amplify?branch=minor_fixes#b16d79c7481544787510c726631d444e1cf6d3d6" dependencies = [ + "amplify_apfloat", "amplify_derive", "amplify_num", "ascii", @@ -15,10 +15,20 @@ dependencies = [ ] [[package]] -name = "amplify_derive" -version = "4.0.0" +name = "amplify_apfloat" +version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "759dcbfaf94d838367a86d493ec34ccc8aa6fe365cb7880d6bf89006de24d9c1" +checksum = "695e433882668b55b3d7fb0ba22bf9be66a91abe30d7ca1f1a774f8b90b4db4c" +dependencies = [ + "amplify_num", + "bitflags", + "wasm-bindgen", +] + +[[package]] +name = "amplify_derive" +version = "4.0.1" +source = "git+https://github.com/zoedberg/amplify-derive?branch=minor_fixes#c2933e97791603801c03af8cd0a939a0d8e697ee" dependencies = [ "amplify_syn", "proc-macro2 1.0.81", @@ -28,9 +38,9 @@ dependencies = [ [[package]] name = "amplify_num" -version = "0.5.2" +version = "0.5.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "04c009c5c4de814911b177e2ea59e4930bb918978ed3cce4900d846a6ceb0838" +checksum = "99bcb75a2982047f733547042fc3968c0f460dfcf7d90b90dea3b2744580e9ad" dependencies = [ "wasm-bindgen", ] @@ -38,8 +48,7 @@ dependencies = [ [[package]] name = "amplify_syn" version = "2.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7736fb8d473c0d83098b5bac44df6a561e20470375cd8bcae30516dc889fd62a" +source = "git+https://github.com/zoedberg/amplify-derive?branch=minor_fixes#c2933e97791603801c03af8cd0a939a0d8e697ee" dependencies = [ "proc-macro2 1.0.81", "quote 1.0.36", @@ -69,6 +78,12 @@ version = "0.22.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "72b3254f16251a8381aa12e40e3c4d2f0199f8c6508fbecb9d91f575e0fbb8c6" +[[package]] +name = "bitflags" +version = "2.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b048fb63fd8b5923fc5aa7b340d8e156aec7ec02f0c78fa8a6ddc2613f6f71de" + [[package]] name = "block-buffer" version = "0.10.4" diff --git a/Cargo.toml b/Cargo.toml index 995ca03..cb077b8 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -15,10 +15,20 @@ license = "Apache-2.0" [lib] [dependencies] -amplify = "4.6.0" -base64 = "0.22.1" -sha2 = "0.10.8" +amplify = { version = "4.7.0", default-features = false, features = ["derive"] } +base64 = { version = "0.22.1", default-features = false } +sha2 = { version = "0.10.8", default-features = false } mnemonic = "1.1.1" [target.'cfg(target_arch = "wasm32")'.dev-dependencies] wasm-bindgen-test = "0.2" + +[features] +default = ["std"] +all = ["std"] +std = ["amplify/std", "amplify/apfloat_std", "base64/std", "sha2/std"] +alloc = ["amplify/alloc", "amplify/apfloat_alloc", "base64/alloc"] + +[patch.crates-io] +amplify = { git = "https://github.com/zoedberg/rust-amplify", branch = "minor_fixes" } +amplify_derive = { git = "https://github.com/zoedberg/amplify-derive", branch = "minor_fixes" } diff --git a/src/lib.rs b/src/lib.rs index f3c38e5..44e5f5b 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -19,11 +19,39 @@ // See the License for the specific language governing permissions and // limitations under the License. +#![no_std] + +#[cfg(feature = "std")] +extern crate std; + +#[cfg(feature = "alloc")] +extern crate alloc; + +#[cfg(not(any(feature = "std", feature = "alloc")))] +compile_error!("Either `std` or `alloc` feature must be enabled."); + +#[cfg(all(feature = "std", feature = "alloc"))] +compile_error!("Both `std` and `alloc` features cannot be enabled at the same time."); + #[macro_use] extern crate amplify; -use std::error::Error; -use std::fmt::{self, Display, Formatter}; +extern crate core; + +#[cfg(feature = "alloc")] +use alloc::{ + borrow::ToOwned, + string::{String, ToString}, + vec::Vec, +}; +use core::error::Error; +use core::fmt::{self, Debug, Display, Formatter}; +#[cfg(feature = "std")] +use std::{ + borrow::ToOwned, + string::{String, ToString}, + vec::Vec, +}; use base64::Engine; use sha2::Digest; From c23b7144f026219d85fd67e1c49d28cf4362da5f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Zoe=20Faltib=C3=A0?= Date: Tue, 17 Sep 2024 14:07:00 +0200 Subject: [PATCH 3/3] update CI workflows --- .github/workflows/build.yml | 87 +++++++++++++---------------------- .github/workflows/codecov.yml | 57 +++++++++-------------- .github/workflows/lint.yml | 52 ++++++++------------- .github/workflows/test.yml | 31 +++++++------ 4 files changed, 92 insertions(+), 135 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 66bfa24..1c5a036 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -2,9 +2,15 @@ name: Build on: push: - branches: [ master ] + branches: + - master + tags: + - 'v[0-9]+\.*' pull_request: - branches: [ master ] + branches: + - master + - develop + - 'v[0-9]+.[0-9]+' env: CARGO_TERM_COLOR: always @@ -13,40 +19,25 @@ jobs: default: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 - - name: Install rust stable - uses: actions-rs/toolchain@v1 - with: - toolchain: stable - override: true + - uses: actions/checkout@v4 + - uses: dtolnay/rust-toolchain@stable - name: Default build - uses: actions-rs/cargo@v1 - with: - command: check - args: --workspace - # features: - # runs-on: ubuntu-latest - # strategy: - # fail-fast: false - # matrix: - # feature: - # steps: - # - uses: actions/checkout@v2 - # - name: Install rust stable - # uses: actions-rs/toolchain@v1 - # with: - # toolchain: stable - # override: true - # - name: Feature ${{ matrix.feature }} - # uses: actions-rs/cargo@v1 - # with: - # command: check - # args: --no-default-features --features=${{ matrix.feature }} - # - name: Defaults + ${{ matrix.feature }} - # uses: actions-rs/cargo@v1 - # with: - # command: check - # args: --features=${{ matrix.feature }} + run: cargo check --workspace + features: + runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + feature: + - alloc + - std + steps: + - uses: actions/checkout@v4 + - uses: dtolnay/rust-toolchain@stable + - name: Feature ${{ matrix.feature }} + run: cargo check --no-default-features --features=${{ matrix.feature }} + - name: Defaults + ${{ matrix.feature }} + run: cargo check --features=${{ matrix.feature }} platforms: runs-on: ${{ matrix.os }} strategy: @@ -54,17 +45,10 @@ jobs: matrix: os: [ ubuntu-20.04, ubuntu-22.04, macos-12, macos-13, windows-2019, windows-2022 ] steps: - - uses: actions/checkout@v2 - - name: Install rust stable - uses: actions-rs/toolchain@v1 - with: - toolchain: stable - override: true + - uses: actions/checkout@v4 + - uses: dtolnay/rust-toolchain@stable - name: Build with all features - uses: actions-rs/cargo@v1 - with: - command: check - args: --workspace --all-targets --all-features + run: cargo check --workspace --all-targets --all-features toolchains: runs-on: ubuntu-latest strategy: @@ -72,14 +56,7 @@ jobs: matrix: toolchain: [ nightly, beta, stable, 1.75.0 ] steps: - - uses: actions/checkout@v2 - - name: Install rust ${{ matrix.toolchain }} - uses: actions-rs/toolchain@v1 - with: - toolchain: ${{ matrix.toolchain }} - override: true + - uses: actions/checkout@v4 + - uses: dtolnay/rust-toolchain@stable - name: All features - uses: actions-rs/cargo@v1 - with: - command: check - args: --workspace --all-targets --all-features + run: cargo check --workspace --all-targets --all-features diff --git a/.github/workflows/codecov.yml b/.github/workflows/codecov.yml index 2077319..3711d7a 100644 --- a/.github/workflows/codecov.yml +++ b/.github/workflows/codecov.yml @@ -2,9 +2,15 @@ name: Codecov on: push: - branches: [ master ] + branches: + - master + tags: + - 'v[0-9]+\.*' pull_request: - branches: [ master ] + branches: + - master + - develop + - 'v[0-9]+.[0-9]+' env: CARGO_TERM_COLOR: always @@ -13,39 +19,22 @@ jobs: codecov: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 - - name: Set up toolchain - uses: actions-rs/toolchain@v1 + - uses: actions/checkout@v4 + - uses: dtolnay/rust-toolchain@nightly with: - profile: minimal - toolchain: stable - override: true - components: rustfmt, llvm-tools-preview - - name: Build - uses: actions-rs/cargo@v1 + components: llvm-tools-preview + - uses: taiki-e/install-action@cargo-llvm-cov + - uses: taiki-e/install-action@nextest + - name: Collect coverage data (including doctests) + run: | + cargo +nightly llvm-cov --no-report nextest --workspace --all-features + cargo +nightly llvm-cov --no-report --doc --workspace --all-features + cargo +nightly llvm-cov report --doctests --lcov --output-path lcov.info + - name: Upload coverage data to codecov + uses: codecov/codecov-action@v4 with: - command: build - args: --release - env: - CARGO_INCREMENTAL: "0" - RUSTFLAGS: "-Cinstrument-coverage" - RUSTDOCFLAGS: "-Cinstrument-coverage" - - name: Test - uses: actions-rs/cargo@v1 - with: - command: test - args: --all-features --no-fail-fast - env: - CARGO_INCREMENTAL: "0" - RUSTFLAGS: "-Cinstrument-coverage" - RUSTDOCFLAGS: "-Cinstrument-coverage" - - name: Install grcov - run: if [[ ! -e ~/.cargo/bin/grcov ]]; then cargo install grcov; fi - - name: Generate coverage - run: grcov . --binary-path target/debug/deps/ -s . -t lcov --branch --ignore-not-existing --ignore '../**' --ignore '/*' -o coverage.lcov - - name: Upload coverage to Codecov - uses: codecov/codecov-action@v3 - with: - files: ./coverage.lcov flags: rust + files: lcov.info fail_ci_if_error: true + token: ${{ secrets.CODECOV_TOKEN }} + verbose: true diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 3f51bde..7770e2b 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -2,9 +2,15 @@ name: Lints on: push: - branches: [ master ] + branches: + - master + tags: + - 'v[0-9]+\.*' pull_request: - branches: [ master ] + branches: + - master + - develop + - 'v[0-9]+.[0-9]+' env: CARGO_TERM_COLOR: always @@ -13,45 +19,27 @@ jobs: fmt: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 - - name: Install rustc nightly - uses: actions-rs/toolchain@v1 + - uses: actions/checkout@v4 + - uses: dtolnay/rust-toolchain@nightly with: - toolchain: nightly - override: true components: rustfmt - - uses: actions-rs/cargo@v1 - name: Formatting - with: - command: fmt - args: --all -- --check + - name: Formatting + run: cargo +nightly fmt --all -- --check clippy: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 - - name: Install rustc stable - uses: actions-rs/toolchain@v1 + - uses: actions/checkout@v4 + - uses: dtolnay/rust-toolchain@stable with: - toolchain: stable - override: true components: clippy - - uses: actions-rs/cargo@v1 - name: Clippy - with: - command: clippy - args: --workspace --all-features --all-targets -- -D warnings + - name: Formatting + run: cargo clippy --workspace --all-features --all-targets -- -D warnings doc: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 - - name: Install rustc nightly - uses: actions-rs/toolchain@v1 + - uses: actions/checkout@v4 + - uses: dtolnay/rust-toolchain@nightly with: - toolchain: nightly - override: true components: rust-docs - - uses: actions-rs/cargo@v1 - name: Doc - with: - command: doc - args: --workspace --all-features + - name: Formatting + run: cargo +nightly doc --workspace --all-features diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 1de8a16..8e1d274 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -2,28 +2,31 @@ name: Tests on: push: - branches: [ master ] + branches: + - master + tags: + - 'v[0-9]+\.*' pull_request: - branches: [ master ] + branches: + - master + - develop + - 'v[0-9]+.[0-9]+' env: CARGO_TERM_COLOR: always jobs: testing: - runs-on: ubuntu-latest + runs-on: ${{ matrix.os }} + strategy: + fail-fast: false + matrix: + os: [ ubuntu-latest, macos-13, macos-latest, windows-latest ] steps: - - uses: actions/checkout@v2 - - name: Install latest stable - uses: actions-rs/toolchain@v1 - with: - toolchain: stable - override: true - - name: Build & test - uses: actions-rs/cargo@v1 - with: - command: test - args: --workspace --all-features --no-fail-fast + - uses: actions/checkout@v4 + - uses: dtolnay/rust-toolchain@stable + - name: Test ${{matrix.os}} + run: cargo test --workspace --all-features --no-fail-fast wasm-testing: runs-on: ubuntu-latest steps: