andresz1 / size-limit-action

Compare the real cost to run your JS app or lib to keep good performance in every pull request
ISC License
449 stars 83 forks source link

skip_step install not skipping install step #81

Open Soviut opened 2 years ago

Soviut commented 2 years ago

I'm trying to skip the install step so that I can install manually. I need to install manually so I can use some install flags to ignore peer dependency warnings in npm 8 which halts the build.

.github/workflows/size-limit.yml

name: size

on: [pull_request]

jobs:
  size:
    runs-on: ubuntu-latest

    env:
      CI_JOB_NUMBER: 1

    steps:
      - uses: actions/checkout@v3

      - name: Install dependencies
        run: npm ci --legacy-peer-deps

      - uses: andresz1/size-limit-action@v1
        with:
          github_token: ${{ secrets.GITHUB_TOKEN }}
          skip_step: install

The build logs look like this (slightly truncated and anonymized)

/usr/local/bin/npm run build
> invoice-portal@0.0.0 build
> vue-tsc --noEmit && vite build
vite v2.8.6 building for production...
transforming...
✓ 1060 modules transformed.
rendering chunks...
[[[A BUNCH OF CHUNKS]]]
(!) Some chunks are larger than 500 KiB after minification. Consider:
- Using dynamic import() to code-split the application
- Use build.rollupOptions.output.manualChunks to improve chunking: https://rollupjs.org/guide/en/#outputmanualchunks
- Adjust chunk size limit for this warning via build.chunkSizeWarningLimit.

/usr/local/bin/npx size-limit --json
[
  {
    "name": "dist/assets/index.32071fe5.js, dist/assets/index.ae5488d4.js",
    "passed": true,
    "size": 34324,
    "running": 0.49793333333333334,
    "loading": 0.670390625
  },
  {
    "name": "dist/assets/index.e64127f8.css",
    "passed": true,
    "size": 10312,
    "running": 0,
    "loading": 0.20140625
  },
  {
    "name": "dist/assets/vendor.0fadab2e.js",
    "passed": true,
    "size": 238644,
    "running": 0.6442333333333333,
    "loading": 4.661015625
  }
]

/usr/bin/git fetch origin master --depth=1
From https://github.com/SOMECOMPANY/invoice-portal
 * branch            master     -> FETCH_HEAD
 * [new branch]      master     -> origin/master

/usr/bin/git checkout -f master
Previous HEAD position was [[[SOME HASH]]]
Switched to a new branch 'master'
branch 'master' set up to track 'origin/master'.

/usr/local/bin/npm install    <------[[[IT IS STILL INSTALLING???]]]
npm ERR! code ERESOLVE
npm ERR! ERESOLVE could not resolve
npm ERR! 
npm ERR! While resolving: chrome-aws-lambda@10.1.0
npm ERR! Found: puppeteer-core@13.5.2
npm ERR! node_modules/puppeteer-core
npm ERR!   puppeteer-core@"13.5" from the root project
npm ERR! 
npm ERR! Could not resolve dependency:
npm ERR! peer puppeteer-core@"^10.1.0" from chrome-aws-lambda@10.1.0
npm ERR! node_modules/chrome-aws-lambda
npm ERR!   chrome-aws-lambda@"^10.1.0" from the root project
npm ERR! 
npm ERR! Conflicting peer dependency: puppeteer-core@10.4.0
npm ERR! node_modules/puppeteer-core
npm ERR!   peer puppeteer-core@"^10.1.0" from chrome-aws-lambda@10.1.0
npm ERR!   node_modules/chrome-aws-lambda
npm ERR!     chrome-aws-lambda@"^10.1.0" from the root project
npm ERR! 
npm ERR! Fix the upstream dependency conflict, or retry
npm ERR! this command with --force, or --legacy-peer-deps
npm ERR! to accept an incorrect (and potentially broken) dependency resolution.
npm ERR! 
npm ERR! See /home/runner/.npm/eresolve-report.txt for a full report.
npm ERR! A complete log of this run can be found in:
npm ERR!     /home/runner/.npm/_logs/[20](https://github.com/SOMECOMPANY/invoice-portal/runs/6838458695?check_suite_focus=true#step:4:21)22-06-10T[21](https://github.com/SOMECOMPANY/invoice-portal/runs/6838458695?check_suite_focus=true#step:4:22)_50_10_4[29](https://github.com/SOMECOMPANY/invoice-portal/runs/6838458695?check_suite_focus=true#step:4:30)Z-debug-0.log
Error: The process '/usr/local/bin/npm' failed with exit code 1
elidupuis commented 2 years ago

I just ran into this as well. It looks like the install step that is running is the (even with the skip_install flag set) is for the size comparison between the PR and the base branch. The skip_install flag is not being passed to this size-limit execution: https://github.com/andresz1/size-limit-action/blob/1f3a2e486e49bf37642e97ab4df412cec1febf97/src/main.ts#L65

I assume this is intentional because it needs to install the dependencies as they exist on the base branch to properly compare the size-limit results.

Seems like #82 would be a good solution for flexibility and different use cases but I wonder if simply using npm ci instead of npm install would work for standard use cases 🤔

stazcp commented 1 year ago

I am still having this issue, it skipped install once and now it doesn't do it anymore.

beamery-tomht commented 1 year ago

Same here, already installed deps in our job so don't need this auto install - skip_step: build should prevent both install and build but both occur and then runs npx size-limit --json again...