Skip to content

Commit 5ef7212

Browse files
committed
Add parallel input
1 parent 8167b6f commit 5ef7212

File tree

11 files changed

+4103
-5309
lines changed

11 files changed

+4103
-5309
lines changed

README.md

Lines changed: 24 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ The action may be customized using the following optional inputs:
6060
| Name | Description | Default |
6161
| :----------------- | :-------------------------------------------------------------------------------- | :----------------------------------------------------------------------------------------------------- |
6262
| `monorepo` | Enables [monorepo mode](#monorepo-mode) | `false` |
63+
| `parallel` | Configured parallel execution in [monorepo mode](#monorepo-mode) | `false` |
6364
| `projects` | Custom projects configuration for [monorepo mode](#monorepo-mode) | none |
6465
| `task` | Name of command to run Code PushUp per project in [monorepo mode](#monorepo-mode) | `code-pushup` |
6566
| `nxProjectsFilter` | CLI arguments used to filter Nx projects in [monorepo mode](#monorepo-mode) | `--with-target={task}` |
@@ -68,7 +69,6 @@ The action may be customized using the following optional inputs:
6869
| `artifacts` | Toggles if artifacts will we uploaded/downloaded | `true` |
6970
| `retention` | Artifact retention period in days | from repository settings |
7071
| `directory` | Directory in which `code-pushup` should run | `process.cwd()` |
71-
| `output` | Directory where reports will be created | `.code-pushup` |
7272
| `config` | Path to config file (`--config` option) | see [`@code-pushup/cli` docs](https://github.com/code-pushup/cli/tree/main/packages/cli#configuration) |
7373
| `silent` | Toggles if logs from Code PushUp CLI are printed | `false` |
7474
| `bin` | Command for executing Code PushUp CLI | `npx --no-install code-pushup` |
@@ -153,17 +153,6 @@ can override the name using the optional `task` input:
153153
task: analyze # custom Nx target
154154
```
155155

156-
For caching purposes, you may prefer to separate output directories per project.
157-
The `output` input supports interpolating the project name in the path using
158-
`{project}` syntax:
159-
160-
```yml
161-
- uses: code-pushup/github-action@v0
162-
with:
163-
monorepo: true
164-
output: .code-pushup/{project}
165-
```
166-
167156
In Nx monorepos, projects are listed using
168157
`nx show projects --with-target=code-pushup` by default. The `nxProjectsFilter`
169158
input sets the CLI arguments forwarded to
@@ -179,3 +168,26 @@ be run:
179168
nxProjectsFilter:
180169
'--with-target=code-pushup --affected --projects=apps/* exclude=*-e2e'
181170
```
171+
172+
### Parallel tasks
173+
174+
By default, tasks are run sequentially for each project in the monorepo. The
175+
`parallel` input enables parallel execution for tools which support it (Nx,
176+
Turborepo, PNPM, Yarn 2+).
177+
178+
```yml
179+
- uses: code-pushup/github-action@v0
180+
with:
181+
monorepo: true
182+
parallel: true
183+
```
184+
185+
The maximum number of concurrent tasks can be set by passing in a number instead
186+
of a boolean:
187+
188+
```yml
189+
- uses: code-pushup/github-action@v0
190+
with:
191+
monorepo: true
192+
parallel: 3
193+
```

__tests__/main.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ describe('code-pushup action', () => {
6565
process.env['INPUT_TOKEN'] = '<mock-github-token>'
6666
process.env['INPUT_BIN'] = 'npx code-pushup'
6767
process.env['INPUT_DIRECTORY'] = workDir
68-
process.env['INPUT_OUTPUT'] = '.code-pushup'
68+
process.env['INPUT_PARALLEL'] = 'false'
6969
process.env['INPUT_RETENTION'] = '14'
7070
process.env['INPUT_TASK'] = 'code-pushup'
7171
process.env['INPUT_SILENT'] = 'true'
@@ -148,7 +148,7 @@ describe('code-pushup action', () => {
148148
expect.stringContaining('report.json'),
149149
expect.stringContaining('report.md')
150150
]),
151-
expect.stringContaining('.code-pushup'),
151+
process.cwd(),
152152
{ retentionDays: 14 }
153153
)
154154

action.yml

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,15 @@ inputs:
1919
- `pnpm`: PNPM workspaces
2020
required: true
2121
default: false
22+
parallel:
23+
description: |
24+
Configures parallel execution in monorepo mode. Possibly values are:
25+
26+
- `false`: sequential (default)
27+
- `true`: parallel with default number of jobs (depends on monorepo tool)
28+
- integer which sets the number of concurrent jobs
29+
required: true
30+
default: false
2231
projects:
2332
description: |
2433
Project folders for custom monorepo setup.
@@ -48,11 +57,6 @@ inputs:
4857
directory:
4958
description: Custom working directory
5059
required: false
51-
output:
52-
description:
53-
Custom report output directory (use '{project}'-syntax in monorepo mode)
54-
required: false
55-
default: .code-pushup
5660
silent:
5761
description: Silence logs from Code Pushup CLI
5862
required: true

0 commit comments

Comments
 (0)