Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Provide a way to limit max-parallel on CI #116

Open
atomicpages opened this issue Jul 5, 2023 · 5 comments
Open

Provide a way to limit max-parallel on CI #116

atomicpages opened this issue Jul 5, 2023 · 5 comments

Comments

@atomicpages
Copy link

CI systems generally have restricted resources so it'd be great to limit the number of parallel processes via env var. I envision something like this:

MAX_PARALLEL_TASKS=4 npm-run-all -p build:*

a more verbose example with gitlab CI might look like:

build:
  stage: build
  script:
    - export MAX_PARALLEL_TASKS=2
    - npm ci
    - npx npm-run-all -p lint test check-types
    - npm run build

I'd be happy to make a MR for this if the community is interested. LMK! 🙏

@bcomnes
Copy link
Owner

bcomnes commented Jul 5, 2023

Open to it.

@lunsdorf
Copy link

lunsdorf commented Feb 2, 2024

Hi there. I was looking to see if this was something I could do. There is already an --max-parallel <number> option. @atomicpages, is your suggestion different from that?

@atomicpages
Copy link
Author

Slightly! My suggestion was to read from an environment variable if --max-parallel can't be used. In my case I have a complex monorepo that uses npm-run-all at the root and in packages so something like:

{
  "scripts": {
    "build": "pnpm --filter '@internal' build --if-present"
  }
}

triggers a bunch of npm-run-all scripts to get executed as well.

@bcomnes
Copy link
Owner

bcomnes commented Feb 2, 2024

If you want to add an ENV lookup where the flag is read, it probably wouldn't be hard to add (hopefully). Maybe call it RUN_P_MAX_PARALLE just so it's a bit more scoped.

@voxpelli
Copy link
Collaborator

voxpelli commented Feb 5, 2024

@atomicpages The better solution would be to add workspace support to npm-run-all2, right? #60 Although that's easier said than done so I can see the need for a stopgap measure like this – either within this module itself or through some other mechanism

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants