From 3da8fd4dee25c49c522b623274dc460c70997781 Mon Sep 17 00:00:00 2001 From: Yoshiya Hinosawa Date: Mon, 24 Apr 2023 14:32:08 +0900 Subject: [PATCH 1/2] chore(ci): test release build --- .github/workflows/ci.yml | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index d83d52a..313dc82 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -30,8 +30,15 @@ jobs: components: rustfmt, clippy - name: Build run: cargo build --locked --release - - name: Build Example + - name: Build Example (debug) + working-directory: ./example run: | - cd example deno run -A ../cli.ts - deno test --no-check -A --unstable + deno test -A --unstable + - name: Build Example (release) + working-directory: ./example + shell: bash + run: | + rm -rf target + deno run -A ../cli.ts --release=../target/release + deno test -A --unstable From e545952ed658cd5b53055cb05d7dcf7d54b9288e Mon Sep 17 00:00:00 2001 From: Yoshiya Hinosawa Date: Mon, 24 Apr 2023 14:39:38 +0900 Subject: [PATCH 2/2] fix: release url --- codegen.ts | 15 +++------------ example/bindings/bindings.ts | 16 +++------------- 2 files changed, 6 insertions(+), 25 deletions(-) diff --git a/codegen.ts b/codegen.ts index 20314f8..3ab9dd8 100644 --- a/codegen.ts +++ b/codegen.ts @@ -166,23 +166,14 @@ import { dlopen, FetchOptions } from "https://deno.land/x/plug@1.0.1/mod.ts"; let uri = url.toString(); if (!uri.endsWith("/")) uri += "/"; -let darwin: string | { aarch64: string; x86_64: string } = uri + "lib${name}.dylib"; - -if (url.protocol !== "file:") { - // Assume that remote assets follow naming scheme - // for each macOS artifact. - darwin = { - aarch64: uri + "lib${name}_arm64.dylib", - x86_64: uri + "lib${name}.dylib", - } -} +let darwin: string | { aarch64: string; x86_64: string } = uri; const opts: FetchOptions = { name: "${name}", url: { darwin, - windows: uri + "${name}.dll", - linux: uri + "lib${name}.so", + windows: uri, + linux: uri, }, cache: ${!!options?.release ? '"use"' : '"reloadAll"'}, }; diff --git a/example/bindings/bindings.ts b/example/bindings/bindings.ts index 2c40786..1196b53 100644 --- a/example/bindings/bindings.ts +++ b/example/bindings/bindings.ts @@ -19,30 +19,20 @@ function readPointer(v: any): Uint8Array { return buf } -const url = new URL("../target/debug", import.meta.url) +const url = new URL("../target/release", import.meta.url) import { dlopen, FetchOptions } from "https://deno.land/x/plug@1.0.1/mod.ts" let uri = url.toString() if (!uri.endsWith("/")) uri += "/" let darwin: string | { aarch64: string; x86_64: string } = uri - + "libdeno_bindgen_test.dylib" - -if (url.protocol !== "file:") { - // Assume that remote assets follow naming scheme - // for each macOS artifact. - darwin = { - aarch64: uri + "libdeno_bindgen_test_arm64.dylib", - x86_64: uri + "libdeno_bindgen_test.dylib", - } -} const opts: FetchOptions = { name: "deno_bindgen_test", url: { darwin, - windows: uri + "deno_bindgen_test.dll", - linux: uri + "libdeno_bindgen_test.so", + windows: uri, + linux: uri, }, cache: "use", }