Skip to content

Commit

Permalink
chore(ci): support pkg.pr.new (#7757)
Browse files Browse the repository at this point in the history
* init

* test

* finish

* chore: follow suggestions

* fix

* fix
  • Loading branch information
shulaoda authored Sep 29, 2024
1 parent 220f77a commit b2ee5d1
Show file tree
Hide file tree
Showing 4 changed files with 105 additions and 1 deletion.
1 change: 1 addition & 0 deletions .github/actions/upload-artifact/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ runs:
name: ${{ inputs.name }}
path: ${{ inputs.path }}
if-no-files-found: error
overwrite: true
- name: Upload local
id: upload-local
if: ${{ !startsWith(runner.name, 'GitHub Actions') && inputs.try-local-cache == 'true' }}
Expand Down
12 changes: 12 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -388,3 +388,15 @@ jobs:
commitID: [${{github.sha}}](${{github.server_url}}/${{github.repository}}/commit/${{github.sha}})
URL: ${{github.server_url}}/${{github.repository}}/actions/runs/${{github.run_id}}
LARK_WEBHOOK_URL: ${{secrets.LARK_WEBHOOK_URL}}

pkg-preview:
name: Pkg Preview
needs:
- test-linux
- test-windows
- cargo-deny
- lint
- rust_check
- rust_test
if: ${{ (success() || cancelled()) && github.event_name == 'push' && github.ref == 'refs/heads/main' }}
uses: ./.github/workflows/preview-commit.yml
91 changes: 91 additions & 0 deletions .github/workflows/preview-commit.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
# https://github.com/stackblitz-labs/pkg.pr.new
name: Preview Commit

on:
workflow_call:

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

check-changed:
runs-on: ubuntu-latest
name: Check Changed
outputs:
changed: ${{ steps.filter.outputs.changed == 'true' }}
steps:
- uses: actions/checkout@v4
- uses: dorny/paths-filter@v3
id: filter
with:
predicate-quantifier: "every"
filters: |
changed:
- "crates"
- "packages/rspack/**"
- "packages/rspack-cli/**"
build:
needs: [get-runner-labels]
strategy:
fail-fast: false # Build and test everything so we can look at all the errors
matrix:
array:
- target: x86_64-unknown-linux-gnu
runner: ${{ needs.get-runner-labels.outputs.LINUX_RUNNER_LABELS }}
- target: aarch64-unknown-linux-gnu
runner: ${{ needs.get-runner-labels.outputs.LINUX_RUNNER_LABELS }}
- target: x86_64-unknown-linux-musl
runner: ${{ needs.get-runner-labels.outputs.LINUX_RUNNER_LABELS }}
- target: aarch64-unknown-linux-musl
runner: ${{ needs.get-runner-labels.outputs.LINUX_RUNNER_LABELS }}
- target: i686-pc-windows-msvc
runner: ${{ needs.get-runner-labels.outputs.WINDOWS_RUNNER_LABELS }}
- target: x86_64-pc-windows-msvc
runner: ${{ needs.get-runner-labels.outputs.WINDOWS_RUNNER_LABELS }}
- target: aarch64-pc-windows-msvc
runner: ${{ needs.get-runner-labels.outputs.WINDOWS_RUNNER_LABELS }}
- target: x86_64-apple-darwin
runner: ${{ needs.get-runner-labels.outputs.MACOS_RUNNER_LABELS }}
- target: aarch64-apple-darwin
runner: ${{ needs.get-runner-labels.outputs.MACOS_RUNNER_LABELS }}
uses: ./.github/workflows/reusable-build.yml
with:
target: ${{ matrix.array.target }}
runner: ${{ matrix.array.runner }}
profile: "release-prod"
test: false

publish:
if: github.repository == 'web-infra-dev/rspack'
name: Pkg Preview
runs-on: ubuntu-latest
needs:
- build
- check-changed
steps:
- uses: actions/checkout@v4

- name: Pnpm Cache
uses: ./.github/actions/pnpm-cache

- name: Download artifacts
uses: actions/[email protected]
with:
path: artifacts

- name: Build node packages
run: pnpm run build:js

- name: Move artifacts
run: node scripts/build-npm.cjs

- name: Show binding packages
run: ls -R npm

- name: Release
if: needs.check-changed.outputs.changed == 'true'
run: npx pkg-pr-new publish --compact --pnpm './npm/*' './crates/node_binding' './packages/rspack' './packages/rspack-cli'
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,8 @@ proc-macro2 = { version = "1.0.79" }
quote = { version = "1.0.35" }
rayon = { version = "1.10.0" }
regex = { version = "1.10.4" }
rspack_resolver = { version = "0.3.3", features = ["package_json_raw_json_api"] }
ropey = "1.6.1"
rspack_resolver = { version = "0.3.3", features = ["package_json_raw_json_api"] }
rspack_sources = { version = "=0.3.2" }
rustc-hash = { version = "1.1.0" }
serde = { version = "1.0.197" }
Expand Down

2 comments on commit b2ee5d1

@rspack-bot
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

📝 Benchmark detail: Open

Name Base (2024-09-29 b90321f) Current Change
10000_development-mode + exec 2.25 s ± 27 ms 2.19 s ± 37 ms -2.26 %
10000_development-mode_hmr + exec 710 ms ± 6.1 ms 684 ms ± 5.8 ms -3.73 %
10000_production-mode + exec 2.91 s ± 52 ms 2.75 s ± 20 ms -5.75 %
arco-pro_development-mode + exec 1.85 s ± 78 ms 1.84 s ± 51 ms -0.43 %
arco-pro_development-mode_hmr + exec 436 ms ± 2.8 ms 435 ms ± 2.5 ms -0.33 %
arco-pro_production-mode + exec 3.33 s ± 93 ms 3.21 s ± 60 ms -3.55 %
arco-pro_production-mode_generate-package-json-webpack-plugin + exec 3.35 s ± 107 ms 3.25 s ± 68 ms -2.86 %
threejs_development-mode_10x + exec 1.7 s ± 14 ms 1.67 s ± 12 ms -1.58 %
threejs_development-mode_10x_hmr + exec 791 ms ± 5.8 ms 776 ms ± 9.2 ms -1.87 %
threejs_production-mode_10x + exec 5.29 s ± 28 ms 5.08 s ± 23 ms -3.89 %

@rspack-bot
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

📝 Ran ecosystem CI: Open

suite result
modernjs ✅ success
_selftest ✅ success
rspress ✅ success
rslib ✅ success
rsbuild ✅ success
examples ✅ success
devserver ✅ success

Please sign in to comment.