Skip to content

Commit

Permalink
chore(ci): update build-wasm-test-filters action
Browse files Browse the repository at this point in the history
  • Loading branch information
flrgh committed Jan 27, 2025
1 parent 8e441df commit 06b8410
Showing 1 changed file with 19 additions and 32 deletions.
51 changes: 19 additions & 32 deletions .github/actions/build-wasm-test-filters/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,70 +19,57 @@ runs:
- 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"
FILE_HASH: ${{ hashFiles(env.WASM_FILTER_CARGO_LOCK, format('{0}/**/*.rs', env.WASM_FILTER_PATH)) }}
CACHE_VERSION: "5"
RUNNER_OS: ${{ runner.os }}
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
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
id: restore-cache
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
${{ env.WASM_FILTER_PATH }}/target
path: ${{ env.WASM_FILTER_PATH }}/target
key: ${{ env.CACHE_KEY }}
restore-keys: ${{ env.CACHE_PREFIX }}

- name: Install Rust Toolchain
if: steps.restore-cache.outputs.cache-hit != 'true'
uses: actions-rs/toolchain@16499b5e05bf2e26879000db0c1d13f7e13fa3af # v1
uses: dtolnay/rust-toolchain@a54c7afa936fefeb4456b2dd8068152669aa8203
with:
profile: minimal
toolchain: stable
override: true
components: cargo
target: ${{ env.WASM_FILTER_TARGET }}
targets: ${{ env.WASM_FILTER_TARGET }}

- name: cargo build
- name: Build Test Filters
if: steps.restore-cache.outputs.cache-hit != 'true'
uses: actions-rs/cargo@844f36862e911db73fe0815f00a4a2602c279505 # v1
with:
command: build
shell: bash
run: |
# building in release mode yields smaller library sizes, so it's
# better for our cacheability
args: >
--manifest-path "${{ env.WASM_FILTER_PATH }}/Cargo.toml"
cargo build \
--manifest-path "${WASM_FILTER_PATH:?}/Cargo.toml"
--workspace
--lib
--target "${{ env.WASM_FILTER_TARGET }}"
--target "${WASM_FILTER_TARGET:?}"
--release
- name: Save cache
if: steps.restore-cache.outputs.cache-hit != 'true'
id: save-cache
uses: actions/cache/save@v3
uses: actions/cache/save@v4
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
${{ env.WASM_FILTER_PATH }}/target
path: ${{ env.WASM_FILTER_PATH }}/target
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/"${{ env.WASM_FILTER_TARGET }}"/release \
"${{ env.WASM_FIXTURE_PATH }}"
"${WASM_FILTER_PATH:?}"/target/"${WASM_FILTER_TARGET:?}"/release \
"${WASM_FIXTURE_PATH:?}"
- name: debug
shell: bash
Expand Down

0 comments on commit 06b8410

Please sign in to comment.