From 1903d97469dd32875ad3ac2b96da1090c2897ed5 Mon Sep 17 00:00:00 2001 From: Michael Martin Date: Thu, 9 Jan 2025 23:06:15 -0800 Subject: [PATCH] chore(build): rename rust target wasm32-wasi to wasm32-wasip1 (#13708) --- .../build-wasm-test-filters/action.yml | 24 +++++++++++++------ scripts/build-wasm-test-filters.sh | 2 +- 2 files changed, 18 insertions(+), 8 deletions(-) diff --git a/.github/actions/build-wasm-test-filters/action.yml b/.github/actions/build-wasm-test-filters/action.yml index f4e4cd848246..420eb193d209 100644 --- a/.github/actions/build-wasm-test-filters/action.yml +++ b/.github/actions/build-wasm-test-filters/action.yml @@ -14,7 +14,17 @@ runs: echo "WASM_FILTER_PATH=$WASM_FILTER_PATH" >> $GITHUB_ENV echo "WASM_FIXTURE_PATH=$WASM_FILTER_PATH/build" >> $GITHUB_ENV echo "WASM_FILTER_CARGO_LOCK=$WASM_FILTER_PATH/Cargo.lock" >> $GITHUB_ENV - echo "WASM_FILTER_CACHE_PREFIX=wasm-test-filters::v3::${{ runner.os }}" >> $GITHUB_ENV + echo "WASM_FILTER_TARGET=wasm32-wasip1" >> "$GITHUB_ENV" + + - name: Setup cache key + shell: bash + env: + FILE_HASH: "${{ hashFiles(env.WASM_FILTER_CARGO_LOCK, format('{0}/**/*.rs', env.WASM_FILTER_PATH)) }}" + CACHE_VERSION: "4" + run: | + CACHE_PREFIX="wasm-test-filters::v${CACHE_VERSION}::${{ runner.os }}::${WASM_FILTER_TARGET}" + echo "CACHE_PREFIX=${CACHE_PREFIX}" >> $GITHUB_ENV + echo "CACHE_KEY=${CACHE_PREFIX}::${FILE_HASH}" >> $GITHUB_ENV - name: Restore Cache uses: actions/cache/restore@v4 @@ -26,8 +36,8 @@ runs: ~/.cargo/registry/cache/ ~/.cargo/git/db/ ${{ env.WASM_FILTER_PATH }}/target - key: ${{ env.WASM_FILTER_CACHE_PREFIX }}::${{ hashFiles(env.WASM_FILTER_CARGO_LOCK, format('{0}/**/*.rs', env.WASM_FILTER_PATH)) }} - restore-keys: ${{ env.WASM_FILTER_CACHE_PREFIX }} + key: ${{ env.CACHE_KEY }} + restore-keys: ${{ env.CACHE_PREFIX }} - name: Install Rust Toolchain if: steps.restore-cache.outputs.cache-hit != 'true' @@ -37,7 +47,7 @@ runs: toolchain: stable override: true components: cargo - target: wasm32-wasi + target: ${{ env.WASM_FILTER_TARGET }} - name: cargo build if: steps.restore-cache.outputs.cache-hit != 'true' @@ -50,7 +60,7 @@ runs: --manifest-path "${{ env.WASM_FILTER_PATH }}/Cargo.toml" --workspace --lib - --target wasm32-wasi + --target "${{ env.WASM_FILTER_TARGET }}" --release - name: Save cache @@ -64,14 +74,14 @@ runs: ~/.cargo/registry/cache/ ~/.cargo/git/db/ ${{ env.WASM_FILTER_PATH }}/target - key: ${{ env.WASM_FILTER_CACHE_PREFIX }}::${{ hashFiles(env.WASM_FILTER_CARGO_LOCK, format('{0}/**/*.rs', env.WASM_FILTER_PATH)) }} + key: ${{ env.CACHE_KEY }} - name: Create a symlink to the target directory shell: bash run: | ln -sfv \ --no-target-directory \ - "${{ env.WASM_FILTER_PATH }}"/target/wasm32-wasi/release \ + "${{ env.WASM_FILTER_PATH }}"/target/"${{ env.WASM_FILTER_TARGET }}"/release \ "${{ env.WASM_FIXTURE_PATH }}" - name: debug diff --git a/scripts/build-wasm-test-filters.sh b/scripts/build-wasm-test-filters.sh index 504a4ed0240f..22a2aa5560b0 100755 --- a/scripts/build-wasm-test-filters.sh +++ b/scripts/build-wasm-test-filters.sh @@ -19,7 +19,7 @@ set -euo pipefail -readonly BUILD_TARGET=wasm32-wasi +readonly BUILD_TARGET=wasm32-wasip1 readonly FIXTURE_PATH=${PWD}/spec/fixtures/proxy_wasm_filters readonly INSTALL_ROOT=${PWD}/bazel-bin/build/${BUILD_NAME:-kong-dev}