|
| 1 | +name: CI Diff |
| 2 | + |
| 3 | +on: |
| 4 | + pull_request: |
| 5 | + types: [opened, synchronize, closed] |
| 6 | + |
| 7 | +concurrency: |
| 8 | + group: ${{ github.workflow }}-${{ github.event.pull_request.number }} |
| 9 | + cancel-in-progress: true |
| 10 | + |
| 11 | +permissions: |
| 12 | + # Allow commenting on issues for `reusable-build.yml` |
| 13 | + issues: write |
| 14 | + # Allow commenting on pull requests |
| 15 | + pull-requests: write |
| 16 | + |
| 17 | +jobs: |
| 18 | + build: |
| 19 | + name: Build Bindings |
| 20 | + uses: ./.github/workflows/reusable-build.yml |
| 21 | + with: |
| 22 | + target: x86_64-unknown-linux-gnu |
| 23 | + runner: ${{ vars.LINUX_SELF_HOSTED_RUNNER_LABELS || '"ubuntu-22.04"' }} |
| 24 | + test: false |
| 25 | + bench: false |
| 26 | + prefer_docker: false |
| 27 | + ref: ${{ github.event.pull_request.head.sha }} |
| 28 | + |
| 29 | + demo-test: |
| 30 | + name: Demo Test |
| 31 | + needs: build |
| 32 | + runs-on: ${{ fromJSON(vars.LINUX_SELF_HOSTED_RUNNER_LABELS || '"ubuntu-22.04"') }} |
| 33 | + defaults: |
| 34 | + run: |
| 35 | + shell: bash |
| 36 | + steps: |
| 37 | + - name: Checkout |
| 38 | + uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5 |
| 39 | + with: |
| 40 | + ref: ${{ github.event.pull_request.head.sha }} |
| 41 | + clean: ${{ runner.environment == 'github-hosted' }} |
| 42 | + |
| 43 | + - name: Download bindings |
| 44 | + uses: ./.github/actions/artifact/download |
| 45 | + with: |
| 46 | + name: bindings-x86_64-unknown-linux-gnu |
| 47 | + path: crates/node_binding/ |
| 48 | + |
| 49 | + - name: Setup Pnpm |
| 50 | + timeout-minutes: 5 |
| 51 | + uses: ./.github/actions/pnpm/setup |
| 52 | + with: |
| 53 | + node-version: 22 |
| 54 | + |
| 55 | + - name: Pnpm Install |
| 56 | + uses: ./.github/actions/pnpm/install-dependencies |
| 57 | + |
| 58 | + - name: Build JS |
| 59 | + run: pnpm run build:js |
| 60 | + |
| 61 | + - name: Setup directory structure for demo |
| 62 | + run: | |
| 63 | + # Create a symlink in parent directory so demo can reference ../rspack |
| 64 | + PARENT_DIR=$(dirname $GITHUB_WORKSPACE) |
| 65 | + CURRENT_DIR=$(basename $GITHUB_WORKSPACE) |
| 66 | + cd "$PARENT_DIR" |
| 67 | + ln -sfn "$CURRENT_DIR" rspack |
| 68 | + cd "$CURRENT_DIR" |
| 69 | +
|
| 70 | + - name: Clone rspack-diff-minimal |
| 71 | + run: git clone https://github.com/yifancong/rspack-diff-minimal.git |
| 72 | + |
| 73 | + - name: Link packages and install dependencies |
| 74 | + working-directory: rspack-diff-minimal |
| 75 | + run: | |
| 76 | + # Update package.json to link local packages |
| 77 | + # From rspack-diff-minimal, rspack root is at ../rspack |
| 78 | + npm pkg set "devDependencies.@rspack/binding=link:../rspack/crates/node_binding" |
| 79 | + npm pkg set "devDependencies.@rspack/core=link:../rspack/packages/rspack" |
| 80 | + npm pkg set "devDependencies.@rspack/cli=link:../rspack/packages/rspack-cli" |
| 81 | + pnpm install |
| 82 | +
|
| 83 | + - name: Build demo project |
| 84 | + working-directory: rspack-diff-minimal |
| 85 | + run: pnpm run build |
0 commit comments