From 20158b2277c2a0bdcc693aa159f3a63c199679d2 Mon Sep 17 00:00:00 2001 From: afc163 Date: Wed, 7 Dec 2022 12:17:30 +0800 Subject: [PATCH] chore: update size-limit.yml (#39338) --- .github/workflows/size-limit.yml | 42 ++++++++++++++++++++++++++++---- 1 file changed, 37 insertions(+), 5 deletions(-) diff --git a/.github/workflows/size-limit.yml b/.github/workflows/size-limit.yml index 96aca8bde2..8abd9ff042 100644 --- a/.github/workflows/size-limit.yml +++ b/.github/workflows/size-limit.yml @@ -22,8 +22,40 @@ jobs: CI_JOB_NUMBER: 1 steps: - - uses: actions/checkout@v3 - - uses: andresz1/size-limit-action@v1 - with: - github_token: ${{ secrets.GITHUB_TOKEN }} - script: npx size-limit --json --why \ No newline at end of file + - name: checkout + uses: actions/checkout@v3 + + - name: cache package-lock.json + uses: actions/cache@v3 + with: + path: package-temp-dir + key: lock-${{ github.sha }} + + - name: create package-lock.json + run: npm i --package-lock-only --ignore-scripts + + - name: hack for single file + run: | + if [ ! -d "package-temp-dir" ]; then + mkdir package-temp-dir + fi + cp package-lock.json package-temp-dir + - name: cache node_modules + id: node_modules_cache_id + uses: actions/cache@v3 + with: + path: node_modules + key: node_modules-${{ hashFiles('**/package-temp-dir/package-lock.json') }} + + - name: install + if: steps.node_modules_cache_id.outputs.cache-hit != 'true' + run: npm ci + + - name: size-limit + uses: ant-design/size-limit-action@master + with: + github_token: ${{ secrets.GITHUB_TOKEN }} + build_script: dist + skip_step: install + env: + NODE_OPTIONS: --max_old_space_size=4096