From 466b1695123965eaf88c7f32cdf0fe4d2a45c2a3 Mon Sep 17 00:00:00 2001 From: Cong-Cong Date: Tue, 21 May 2024 14:45:04 +0800 Subject: [PATCH 1/9] perf: cache ~/.cargo --- .github/actions/prepare-rspack-binding/action.yaml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/actions/prepare-rspack-binding/action.yaml b/.github/actions/prepare-rspack-binding/action.yaml index 0f29312..5d480d3 100644 --- a/.github/actions/prepare-rspack-binding/action.yaml +++ b/.github/actions/prepare-rspack-binding/action.yaml @@ -43,6 +43,9 @@ runs: uses: MasterworksIO/action-local-cache@2 with: path: '${{ inputs.path }}/target' + - uses: MasterworksIO/action-local-cache@2 + with: + path: '${{ github.workspace }}/.cargo' - name: Show Rust Cache if: steps.rust-cache.outputs.cache-hit == 'true' shell: bash From 17d79b02bac961825f0935bc3c79b7a889ce4d75 Mon Sep 17 00:00:00 2001 From: Cong-Cong Date: Tue, 21 May 2024 15:07:36 +0800 Subject: [PATCH 2/9] chore: print $HOME --- .github/actions/prepare-rspack-binding/action.yaml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/actions/prepare-rspack-binding/action.yaml b/.github/actions/prepare-rspack-binding/action.yaml index 5d480d3..edf84f5 100644 --- a/.github/actions/prepare-rspack-binding/action.yaml +++ b/.github/actions/prepare-rspack-binding/action.yaml @@ -43,6 +43,8 @@ runs: uses: MasterworksIO/action-local-cache@2 with: path: '${{ inputs.path }}/target' + - name: Print .cargo path + run: echo "$HOME/.cargo" - uses: MasterworksIO/action-local-cache@2 with: path: '${{ github.workspace }}/.cargo' From 4640540235a6b26b12e18ef2aec2724e51b52009 Mon Sep 17 00:00:00 2001 From: Cong-Cong Date: Wed, 22 May 2024 13:55:38 +0800 Subject: [PATCH 3/9] test --- .github/workflows/ci.yml | 78 ++++++++++++++++++++-------------------- 1 file changed, 39 insertions(+), 39 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 0aaac61..cb5c0dd 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -21,42 +21,42 @@ jobs: - uses: actions/checkout@v4 - uses: ./.github/actions/prepare-rspack-binding - ci: - needs: [get-runner-labels, prepare-binding] - strategy: - matrix: - include: - - suite: modernjs - os: ubuntu-latest - - suite: _selftest - os: ubuntu-latest - - suite: nx - os: ubuntu-latest - - suite: rspress - os: ubuntu-latest - - suite: rsbuild - os: ubuntu-latest - - suite: compat - os: ubuntu-latest - - suite: examples - os: ubuntu-latest - fail-fast: false - runs-on: ${{ matrix.os }} - name: ${{ matrix.suite }} - steps: - - uses: actions/checkout@v4 - - uses: ./.github/actions/build-rspack - - name: Install - run: pnpm install --frozen-lockfile --prefer-offline - - name: Format - if: matrix.suite == '_selftest' - run: pnpm format - - name: Lint - if: matrix.suite == '_selftest' - run: pnpm lint - - name: Expose GitHub Runtime - uses: crazy-max/ghaction-github-runtime@v3 - - run: >- - pnpm tsx ecosystem-ci.ts - run-suites - ${{ matrix.suite }} + # ci: + # needs: [get-runner-labels, prepare-binding] + # strategy: + # matrix: + # include: + # - suite: modernjs + # os: ubuntu-latest + # - suite: _selftest + # os: ubuntu-latest + # - suite: nx + # os: ubuntu-latest + # - suite: rspress + # os: ubuntu-latest + # - suite: rsbuild + # os: ubuntu-latest + # - suite: compat + # os: ubuntu-latest + # - suite: examples + # os: ubuntu-latest + # fail-fast: false + # runs-on: ${{ matrix.os }} + # name: ${{ matrix.suite }} + # steps: + # - uses: actions/checkout@v4 + # - uses: ./.github/actions/build-rspack + # - name: Install + # run: pnpm install --frozen-lockfile --prefer-offline + # - name: Format + # if: matrix.suite == '_selftest' + # run: pnpm format + # - name: Lint + # if: matrix.suite == '_selftest' + # run: pnpm lint + # - name: Expose GitHub Runtime + # uses: crazy-max/ghaction-github-runtime@v3 + # - run: >- + # pnpm tsx ecosystem-ci.ts + # run-suites + # ${{ matrix.suite }} From 7fca17333b8cd0996dfba668fe238762e0990371 Mon Sep 17 00:00:00 2001 From: Cong-Cong Date: Wed, 22 May 2024 13:56:54 +0800 Subject: [PATCH 4/9] revert: remove cache .cargo --- .github/actions/prepare-rspack-binding/action.yaml | 5 ----- 1 file changed, 5 deletions(-) diff --git a/.github/actions/prepare-rspack-binding/action.yaml b/.github/actions/prepare-rspack-binding/action.yaml index edf84f5..0f29312 100644 --- a/.github/actions/prepare-rspack-binding/action.yaml +++ b/.github/actions/prepare-rspack-binding/action.yaml @@ -43,11 +43,6 @@ runs: uses: MasterworksIO/action-local-cache@2 with: path: '${{ inputs.path }}/target' - - name: Print .cargo path - run: echo "$HOME/.cargo" - - uses: MasterworksIO/action-local-cache@2 - with: - path: '${{ github.workspace }}/.cargo' - name: Show Rust Cache if: steps.rust-cache.outputs.cache-hit == 'true' shell: bash From cb0020a7f56ba73ef2b9d17a9e7855cb6dd8c3ad Mon Sep 17 00:00:00 2001 From: Cong-Cong Date: Wed, 22 May 2024 13:57:16 +0800 Subject: [PATCH 5/9] feat: print total size --- .github/actions/prepare-rspack-binding/action.yaml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/.github/actions/prepare-rspack-binding/action.yaml b/.github/actions/prepare-rspack-binding/action.yaml index 0f29312..dcf09ff 100644 --- a/.github/actions/prepare-rspack-binding/action.yaml +++ b/.github/actions/prepare-rspack-binding/action.yaml @@ -46,7 +46,11 @@ runs: - name: Show Rust Cache if: steps.rust-cache.outputs.cache-hit == 'true' shell: bash - run: ls -lah ${{ inputs.path }}/target + run: | + ls -lah ${{ inputs.path }}/target + echo "---------------------" + total_size=$(du -sh . | awk '{print $1}') + echo "Total size of directory contents: $total_size" - name: Build Rspack shell: bash run: | From e2cf44f070e2f9e343707afa0efb3b9c032839a9 Mon Sep 17 00:00:00 2001 From: Cong-Cong Date: Wed, 22 May 2024 14:06:53 +0800 Subject: [PATCH 6/9] try: pnpm cache --- .github/actions/build-rspack/action.yaml | 8 ++- .github/workflows/ci.yml | 78 ++++++++++++------------ 2 files changed, 44 insertions(+), 42 deletions(-) diff --git a/.github/actions/build-rspack/action.yaml b/.github/actions/build-rspack/action.yaml index 66bec7e..b98eb6d 100644 --- a/.github/actions/build-rspack/action.yaml +++ b/.github/actions/build-rspack/action.yaml @@ -23,9 +23,6 @@ outputs: runs: using: composite steps: - - uses: actions/setup-node@v3 - with: - node-version: 18 - shell: bash name: Install package manager run: | @@ -33,6 +30,11 @@ runs: echo "Corepack version: $(corepack --version)" corepack enable + - uses: actions/setup-node@v3 + with: + node-version: 18 + cache: 'pnpm' + - name: Checkout Rspack repo uses: actions/checkout@v4 with: diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index cb5c0dd..0aaac61 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -21,42 +21,42 @@ jobs: - uses: actions/checkout@v4 - uses: ./.github/actions/prepare-rspack-binding - # ci: - # needs: [get-runner-labels, prepare-binding] - # strategy: - # matrix: - # include: - # - suite: modernjs - # os: ubuntu-latest - # - suite: _selftest - # os: ubuntu-latest - # - suite: nx - # os: ubuntu-latest - # - suite: rspress - # os: ubuntu-latest - # - suite: rsbuild - # os: ubuntu-latest - # - suite: compat - # os: ubuntu-latest - # - suite: examples - # os: ubuntu-latest - # fail-fast: false - # runs-on: ${{ matrix.os }} - # name: ${{ matrix.suite }} - # steps: - # - uses: actions/checkout@v4 - # - uses: ./.github/actions/build-rspack - # - name: Install - # run: pnpm install --frozen-lockfile --prefer-offline - # - name: Format - # if: matrix.suite == '_selftest' - # run: pnpm format - # - name: Lint - # if: matrix.suite == '_selftest' - # run: pnpm lint - # - name: Expose GitHub Runtime - # uses: crazy-max/ghaction-github-runtime@v3 - # - run: >- - # pnpm tsx ecosystem-ci.ts - # run-suites - # ${{ matrix.suite }} + ci: + needs: [get-runner-labels, prepare-binding] + strategy: + matrix: + include: + - suite: modernjs + os: ubuntu-latest + - suite: _selftest + os: ubuntu-latest + - suite: nx + os: ubuntu-latest + - suite: rspress + os: ubuntu-latest + - suite: rsbuild + os: ubuntu-latest + - suite: compat + os: ubuntu-latest + - suite: examples + os: ubuntu-latest + fail-fast: false + runs-on: ${{ matrix.os }} + name: ${{ matrix.suite }} + steps: + - uses: actions/checkout@v4 + - uses: ./.github/actions/build-rspack + - name: Install + run: pnpm install --frozen-lockfile --prefer-offline + - name: Format + if: matrix.suite == '_selftest' + run: pnpm format + - name: Lint + if: matrix.suite == '_selftest' + run: pnpm lint + - name: Expose GitHub Runtime + uses: crazy-max/ghaction-github-runtime@v3 + - run: >- + pnpm tsx ecosystem-ci.ts + run-suites + ${{ matrix.suite }} From a51d880ad8111dcad53f2f9259a556aba79f822d Mon Sep 17 00:00:00 2001 From: Cong-Cong Date: Wed, 22 May 2024 14:43:58 +0800 Subject: [PATCH 7/9] feat: add cache-dependency-path --- .github/actions/build-rspack/action.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/actions/build-rspack/action.yaml b/.github/actions/build-rspack/action.yaml index b98eb6d..3579f04 100644 --- a/.github/actions/build-rspack/action.yaml +++ b/.github/actions/build-rspack/action.yaml @@ -34,6 +34,7 @@ runs: with: node-version: 18 cache: 'pnpm' + cache-dependency-path: '**/pnpm-lock.yaml' - name: Checkout Rspack repo uses: actions/checkout@v4 From cad36c99280a6627de30245ab23537a12caf5ee8 Mon Sep 17 00:00:00 2001 From: Cong-Cong Date: Wed, 22 May 2024 15:19:04 +0800 Subject: [PATCH 8/9] fix: Show Rust `target` Cache --- .../prepare-rspack-binding/action.yaml | 27 ++++++++++++++++--- 1 file changed, 23 insertions(+), 4 deletions(-) diff --git a/.github/actions/prepare-rspack-binding/action.yaml b/.github/actions/prepare-rspack-binding/action.yaml index dcf09ff..0aeec22 100644 --- a/.github/actions/prepare-rspack-binding/action.yaml +++ b/.github/actions/prepare-rspack-binding/action.yaml @@ -39,18 +39,37 @@ runs: npm install -g corepack@0.24.1 echo "Corepack version: $(corepack --version)" corepack enable - - id: rust-cache + - id: rust-target-cache + name: Cache Rust `target` uses: MasterworksIO/action-local-cache@2 with: path: '${{ inputs.path }}/target' - - name: Show Rust Cache - if: steps.rust-cache.outputs.cache-hit == 'true' + - name: Show Rust `target` Cache + if: steps.rust-target-cache.outputs.cache-hit == 'true' shell: bash run: | ls -lah ${{ inputs.path }}/target echo "---------------------" - total_size=$(du -sh . | awk '{print $1}') + total_size=$(du -sh ${{ inputs.path }}/target | awk '{print $1}') echo "Total size of directory contents: $total_size" + # - name: Print .cargo path and Export + # shell: bash + # run: | + # CARGO_PATH="${CARGO_HOME:-$HOME/.cargo}" + # echo "CARGO_PATH=$CARGO_PATH" >> $GITHUB_ENV + # - id: rust-cargo-cache + # name: Cache Rust `.cargo` + # uses: MasterworksIO/action-local-cache@2 + # with: + # path: '${{ env.CARGO_PATH }}' + # - name: Show Rust `.cargo` Cache + # if: steps.rust-cargo-cache.outputs.cache-hit == 'true' + # shell: bash + # run: | + # ls -lah ${{ env.CARGO_PATH }} + # echo "---------------------" + # total_size=$(du -sh ${{ env.CARGO_PATH }} | awk '{print $1}') + # echo "Total size of directory contents: $total_size" - name: Build Rspack shell: bash run: | From 95189b7e8bc6a00b7a900a94bcb68815c2fc7a20 Mon Sep 17 00:00:00 2001 From: Cong-Cong Date: Wed, 22 May 2024 15:19:20 +0800 Subject: [PATCH 9/9] test --- .github/workflows/ci.yml | 78 ++++++++++++++++++++-------------------- 1 file changed, 39 insertions(+), 39 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 0aaac61..cb5c0dd 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -21,42 +21,42 @@ jobs: - uses: actions/checkout@v4 - uses: ./.github/actions/prepare-rspack-binding - ci: - needs: [get-runner-labels, prepare-binding] - strategy: - matrix: - include: - - suite: modernjs - os: ubuntu-latest - - suite: _selftest - os: ubuntu-latest - - suite: nx - os: ubuntu-latest - - suite: rspress - os: ubuntu-latest - - suite: rsbuild - os: ubuntu-latest - - suite: compat - os: ubuntu-latest - - suite: examples - os: ubuntu-latest - fail-fast: false - runs-on: ${{ matrix.os }} - name: ${{ matrix.suite }} - steps: - - uses: actions/checkout@v4 - - uses: ./.github/actions/build-rspack - - name: Install - run: pnpm install --frozen-lockfile --prefer-offline - - name: Format - if: matrix.suite == '_selftest' - run: pnpm format - - name: Lint - if: matrix.suite == '_selftest' - run: pnpm lint - - name: Expose GitHub Runtime - uses: crazy-max/ghaction-github-runtime@v3 - - run: >- - pnpm tsx ecosystem-ci.ts - run-suites - ${{ matrix.suite }} + # ci: + # needs: [get-runner-labels, prepare-binding] + # strategy: + # matrix: + # include: + # - suite: modernjs + # os: ubuntu-latest + # - suite: _selftest + # os: ubuntu-latest + # - suite: nx + # os: ubuntu-latest + # - suite: rspress + # os: ubuntu-latest + # - suite: rsbuild + # os: ubuntu-latest + # - suite: compat + # os: ubuntu-latest + # - suite: examples + # os: ubuntu-latest + # fail-fast: false + # runs-on: ${{ matrix.os }} + # name: ${{ matrix.suite }} + # steps: + # - uses: actions/checkout@v4 + # - uses: ./.github/actions/build-rspack + # - name: Install + # run: pnpm install --frozen-lockfile --prefer-offline + # - name: Format + # if: matrix.suite == '_selftest' + # run: pnpm format + # - name: Lint + # if: matrix.suite == '_selftest' + # run: pnpm lint + # - name: Expose GitHub Runtime + # uses: crazy-max/ghaction-github-runtime@v3 + # - run: >- + # pnpm tsx ecosystem-ci.ts + # run-suites + # ${{ matrix.suite }}