Merge upstream #5
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Build ruff_wasm for npm. | |
| # | |
| # Assumed to run as a subworkflow of .github/workflows/release.yml; specifically, as a local | |
| # artifacts job within `cargo-dist`. | |
| name: "Build wasm" | |
| on: | |
| workflow_call: | |
| inputs: | |
| plan: | |
| required: true | |
| type: string | |
| pull_request: | |
| paths: | |
| - .github/workflows/build-wasm.yml | |
| concurrency: | |
| group: build-wasm-${{ github.ref }} | |
| cancel-in-progress: ${{ github.event_name == 'pull_request' }} | |
| permissions: {} | |
| env: | |
| CARGO_INCREMENTAL: 0 | |
| CARGO_NET_RETRY: 10 | |
| CARGO_TERM_COLOR: always | |
| RUSTUP_MAX_RETRIES: 10 | |
| jobs: | |
| build: | |
| if: ${{ !contains(github.event.pull_request.labels.*.name, 'no-build') }} | |
| runs-on: ubuntu-latest | |
| strategy: | |
| matrix: | |
| target: [web, bundler, nodejs] | |
| fail-fast: false | |
| steps: | |
| - uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0 | |
| with: | |
| persist-credentials: false | |
| - name: "Install Rust toolchain" | |
| run: rustup target add wasm32-unknown-unknown | |
| - uses: jetli/wasm-pack-action@0d096b08b4e5a7de8c28de67e11e945404e9eefa # v0.4.0 | |
| with: | |
| version: v0.13.1 | |
| - uses: jetli/wasm-bindgen-action@20b33e20595891ab1a0ed73145d8a21fc96e7c29 # v0.2.0 | |
| - name: "Run wasm-pack build" | |
| run: wasm-pack build --target ${{ matrix.target }} crates/ruff_wasm | |
| - name: "Rename generated package" | |
| run: | # Replace the package name w/ jq | |
| jq '.name="@astral-sh/ruff-wasm-${{ matrix.target }}"' crates/ruff_wasm/pkg/package.json > /tmp/package.json | |
| mv /tmp/package.json crates/ruff_wasm/pkg | |
| - run: cp LICENSE crates/ruff_wasm/pkg # wasm-pack does not put the LICENSE file in the pkg | |
| - name: "Upload wasm artifact" | |
| uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 | |
| with: | |
| # Avoid prefixing the name with `artifacts-` here to exclude it from the GitHub release. | |
| name: wasm-npm-${{ matrix.target }} | |
| path: crates/ruff_wasm/pkg |