Skip to content

add new snapshot tests #3

add new snapshot tests

add new snapshot tests #3

name: Repository dispatch on main
on:
workflow_dispatch:
push:
branches:
- main
permissions:
contents: read
actions: write
env:
BIOME_WEBSITE_REPO: biomejs/website
BIOME_PUSH_ON_MAIN_EVENT_TYPE: biome-push-on-main-event
WASM_PACK_CACHE_KEY: wasm-pack-cache
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
build-wasm:
name: Build @biomejs/wasm-web
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4.2.1
- name: Warm up wasm-pack cache
id: cache-restore
uses: actions/cache/restore@3624ceb22c1c5a301c8db4169662070a689d9ea8 # v4.1.1
with:
path: |
./target
./packages/@biomejs/wasm-web
key: ${{ env.WASM_PACK_CACHE_KEY }}
- name: Install wasm-pack
run: curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf | sh
- name: Build WASM module for the web
run: wasm-pack build --out-dir ../../packages/@biomejs/wasm-web --target web --profiling --scope biomejs crates/biome_wasm --features experimental-html,experimental-grit
# https://github.com/actions/cache/issues/342
- name: Clear old wasm-pack cache
if: ${{ steps.cache-restore.outputs.cache-hit }}
run: |
gh extension install actions/gh-actions-cache
gh actions-cache delete ${{ env.WASM_PACK_CACHE_KEY }} --confirm
env:
GH_TOKEN: ${{ github.token }}
continue-on-error: true
- name: Save new wasm-pack cache
uses: actions/cache/save@3624ceb22c1c5a301c8db4169662070a689d9ea8 # v4.1.1
with:
path: |
./target
./packages/@biomejs/wasm-web
key: ${{ env.WASM_PACK_CACHE_KEY }}
- name: Install pnpm
run: corepack enable
- name: Setup node
uses: actions/setup-node@0a44ba7841725637a19e28fa30b79a866c81b0a6 # v4.0.4
with:
node-version: 20
cache: pnpm
- name: Update package.json
working-directory: packages/@biomejs/wasm-web
run: |
npm pkg set name='@biomejs/wasm-web'
npm pkg set version='0.0.0-rev.${{ github.event.head_commit.id }}'
- name: Publish
working-directory: packages/@biomejs/wasm-web
run: pnpx pkg-pr-new publish
repository-dispatch:
name: Repository dispatch
needs: build-wasm
runs-on: ubuntu-latest
steps:
- name: Dispatch event on push
if: ${{ github.event_name == 'push' }}
uses: peter-evans/repository-dispatch@ff45666b9427631e3450c54a1bcbee4d9ff4d7c0 # v3
with:
token: ${{ secrets.BIOME_REPOSITORY_DISPATCH }}
repository: ${{ env.BIOME_WEBSITE_REPO }}
event-type: ${{ env.BIOME_PUSH_ON_MAIN_EVENT_TYPE }}
client-payload: '{"event": ${{ toJson(github.event) }}}'
# For testing only, the payload is mocked
- name: Dispatch event on workflow dispatch
if: ${{ github.event_name == 'workflow_dispatch' }}
uses: peter-evans/repository-dispatch@ff45666b9427631e3450c54a1bcbee4d9ff4d7c0 # v3
with:
token: ${{ secrets.BIOME_REPOSITORY_DISPATCH }}
repository: ${{ env.BIOME_WEBSITE_REPO }}
event-type: ${{ env.BIOME_PUSH_ON_MAIN_EVENT_TYPE }}
client-payload: '{"event": {"head_commit": {"id": "${{ env.GITHUB_SHA }}"}}}'