Skip to content

Commit 0f338ec

Browse files
authored
Merge pull request #140 from superfaceai/chore/revive
Revive
2 parents d08d0c7 + b6e02d5 commit 0f338ec

File tree

7 files changed

+36
-24
lines changed

7 files changed

+36
-24
lines changed

.github/actions/build_core/action.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,19 +5,19 @@ inputs:
55
CARGO_PROFILE:
66
description: "Cargo profile name to use for cargo cache key"
77
required: false
8-
default: 'release'
8+
default: "release"
99
CORE_WASM:
1010
description: "Whether to build core.wasm and core-async.wasm, oneOf `none, build, upload`"
1111
required: false
12-
default: 'none'
12+
default: "none"
1313
TEST_CORE_WASM:
1414
description: "Whether to build test-core.wasm and test-core-async.wasm, oneOf `none, build, upload`"
1515
required: false
16-
default: 'none'
16+
default: "none"
1717
COMLINK_WASM:
1818
description: "Whether to build comlink.wasm, oneOf `none, build, upload`"
1919
required: false
20-
default: 'none'
20+
default: "none"
2121

2222
runs:
2323
using: "composite"
@@ -52,7 +52,7 @@ runs:
5252
sudo apt-get install binaryen
5353
- name: Install rust target
5454
shell: bash
55-
run: rustup target add wasm32-wasi
55+
run: rustup target add wasm32-wasip1
5656
# build and store core.wasm, core-async.wasm
5757
- name: Run make to build core.wasm
5858
if: ${{ inputs.CORE_WASM != 'none' }}

Makefile

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -75,21 +75,21 @@ git_hooks:
7575
## CORE ##
7676
##########
7777
deps_core: ${WASI_SDK_FOLDER}
78-
rustup target add wasm32-wasi
78+
rustup target add wasm32-wasip1
7979
curl https://wasmtime.dev/install.sh -sSf | bash
8080

8181
${CORE_DIST}: ${WASI_SDK_FOLDER} ${CORE_JS_ASSETS_MAP_STD} ${CORE_JS_ASSETS_PROFILE_VALIDATOR} ${CORE_SCHEMA_ASSETS_SECURITY_VALUES} ${CORE_SCHEMA_ASSETS_PARAMETERS_VALUES}
8282
mkdir -p ${CORE_DIST}
8383
touch ${CORE_DIST}
8484

8585
${CORE_WASM}: ${CORE_DIST}
86-
cd core; cargo build --package oneclient_core --target wasm32-wasi ${CARGO_FLAGS}
86+
cd core; cargo build --package oneclient_core --target wasm32-wasip1 ${CARGO_FLAGS}
8787
@echo 'Optimizing wasm...'
88-
wasm-opt -Oz ${WASM_OPT_FLAGS} core/target/wasm32-wasi/${CARGO_PROFILE}/oneclient_core.wasm --output ${CORE_WASM}
88+
wasm-opt -Oz ${WASM_OPT_FLAGS} core/target/wasm32-wasip1/${CARGO_PROFILE}/oneclient_core.wasm --output ${CORE_WASM}
8989

9090
${TEST_CORE_WASM}: ${CORE_DIST}
91-
cd core; cargo build --package oneclient_core --target wasm32-wasi --features "core_mock" ${CARGO_FLAGS}
92-
cp core/target/wasm32-wasi/${CARGO_PROFILE}/oneclient_core.wasm ${TEST_CORE_WASM}
91+
cd core; cargo build --package oneclient_core --target wasm32-wasip1 --features "core_mock" ${CARGO_FLAGS}
92+
cp core/target/wasm32-wasip1/${CARGO_PROFILE}/oneclient_core.wasm ${TEST_CORE_WASM}
9393

9494
${CORE_ASYNCIFY_WASM}: ${CORE_WASM}
9595
@echo 'Running asyncify...'
@@ -100,18 +100,18 @@ ${TEST_CORE_ASYNCIFY_WASM}: ${TEST_CORE_WASM}
100100

101101
${CORE_COMLINK_WASM}:
102102
mkdir -p ${CORE_DIST}
103-
cd core; cargo build --package comlink_wasm --target wasm32-wasi ${CARGO_FLAGS}
104-
wasm-opt -Os ${WASM_OPT_FLAGS} core/target/wasm32-wasi/${CARGO_PROFILE}/comlink_wasm.wasm --output ${CORE_COMLINK_WASM}
103+
cd core; cargo build --package comlink_wasm --target wasm32-wasip1 ${CARGO_FLAGS}
104+
wasm-opt -Oz ${WASM_OPT_FLAGS} core/target/wasm32-wasip1/${CARGO_PROFILE}/comlink_wasm.wasm --output ${CORE_COMLINK_WASM}
105105

106106
${WASI_SDK_FOLDER}:
107107
wget -qO - ${WASI_SDK_URL} | tar xzvf - -C core
108108

109109
test_core: ${WASI_SDK_FOLDER} ${CORE_JS_ASSETS_MAP_STD} ${CORE_JS_ASSETS_PROFILE_VALIDATOR} ${CORE_SCHEMA_ASSETS_SECURITY_VALUES} ${CORE_SCHEMA_ASSETS_PARAMETERS_VALUES}
110-
cd core && cargo test -- --nocapture
110+
cd core && cargo test
111111

112112
build_core: ${CORE_WASM} ${TEST_CORE_WASM} ${CORE_ASYNCIFY_WASM} ${TEST_CORE_ASYNCIFY_WASM}
113113
build_core_json_schemas:
114-
cd core/json_schemas && cargo build && wasmtime run --dir=. ../target/wasm32-wasi/debug/json_schemas.wasm
114+
cd core/json_schemas && cargo build && wasmtime run --dir=. ../target/wasm32-wasip1/debug/json_schemas.wasm
115115

116116
${CORE_JS_ASSETS_MAP_STD}: ${MAP_STD}
117117
mkdir -p ${CORE_JS_ASSETS}

core/.cargo/config.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ QUICKJS_WASM_SYS_WASI_SDK_PATH = { value = "wasi-sdk-20.0", relative = true }
33
WASMTIME_NEW_CLI = "1"
44

55
[build]
6-
target = "wasm32-wasi"
6+
target = "wasm32-wasip1"
77

8-
[target.wasm32-wasi]
8+
[target.wasm32-wasip1]
99
runner = "wasmtime"

core/Cargo.lock

Lines changed: 12 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

core/Cargo.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,9 @@ thiserror = { version = "1" }
1515
url = { version = "2" }
1616
tracing = { version = "0.1" }
1717

18+
[profile.dev]
19+
opt-level = 1 #
20+
1821
[profile.release]
1922
opt-level = "s"
2023
lto = true

core/core/src/sf_core/cache.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ pub enum ProfileCacheEntryError {
2020
}
2121
#[derive(Debug)]
2222
pub struct ProfileCacheEntry {
23+
#[allow(dead_code)]
2324
pub profile: String, // TODO: parsed so we can extract the version
2425
pub content_hash: String,
2526
}

scripts/build-a-core/template.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,9 @@ def dockerfile_template(
1616
cargo_profile = cargo_profile.replace("\n", "\\n").replace('"', '\\"')
1717

1818
if wasm_opt_flags != "":
19-
post_process = f"{OPT_BINARYEN}/bin/wasm-opt {wasm_opt_flags} {CARGO_TARGET_DIR}/wasm32-wasi/build-a-core/oneclient_core.wasm --output /opt/build-a-core/core.wasm"
19+
post_process = f"{OPT_BINARYEN}/bin/wasm-opt {wasm_opt_flags} {CARGO_TARGET_DIR}/wasm32-wasip1/build-a-core/oneclient_core.wasm --output /opt/build-a-core/core.wasm"
2020
else:
21-
post_process = f"cp {CARGO_TARGET_DIR}/wasm32-wasi/build-a-core/oneclient_core.wasm /opt/build-a-core/core.wasm"
21+
post_process = f"cp {CARGO_TARGET_DIR}/wasm32-wasip1/build-a-core/oneclient_core.wasm /opt/build-a-core/core.wasm"
2222

2323
return f"""
2424
FROM debian:bookworm as wasi-sdk-builder
@@ -68,7 +68,7 @@ def dockerfile_template(
6868
apt clean
6969
rm -rf /var/lib/apt/lists/*
7070
EOF
71-
RUN rustup default {toolchain_version} && rustup component add rust-src && rustup target add wasm32-wasi
71+
RUN rustup default {toolchain_version} && rustup component add rust-src && rustup target add wasm32-wasip1
7272
7373
WORKDIR /opt/build-a-core
7474
RUN git clone https://github.com/superfaceai/one-sdk.git . && git checkout {core_ref}
@@ -97,7 +97,7 @@ def dockerfile_template(
9797
ENV CARGO_HOME=/var/cache/cargo
9898
ENV CARGO_TARGET_DIR={CARGO_TARGET_DIR}
9999
RUN echo "{cargo_profile}" >>Cargo.toml
100-
RUN --mount=type=cache,target=/var/cache/cargo cargo build --target wasm32-wasi --package oneclient_core --profile build-a-core {build_std_flags}
100+
RUN --mount=type=cache,target=/var/cache/cargo cargo build --target wasm32-wasip1 --package oneclient_core --profile build-a-core {build_std_flags}
101101
102102
COPY --from=binaryen-builder /opt/binaryen/bin {OPT_BINARYEN}/bin
103103
COPY --from=binaryen-builder /opt/binaryen/lib {OPT_BINARYEN}/lib

0 commit comments

Comments
 (0)