Skip to content

Instantly share code, notes, and snippets.

@mhart
Last active May 23, 2022 04:36
Show Gist options
  • Save mhart/2fe6606ef2dcd2594c09d74761b192b4 to your computer and use it in GitHub Desktop.
Save mhart/2fe6606ef2dcd2594c09d74761b192b4 to your computer and use it in GitHub Desktop.
GitHub Actions running 5 tslint jobs in parallel (each tests every 5th file)
name: CI
on: [push]
jobs:
tslint:
runs-on: ubuntu-latest
strategy:
matrix:
job: [0, 1, 2, 3, 4]
steps:
- uses: actions/checkout@v1
- run: |
npm ci
find . -name '*.ts' -not -name '*.d.ts' -not -path './node_modules/*' | sort | \
awk "NR % $NUM_JOBS == $JOB" | xargs npm run tslint --
env:
NUM_JOBS: 5
JOB: ${{ matrix.job }}
{
"scripts": {
"tslint": "tslint -p tsconfig.json -t codeFrame"
}
}
@mhart
Copy link
Author

mhart commented Sep 28, 2019

Could also do:

xargs -n 100 npm run tslint --

to limit each tslint run to 100 files, and if you've got parallel CPU spare, and then you could do:

xargs -n 100 -P 4 npm run tslint --

which will run 4 tslint processes in parallel with 100 files each

(that is, 4 processes in parallel on each of the 5 CI jobs – for a total of 20 tslint processes in parallel)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment