Skip to content

Commit

Permalink
fix dep; improve deploy
Browse files Browse the repository at this point in the history
  • Loading branch information
swfsql committed Feb 29, 2024
1 parent c13aef7 commit 864ab5c
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 19 deletions.
22 changes: 9 additions & 13 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,35 +19,31 @@ jobs:
# permissions:
# contents: write
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4

# rust compiler for creating binaries
- name: Install latest nightly (for wasm)
uses: actions-rs/toolchain@v1
uses: dtolnay/rust-toolchain@nightly
with:
toolchain: nightly
target: wasm32-unknown-unknown
targets: wasm32-unknown-unknown
components: rustfmt, clippy
override: true

- name: Install wasm target
- name: Install Wasm Target
run: |
set -e
rustup target add wasm32-unknown-unknown
# Runs some Rust-related caching
- uses: Swatinem/rust-cache@v2

- name: Install wasm-pack
uses: actions-rs/cargo@v1
with:
command: install
args: --target-dir ./target/wasm/ wasm-pack

- name: Download wasm-pack
run: curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf | sh

# wasm-pack build --release also optimizes the wasm binary
- name: Build Release wasm
run: wasm-pack build --release --target web --no-default-features --features "wasm_yew_ui"

- name: Prepare Wasm deploy
- name: Prepare Wasm Deploy
run: |
set -e
# Prepare the publishing structure
Expand Down
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 2 additions & 5 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -42,21 +42,18 @@ tokenizers = { version = "0.13.4", default-features = false, features = [
"unstable_wasm",
] }

# Note: requires esaxx-rs which requires clang

# non-wasm target

[target.'cfg(not(target_arch = "wasm32"))'.dependencies.hf-hub]
version = "0.3.2"
# path = "../hf-hub"
git = "https://github.com/swfsql/hf-hub.git"
rev = "8c3865841d8ce0b3538972a17c05aa0301283a8d"
rev = "fcaade15a9a844c4cde1145d1f40388ae2be998f"
default-features = false
features = ["online"]

# wasm target

# TODO: some dependencies are optional (ui-related ones)
[target.'cfg(target_arch = "wasm32")'.dependencies]
console_error_panic_hook = "0.1.6"
reqwest = { version = "0.11.23", features = ["json"] }
Expand All @@ -74,6 +71,6 @@ yew = { version = "0.21.0", features = ["csr"] }
version = "0.3.2"
# path = "../hf-hub"
git = "https://github.com/swfsql/hf-hub.git"
rev = "8c3865841d8ce0b3538972a17c05aa0301283a8d"
rev = "fcaade15a9a844c4cde1145d1f40388ae2be998f"
default-features = false
features = ["wasm"]

0 comments on commit 864ab5c

Please sign in to comment.