Skip to content

Commit

Permalink
feat: build-rspack-binding.yaml
Browse files Browse the repository at this point in the history
  • Loading branch information
SyMind committed Mar 13, 2024
1 parent 4ec0ca2 commit fb760a4
Show file tree
Hide file tree
Showing 4 changed files with 109 additions and 20 deletions.
39 changes: 39 additions & 0 deletions .github/workflows/build-rspack-binding.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
name: Build Rspack Binding

on:
workflow_dispatch:
inputs:
repository:
description: 'Rspack repository to use'
default: 'web-infra-dev/rspack'
ref:
description: 'The branch, tag or SHA to checkout'

jobs:
get-runner-labels:
- steps:
name: Get Runner Labels
uses: ./.github/workflows/get-runner-labels.yml

main:
needs: [get-runner-labels]
runs-on: ${{ fromJSON(needs.get-runner-labels.outputs.LINUX_RUNNER_LABELS) }}
steps:
- uses: actions/setup-node@v3
with:
node-version: 18
- run: corepack enable
- run: pnpm --version
- name: Checkout Rspack repo
uses: actions/checkout@v4
with:
repository: ${{ inputs.repository }}
ref: ${{ inputs.ref }}
- name: Build Rspack
run: |
pnpm i --frozen-lockfile
pnpm run build:binding:release
- uses: actions/upload-artifact@v4
with:
name: bindings-x86_64-unknown-linux-gnu
path: crates/node_binding/*.node
38 changes: 38 additions & 0 deletions .github/workflows/build-rspack-js.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: Build Rspack JS

on:
workflow_dispatch:
inputs:
repository:
description: 'Rspack repository to use'
default: 'main'
ref:
description: 'The branch, tag or SHA to checkout'

jobs:
get-runner-labels:
name: Get Runner Labels
uses: ./.github/workflows/get-runner-labels.yml

main:
needs: [get-runner-labels]
runs-on: ${{ fromJSON(needs.get-runner-labels.outputs.LINUX_RUNNER_LABELS) }}
steps:
- uses: actions/setup-node@v3
with:
node-version: 18
- run: corepack enable
- run: pnpm --version
- name: Checkout Rspack repo
uses: actions/checkout@v4
with:
repository: ${{ inputs.repository }}
ref: ${{ inputs.ref }}
- name: Build Rspack
run: |
pnpm i --frozen-lockfile
pnpm run build:binding:release
- uses: actions/upload-artifact@v4
with:
name: bindings-x86_64-unknown-linux-gnu
path: crates/node_binding/*.node
21 changes: 1 addition & 20 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,30 +12,11 @@ jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/setup-node@v3
with:
node-version: 18
- run: corepack enable
- run: pnpm --version
- name: Checkout Rspack repo
uses: actions/checkout@v4
with:
repository: web-infra-dev/rspack
path: workspace/rspack
- name: Build Rspack
run: |
cd workspace/rspack
pnpm i --frozen-lockfile
pnpm run build:binding:release
- uses: actions/upload-artifact@v4
with:
name: bindings-x86_64-unknown-linux-gnu
path: workspace/rspack/crates/node_binding/*.node
- uses: ./.github/actions/build-rspack-binding.yaml

ci:
needs: build
runs-on: ubuntu-latest
if: "inputs.suite == '-'"
strategy:
matrix:
suite:
Expand Down
31 changes: 31 additions & 0 deletions .github/workflows/get-runner-labels.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: Get Runner Labels

on:
workflow_call:
outputs:
LINUX_RUNNER_LABELS:
description: "linux runner labels"
value: ${{ jobs.main.outputs.LINUX_RUNNER_LABELS }}
MACOS_RUNNER_LABELS:
description: "macos runner labels"
value: ${{ jobs.main.outputs.MACOS_RUNNER_LABELS }}
WINDOWS_RUNNER_LABELS:
description: "windows runner labels"
value: ${{ jobs.main.outputs.WINDOWS_RUNNER_LABELS }}

jobs:
main:
name: Get Runner Labels
runs-on: ubuntu-latest
outputs:
LINUX_RUNNER_LABELS: ${{ steps.run.outputs.LINUX_RUNNER_LABELS }}
MACOS_RUNNER_LABELS: ${{ steps.run.outputs.MACOS_RUNNER_LABELS }}
WINDOWS_RUNNER_LABELS: ${{ steps.run.outputs.WINDOWS_RUNNER_LABELS }}
steps:
- id: run
shell: bash
run: |
# set default value for vars.XXX_RUNNER_LABELS
echo 'LINUX_RUNNER_LABELS=${{ vars.LINUX_RUNNER_LABELS || '"ubuntu-latest"' }}' >> "$GITHUB_OUTPUT"
echo 'MACOS_RUNNER_LABELS=${{ vars.MACOS_RUNNER_LABELS || '"macos-latest"' }}' >> "$GITHUB_OUTPUT"
echo 'WINDOWS_RUNNER_LABELS=${{ vars.WINDOWS_RUNNER_LABELS || '"windows-latest"' }}' >> "$GITHUB_OUTPUT"

0 comments on commit fb760a4

Please sign in to comment.