Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,7 @@
/Cargo.toml text eol=lf
/Cargo.lock text eol=lf
/crates/core/build.rs text eol=lf
/crates/core/build/** text=auto eol=lf
/crates/core/wit/** text=auto eol=lf
/crates/runtime/** text=auto eol=lf
/xtask/** text=auto eol=lf
11 changes: 2 additions & 9 deletions .github/actions/setup-runtime-cache/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,10 @@ runs:
uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
with:
path: crates/core/prebuilt
key: runtime-wasm-v3-${{ hashFiles('Cargo.toml', 'Cargo.lock', 'crates/runtime/**', 'crates/core/build.rs') }}
key: runtime-wasm-v4-${{ hashFiles('Cargo.toml', 'Cargo.lock', 'crates/runtime/**', 'crates/core/build.rs', 'crates/core/build/**', 'crates/core/wit/**', 'xtask/**') }}
enableCrossOsArchive: true

- name: Build runtime wasm
if: steps.cache.outputs.cache-hit != 'true'
shell: bash
run: |
cargo build --locked -p componentize-qjs
mkdir -p crates/core/prebuilt
for f in runtime.wasm runtime-opt-size.wasm runtime-sync.wasm runtime-opt-size-sync.wasm; do
src=$(find target -path "*/out/$f" -type f | sort | tail -n 1)
test -n "$src" || { echo "ERROR: built runtime $f not found"; exit 1; }
cp "$src" "crates/core/prebuilt/$f"
done
run: cargo run --locked -p xtask -- --output crates/core/prebuilt
9 changes: 5 additions & 4 deletions .github/scripts/prepare-runtime-artifacts.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,18 @@ target_dir="$1"
destination_dir="$2"
shift 2

rm -rf crates/core/prebuilt "$destination_dir" "$target_dir"
COMPONENTIZE_QJS_RUNTIME_AUDITABLE=1 cargo build --release -p componentize-qjs --target-dir "$target_dir"
artifact_dir="$target_dir/runtime"
cargo run --locked -p xtask -- --release --auditable \
--output "$artifact_dir" --build-dir "$target_dir/build"
mkdir -p "$destination_dir"

for mapping in "$@"; do
source_name="${mapping%%=*}"
destination_name="${mapping#*=}"
source_path=$(find "$target_dir" -path "*/out/$source_name" -type f | sort | tail -n 1)
source_path="$artifact_dir/$source_name"
destination_path="$destination_dir/$destination_name"

test -n "$source_path" || { echo "ERROR: $source_name not found"; exit 1; }
test -f "$source_path" || { echo "ERROR: $source_name not found"; exit 1; }
cp "$source_path" "$destination_path"
test -f "$destination_path" || { echo "ERROR: $destination_name not created"; exit 1; }

Expand Down
11 changes: 9 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,13 @@ jobs:
uses: ./.github/actions/setup-runtime-cache

- name: Check formatting
run: cargo fmt --check
run: cargo fmt --all --check

- name: Clippy
run: cargo clippy --all-features -- -D warnings
run: cargo clippy --workspace --all-features -- -D warnings

- name: Runtime and build-tool unit tests
run: cargo test --locked -p componentize-qjs-runtime -p xtask

build-test:
name: Build and test (${{ matrix.os }})
Expand Down Expand Up @@ -78,6 +81,10 @@ jobs:
- name: Setup runtime wasm cache
uses: ./.github/actions/setup-runtime-cache

- name: Build Windows runtime from source
if: runner.os == 'Windows'
run: cargo run --locked -p xtask -- --sync-only --output target/runtime-source-check

- name: Run tests
run: cargo test -p componentize-qjs-cli

Expand Down
13 changes: 13 additions & 0 deletions Cargo.lock

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

6 changes: 5 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[workspace]
members = ["crates/core", "crates/runtime", "napi"]
members = ["crates/core", "crates/runtime", "napi", "xtask"]
default-members = [".", "napi"]
resolver = "2"

Expand All @@ -16,6 +16,10 @@ componentize-qjs = { path = "crates/core", version = "0.4.5", default-features =
componentize-qjs-cli = { path = ".", version = "0.4.5", default-features = false }
anyhow = "1.0"
clap = { version = "4", features = ["derive"] }
flate2 = "1.1"
glob = "0.3"
tar = "0.4"
ureq = "3"
tokio = { version = "1", default-features = false, features = ["rt", "macros"] }
wasmtime = { version = "47", features = ["component-model", "async"] }
wasmtime-wasi = { version = "47", default-features = false, features = ["p2", "p3"] }
Expand Down
9 changes: 5 additions & 4 deletions crates/core/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ include = [
"src/**/*",
"wit/**/*",
"build.rs",
"build/**/*",
"../../README.md",
"prebuilt/runtime.wasm",
"prebuilt/runtime.wasm.cdx.json",
Expand Down Expand Up @@ -49,10 +50,10 @@ tempfile = "3"

[build-dependencies]
anyhow.workspace = true
flate2 = "1.1"
glob = "0.3"
tar = "0.4"
ureq = "3"
flate2.workspace = true
glob.workspace = true
tar.workspace = true
ureq.workspace = true

[features]
default = ["component-model-async"]
Expand Down
Loading
Loading