From 2eba10bb314c56a81d797e636b46c80c333312fa Mon Sep 17 00:00:00 2001 From: BartolomeoDiaz Date: Sat, 28 Dec 2024 13:31:11 +0100 Subject: [PATCH] v0.1.3 (#62) * version bump * toolchain defs improved * npm ci * fixed cargo lock for wasm * ci fix --- .github/workflows/npm_publish.yaml | 75 ++++++++++---------- wasm_bindings/Cargo.lock | 106 +---------------------------- 2 files changed, 37 insertions(+), 144 deletions(-) diff --git a/.github/workflows/npm_publish.yaml b/.github/workflows/npm_publish.yaml index 013b523..a2d388d 100644 --- a/.github/workflows/npm_publish.yaml +++ b/.github/workflows/npm_publish.yaml @@ -2,6 +2,11 @@ name: Manual Publish to npm on: workflow_dispatch: + inputs: + dry_run: + description: "Run npm publish as a dry run (true) or publish directly (false)" + required: true + default: true jobs: publish: @@ -9,33 +14,9 @@ jobs: env: WORKING_DIR: ${{ github.workspace }}/wasm_bindings - - strategy: - fail-fast: false - matrix: - layout: - [ - "dex", - "dynamic", - "recursive", - "recursive_with_poseidon", - "small", - "starknet", - "starknet_with_keccak", - ] - hash: - [ - "keccak_160_lsb", - "keccak_248_lsb", - "blake2s_160_lsb", - "blake2s_248_lsb", - ] - stone: - [ - "stone5", - "stone6", - ] - + LAYOUTS: "dex dynamic recursive recursive_with_poseidon small starknet starknet_with_keccak" + HASHERS: "keccak_160_lsb keccak_248_lsb blake2s_160_lsb blake2s_248_lsb" + STONES: "stone5 stone6" steps: - name: Checkout repository @@ -45,7 +26,7 @@ jobs: uses: actions/setup-node@v3 with: node-version: "18" - + - name: Setup Rust toolchain uses: actions-rust-lang/setup-rust-toolchain@v1 @@ -74,17 +55,33 @@ jobs: - name: Install wasm-pack run: cargo install wasm-pack - - name: Build package - run: wasm-pack build --out-dir pkg --target web --features ${{ matrix.layout }},${{ matrix.hash }},${{ matrix.stone }} --no-default-features + - name: Build WASM packages + run: | + for layout in $LAYOUTS; do + for hasher in $HASHERS; do + for stone in $STONES; do + output_dir="src/pkg/swiftness_${layout}_${hasher}_${stone}" + features="${layout},${hasher},${stone}" + + echo "Building WASM package with layout=$layout, hasher=$hasher, stone=$stone" + + wasm-pack build --out-dir "$output_dir" --target web --features "$features" --no-default-features + + # Clean up unnecessary files + rm -f "$output_dir/.gitignore" + rm -f "$output_dir/README.md" + done + done + done working-directory: ${{ env.WORKING_DIR }} - - name: Rename package + - name: Publish to npm (dry run or actual) run: | - jq --arg layout "${{ matrix.layout }}" --arg hash "${{ matrix.hash }}" --arg stone "${{ matrix.stone }}" \ - '.name = "swiftness-\($layout | gsub("_"; "-"))-\($hash | gsub("_"; "-"))-\($stone | gsub("_"; "-"))"' \ - package.json > tmp.json && mv tmp.json package.json - working-directory: ${{ env.WORKING_DIR }}/pkg - - - name: Publish to npm - run: npm publish - working-directory: ${{ env.WORKING_DIR }}/pkg + if [ "${{ github.event.inputs.dry_run }}" = "true" ]; then + echo "Running npm publish in dry run mode" + npm publish --dry-run + else + echo "Publishing to npm" + npm publish + fi + working-directory: ${{ env.WORKING_DIR }} diff --git a/wasm_bindings/Cargo.lock b/wasm_bindings/Cargo.lock index 10d54c5..3cce567 100644 --- a/wasm_bindings/Cargo.lock +++ b/wasm_bindings/Cargo.lock @@ -1,6 +1,6 @@ # This file is automatically @generated by Cargo. # It is not intended for manual editing. -version = 3 +version = 4 [[package]] name = "adler2" @@ -68,15 +68,9 @@ dependencies = [ [[package]] name = "anyhow" -<<<<<<< HEAD version = "1.0.95" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "34ac096ce696dc2fcabef30516bb13c0a68a11d30131d3df6f04711467681b04" -======= -version = "1.0.94" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c1fd03a028ef38ba2276dce7e33fcd6369c158a1bca17946c4b1b701891c1ff7" ->>>>>>> main [[package]] name = "autocfg" @@ -167,11 +161,7 @@ dependencies = [ "heck", "proc-macro2", "quote", -<<<<<<< HEAD "syn 2.0.92", -======= - "syn 2.0.90", ->>>>>>> main ] [[package]] @@ -246,11 +236,7 @@ dependencies = [ "proc-macro2", "quote", "strsim", -<<<<<<< HEAD "syn 2.0.92", -======= - "syn 2.0.90", ->>>>>>> main ] [[package]] @@ -261,11 +247,7 @@ checksum = "d336a2a514f6ccccaa3e09b02d41d35330c07ddf03a62165fcec10bb561c7806" dependencies = [ "darling_core", "quote", -<<<<<<< HEAD "syn 2.0.92", -======= - "syn 2.0.90", ->>>>>>> main ] [[package]] @@ -492,15 +474,9 @@ dependencies = [ [[package]] name = "quote" -<<<<<<< HEAD version = "1.0.38" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0e4dccaaaf89514f546c693ddc140f729f958c247918a13380cccc6078391acc" -======= -version = "1.0.37" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b5b9d34b8991d19d98081b46eacdd8eb58c6f2b201139f7c5f643cc155a633af" ->>>>>>> main dependencies = [ "proc-macro2", ] @@ -552,22 +528,15 @@ checksum = "f3cb5ba0dc43242ce17de99c180e96db90b235b8a9fdc9543c96d2209116bd9f" [[package]] name = "serde" -<<<<<<< HEAD version = "1.0.217" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "02fc4265df13d6fa1d00ecff087228cc0a2b5f3c0e87e258d8b94a156e984c70" -======= -version = "1.0.216" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0b9781016e935a97e8beecf0c933758c97a5520d32930e460142b4cd80c6338e" ->>>>>>> main dependencies = [ "serde_derive", ] [[package]] name = "serde_derive" -<<<<<<< HEAD version = "1.0.217" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5a9bf7cf98d04a2b28aead066b7496853d4779c9cc183c440dbac457641e19a0" @@ -575,28 +544,13 @@ dependencies = [ "proc-macro2", "quote", "syn 2.0.92", -======= -version = "1.0.216" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "46f859dbbf73865c6627ed570e78961cd3ac92407a2d117204c49232485da55e" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.90", ->>>>>>> main ] [[package]] name = "serde_json" -<<<<<<< HEAD version = "1.0.134" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d00f4175c42ee48b15416f6193a959ba3a0d67fc699a0db9ad12df9f83991c7d" -======= -version = "1.0.133" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c7fceb2473b9166b2294ef05efcb65a3db80803f0b03ef86a5fc88a2b85ee377" ->>>>>>> main dependencies = [ "itoa", "memchr", @@ -632,7 +586,6 @@ dependencies = [ [[package]] name = "serde_with" -<<<<<<< HEAD version = "3.12.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d6b6f7f2fcb69f747921f79f3926bd1e203fce4fef62c268dd3abfb6d86029aa" @@ -640,15 +593,6 @@ dependencies = [ "serde", "serde_derive", "serde_with_macros 3.12.0", -======= -version = "3.11.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8e28bdad6db2b8340e449f7108f020b3b092e8583a9e3fb82713e1d4e71fe817" -dependencies = [ - "serde", - "serde_derive", - "serde_with_macros 3.11.0", ->>>>>>> main ] [[package]] @@ -660,33 +604,19 @@ dependencies = [ "darling", "proc-macro2", "quote", -<<<<<<< HEAD "syn 2.0.92", -======= - "syn 2.0.90", ->>>>>>> main ] [[package]] name = "serde_with_macros" -<<<<<<< HEAD version = "3.12.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8d00caa5193a3c8362ac2b73be6b9e768aa5a4b2f721d8f4b339600c3cb51f8e" -======= -version = "3.11.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9d846214a9854ef724f3da161b426242d8de7c1fc7de2f89bb1efcb154dca79d" ->>>>>>> main dependencies = [ "darling", "proc-macro2", "quote", -<<<<<<< HEAD "syn 2.0.92", -======= - "syn 2.0.90", ->>>>>>> main ] [[package]] @@ -802,11 +732,7 @@ version = "0.1.3" dependencies = [ "num-bigint", "serde", -<<<<<<< HEAD "serde_with 3.12.0", -======= - "serde_with 3.11.0", ->>>>>>> main "starknet-core", "starknet-crypto", "starknet-types-core", @@ -823,11 +749,7 @@ dependencies = [ "blake2", "num-bigint", "serde", -<<<<<<< HEAD "serde_with 3.12.0", -======= - "serde_with 3.11.0", ->>>>>>> main "sha3", "starknet-core", "starknet-crypto", @@ -843,11 +765,7 @@ version = "0.1.3" dependencies = [ "num-bigint", "serde", -<<<<<<< HEAD "serde_with 3.12.0", -======= - "serde_with 3.11.0", ->>>>>>> main "sha3", "starknet-core", "starknet-crypto", @@ -891,11 +809,7 @@ name = "swiftness_stark" version = "0.1.3" dependencies = [ "serde", -<<<<<<< HEAD "serde_with 3.12.0", -======= - "serde_with 3.11.0", ->>>>>>> main "starknet-core", "starknet-crypto", "swiftness_air", @@ -940,15 +854,9 @@ dependencies = [ [[package]] name = "syn" -<<<<<<< HEAD version = "2.0.92" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "70ae51629bf965c5c098cc9e87908a3df5301051a9e087d6f9bef5c9771ed126" -======= -version = "2.0.90" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "919d3b74a5dd0ccd15aeb8f93e7006bd9e14c295087c9896a110f490752bcf31" ->>>>>>> main dependencies = [ "proc-macro2", "quote", @@ -972,11 +880,7 @@ checksum = "4fee6c4efc90059e10f81e6d42c60a18f76588c3d74cb83a0b242a2b6c7504c1" dependencies = [ "proc-macro2", "quote", -<<<<<<< HEAD "syn 2.0.92", -======= - "syn 2.0.90", ->>>>>>> main ] [[package]] @@ -1069,11 +973,7 @@ dependencies = [ "log", "proc-macro2", "quote", -<<<<<<< HEAD "syn 2.0.92", -======= - "syn 2.0.90", ->>>>>>> main "wasm-bindgen-shared", ] @@ -1095,11 +995,7 @@ checksum = "30d7a95b763d3c45903ed6c81f156801839e5ee968bb07e534c44df0fcd330c2" dependencies = [ "proc-macro2", "quote", -<<<<<<< HEAD "syn 2.0.92", -======= - "syn 2.0.90", ->>>>>>> main "wasm-bindgen-backend", "wasm-bindgen-shared", ]