Skip to content

Commit

Permalink
ci: only install binding dependencies when building binary (#9429)
Browse files Browse the repository at this point in the history
* ci: only install binding dependencies when building binary

* ci: only install binding dependencies when building binary

* ci: only install binding dependencies when building binary

* ci: only install binding dependencies when building binary

* ci: only install binding dependencies when building binary

* ci: only install binding dependencies when building binary

* ci: only install binding dependencies when building binary

* ci: only install binding dependencies when building binary

* ci: only install binding dependencies when building binary
  • Loading branch information
LingyuCoder authored Feb 21, 2025
1 parent 4965098 commit 4bbe65a
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 4 deletions.
12 changes: 9 additions & 3 deletions .github/actions/pnpm-cache/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@ inputs:
default: false
required: false
type: boolean
run-install:
default: true
required: false
type: boolean
save-if:
default: false
required: false
Expand Down Expand Up @@ -40,14 +44,15 @@ runs:
# https://pnpm.io/continuous-integration#github-actions
# Uses `packageManagement` field from package.json
- name: Install pnpm
uses: pnpm/action-setup@v4
if: ${{ inputs.node-version == '16' }}
uses: pnpm/action-setup@v4
with:
dest: ${{ runner.tool_cache }}/pnpm
# Use `@pnpm/exe` for Node 16
standalone: true

- name: Get pnpm store directory
if: ${{ inputs.run-install == 'true' }}
id: pnpm-cache
shell: bash
run: |
Expand All @@ -62,7 +67,7 @@ runs:
- name: Restore pnpm cache
id: restore
if: ${{ startsWith(runner.name, 'GitHub Actions') }}
if: ${{ inputs.run-install == 'true' && startsWith(runner.name, 'GitHub Actions') }}
uses: actions/cache/restore@0c907a75c2c80ebcb7f088228285e798b750cf8f # v4
with:
path: ${{ steps.pnpm-cache.outputs.STORE_PATH }}
Expand All @@ -72,6 +77,7 @@ runs:
- name: Install dependencies
shell: bash
if: ${{ inputs.run-install == 'true' }}
run: |
if [[ "${{ inputs.frozen-lockfile}}" == 'true' ]]; then
pnpm install --frozen-lockfile --prefer-offline
Expand All @@ -81,7 +87,7 @@ runs:
- name: Save pnpm cache
uses: actions/cache/save@0c907a75c2c80ebcb7f088228285e798b750cf8f # v4
if: ${{ startsWith(runner.name, 'GitHub Actions') && inputs.save-if == 'true' && steps.restore.outputs.cache-hit != 'true' }}
if: ${{ inputs.run-install == 'true' && startsWith(runner.name, 'GitHub Actions') && inputs.save-if == 'true' && steps.restore.outputs.cache-hit != 'true' }}
with:
path: ${{ steps.pnpm-cache.outputs.STORE_PATH }}
key: node-cache-${{ runner.os }}-pnpm-${{ hashFiles('pnpm-lock.yaml') }}
9 changes: 9 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ jobs:
runner: ${{ needs.get-runner-labels.outputs.LINUX_RUNNER_LABELS }}
skipable: ${{ needs.check-changed.outputs.changed != 'true' }}
bench: true
full-install: false

test-windows:
name: Test Windows
Expand All @@ -78,6 +79,8 @@ jobs:
profile: "dev"
runner: ${{ needs.get-runner-labels.outputs.WINDOWS_RUNNER_LABELS }}
skipable: ${{ needs.check-changed.outputs.changed != 'true' }}
full-install: false

test-mac:
name: Test Mac
needs: [get-runner-labels, check-changed]
Expand All @@ -88,6 +91,7 @@ jobs:
profile: "ci"
runner: ${{ needs.get-runner-labels.outputs.MACOS_RUNNER_LABELS }}
skipable: ${{ needs.check-changed.outputs.changed != 'true' }}
full-install: false

cargo-deny:
name: Check license of dependencies
Expand Down Expand Up @@ -212,6 +216,11 @@ jobs:
fmt: true
shared-key: check

- name: Pnpm Cache # Required by some tests
uses: ./.github/actions/pnpm-cache
with:
run-install: false

- name: Run Cargo Check
run: cargo check --workspace --all-targets --locked # Not using --release because it uses too much cache, and is also slow.

Expand Down
17 changes: 16 additions & 1 deletion .github/workflows/reusable-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@ on:
target:
required: true
type: string
full-install:
default: true
required: false
type: boolean
runner: # Runner labels
required: true
type: string
Expand Down Expand Up @@ -60,11 +64,20 @@ jobs:
with:
target: ${{ inputs.target }}

- name: Pnpm Cache
- name: Pnpm Setup
if: ${{ !inputs.skipable }}
uses: ./.github/actions/pnpm-cache
with:
save-if: ${{ github.ref_name == 'main' }}
run-install: ${{ inputs.full-install == 'true' }}

- name: Install binding node dependencies
if: ${{ !inputs.skipable && inputs.full-install != 'true' }}
shell: bash
run: |
cd ./crates/node_binding
pnpm install --ignore-workspace --no-lockfile
cd ../../
- name: Install Rust Toolchain
if: ${{ !inputs.skipable }}
Expand Down Expand Up @@ -99,6 +112,7 @@ jobs:
uses: xc2/free-disk-space@fbe203b3788f2bebe2c835a15925da303eaa5efe # v1.0.0
with:
tool-cache: false

# Linux
- name: Build x86_64-unknown-linux-gnu in Docker
if: ${{ inputs.target == 'x86_64-unknown-linux-gnu' && steps.check_cache.outputs.exists != 'true' && !inputs.skipable }}
Expand Down Expand Up @@ -184,6 +198,7 @@ jobs:
SYSROOT=$(xcrun --sdk macosx --show-sdk-path);
export CFLAGS="-isysroot $SYSROOT -isystem $SYSROOT";
RUST_TARGET=${{ inputs.target }} pnpm build:binding:${{ inputs.profile }}
- name: Upload artifact
id: upload-artifact
uses: ./.github/actions/upload-artifact
Expand Down

2 comments on commit 4bbe65a

@github-actions
Copy link
Contributor

@github-actions github-actions bot commented on 4bbe65a Feb 21, 2025

Choose a reason for hiding this comment

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

📝 Ecosystem CI detail: Open

suite result
modernjs ❌ failure
rspress ✅ success
rslib ✅ success
rsbuild ❌ failure
rsdoctor ❌ failure
examples ✅ success
devserver ✅ success
nuxt ✅ success

@github-actions
Copy link
Contributor

@github-actions github-actions bot commented on 4bbe65a Feb 21, 2025

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 (2025-02-21 18420bb) Current Change
10000_big_production-mode_disable-minimize + exec 36.6 s ± 380 ms 37.5 s ± 309 ms +2.45 %
10000_development-mode + exec 1.71 s ± 14 ms 1.7 s ± 31 ms -0.56 %
10000_development-mode_hmr + exec 671 ms ± 13 ms 673 ms ± 30 ms +0.36 %
10000_production-mode + exec 2.19 s ± 56 ms 2.15 s ± 64 ms -1.74 %
10000_production-mode_persistent-cold + exec 2.35 s ± 128 ms 2.3 s ± 59 ms -1.99 %
10000_production-mode_persistent-hot + exec 1.62 s ± 28 ms 1.67 s ± 232 ms +3.31 %
arco-pro_development-mode + exec 1.72 s ± 92 ms 1.71 s ± 53 ms -0.70 %
arco-pro_development-mode_hmr + exec 374 ms ± 1.2 ms 375 ms ± 0.98 ms +0.09 %
arco-pro_production-mode + exec 3.58 s ± 82 ms 3.57 s ± 19 ms -0.15 %
arco-pro_production-mode_generate-package-json-webpack-plugin + exec 3.57 s ± 41 ms 3.58 s ± 121 ms +0.24 %
arco-pro_production-mode_persistent-cold + exec 3.67 s ± 287 ms 3.61 s ± 162 ms -1.61 %
arco-pro_production-mode_persistent-hot + exec 2.24 s ± 106 ms 2.36 s ± 242 ms +5.46 %
arco-pro_production-mode_traverse-chunk-modules + exec 3.54 s ± 225 ms 3.52 s ± 156 ms -0.73 %
large-dyn-imports_development-mode + exec 1.97 s ± 37 ms 1.94 s ± 23 ms -1.38 %
large-dyn-imports_production-mode + exec 2.02 s ± 37 ms 2.05 s ± 106 ms +1.26 %
threejs_development-mode_10x + exec 1.48 s ± 140 ms 1.44 s ± 10 ms -3.12 %
threejs_development-mode_10x_hmr + exec 817 ms ± 22 ms 788 ms ± 38 ms -3.54 %
threejs_production-mode_10x + exec 5.14 s ± 161 ms 5.03 s ± 37 ms -2.00 %
threejs_production-mode_10x_persistent-cold + exec 5.15 s ± 352 ms 5.14 s ± 370 ms -0.33 %
threejs_production-mode_10x_persistent-hot + exec 4.49 s ± 273 ms 4.4 s ± 54 ms -2.04 %
10000_big_production-mode_disable-minimize + rss memory 8682 MiB ± 73.1 MiB 8684 MiB ± 41.3 MiB +0.03 %
10000_development-mode + rss memory 651 MiB ± 9.54 MiB 682 MiB ± 16.7 MiB +4.78 %
10000_development-mode_hmr + rss memory 1191 MiB ± 187 MiB 1329 MiB ± 193 MiB +11.62 %
10000_production-mode + rss memory 620 MiB ± 27.7 MiB 646 MiB ± 20.5 MiB +4.13 %
10000_production-mode_persistent-cold + rss memory 729 MiB ± 21.8 MiB 765 MiB ± 11.7 MiB +4.97 %
10000_production-mode_persistent-hot + rss memory 703 MiB ± 22.6 MiB 729 MiB ± 22.5 MiB +3.75 %
arco-pro_development-mode + rss memory 574 MiB ± 19.3 MiB 590 MiB ± 44.8 MiB +2.90 %
arco-pro_development-mode_hmr + rss memory 660 MiB ± 46.9 MiB 667 MiB ± 53.7 MiB +1.07 %
arco-pro_production-mode + rss memory 711 MiB ± 22.3 MiB 724 MiB ± 42.8 MiB +1.79 %
arco-pro_production-mode_generate-package-json-webpack-plugin + rss memory 729 MiB ± 38.7 MiB 734 MiB ± 22.1 MiB +0.78 %
arco-pro_production-mode_persistent-cold + rss memory 789 MiB ± 47.8 MiB 799 MiB ± 31.2 MiB +1.31 %
arco-pro_production-mode_persistent-hot + rss memory 636 MiB ± 24.6 MiB 675 MiB ± 10.8 MiB +6.19 %
arco-pro_production-mode_traverse-chunk-modules + rss memory 725 MiB ± 22.4 MiB 713 MiB ± 25.9 MiB -1.58 %
large-dyn-imports_development-mode + rss memory 644 MiB ± 5.16 MiB 655 MiB ± 1.61 MiB +1.76 %
large-dyn-imports_production-mode + rss memory 521 MiB ± 5.02 MiB 530 MiB ± 8.59 MiB +1.70 %
threejs_development-mode_10x + rss memory 572 MiB ± 30 MiB 569 MiB ± 11.8 MiB -0.67 %
threejs_development-mode_10x_hmr + rss memory 1128 MiB ± 228 MiB 1143 MiB ± 118 MiB +1.32 %
threejs_production-mode_10x + rss memory 851 MiB ± 78.3 MiB 845 MiB ± 52.6 MiB -0.76 %
threejs_production-mode_10x_persistent-cold + rss memory 957 MiB ± 45.2 MiB 940 MiB ± 48.2 MiB -1.80 %
threejs_production-mode_10x_persistent-hot + rss memory 811 MiB ± 63.4 MiB 818 MiB ± 53 MiB +0.90 %

Threshold exceeded: ["arco-pro_production-mode_persistent-hot + exec"]

Please sign in to comment.