Skip to content

Commit 4ed9e62

Browse files
author
John Doe
committed
Merge remote-tracking branch 'refs/remotes/origin/main' into use-cp-nx-plugin
# Conflicts: # project.json
2 parents 441fccc + a83baae commit 4ed9e62

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

70 files changed

+951
-485
lines changed

.github/actions/code-pushup/action.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@ inputs:
66
description: GitHub token for API access
77
required: true
88
default: ${{ github.token }}
9+
mode:
10+
description: Is `standalone` or `monorepo` mode?
11+
required: true
912

1013
runs:
1114
using: composite
@@ -16,3 +19,4 @@ runs:
1619
env:
1720
TSX_TSCONFIG_PATH: .github/actions/code-pushup/tsconfig.json
1821
GH_TOKEN: ${{ inputs.token }}
22+
MODE: ${{ inputs.mode }}

.github/actions/code-pushup/src/runner.ts

Lines changed: 28 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import {
1010
type SourceFileIssue,
1111
runInCI,
1212
} from '@code-pushup/ci';
13+
import { DEFAULT_PERSIST_CONFIG } from '@code-pushup/models';
1314
import {
1415
CODE_PUSHUP_UNICODE_LOGO,
1516
logger,
@@ -86,7 +87,7 @@ function createAnnotationsFromIssues(issues: SourceFileIssue[]): void {
8687
}
8788

8889
function createGitHubApiClient(): ProviderAPIClient {
89-
const token = process.env.GH_TOKEN;
90+
const token = process.env['GH_TOKEN'];
9091

9192
if (!token) {
9293
throw new Error('No GitHub token found');
@@ -134,9 +135,32 @@ async function run(): Promise<void> {
134135
logger.setVerbose(true);
135136
}
136137

137-
const options: Options = {
138-
bin: 'npx nx code-pushup --nx-bail --',
139-
};
138+
const isMonorepo = process.env['MODE'] === 'monorepo';
139+
140+
const options: Options = isMonorepo
141+
? {
142+
jobId: 'monorepo-mode',
143+
monorepo: 'nx',
144+
nxProjectsFilter: '--with-target=code-pushup --exclude=workspace',
145+
configPatterns: {
146+
persist: {
147+
...DEFAULT_PERSIST_CONFIG,
148+
outputDir: '.code-pushup/{projectName}',
149+
},
150+
...(process.env['CP_API_KEY'] && {
151+
upload: {
152+
server: 'https://api.staging.code-pushup.dev/graphql',
153+
apiKey: process.env['CP_API_KEY'],
154+
organization: 'code-pushup',
155+
project: 'cli-{projectName}',
156+
},
157+
}),
158+
},
159+
}
160+
: {
161+
jobId: 'standalone-mode',
162+
bin: 'npx nx code-pushup --',
163+
};
140164

141165
const gitRefs = parseGitRefs();
142166

.github/workflows/code-pushup-fork.yml

Lines changed: 28 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Code PushUp - Standalone Mode (fork)
1+
name: Code PushUp (fork)
22

33
# separated from code-pushup.yml for security reasons
44
# => requires permissions to create PR comment
@@ -18,9 +18,9 @@ permissions:
1818
pull-requests: write
1919

2020
jobs:
21-
code-pushup:
21+
standalone:
2222
runs-on: ubuntu-latest
23-
name: Run Code PushUp (fork)
23+
name: Standalone mode (fork)
2424
if: github.event.pull_request.head.repo.fork
2525
steps:
2626
- name: Checkout repository
@@ -40,3 +40,28 @@ jobs:
4040
uses: ./.github/actions/code-pushup
4141
with:
4242
token: ${{ secrets.GITHUB_TOKEN }}
43+
mode: standalone
44+
45+
monorepo:
46+
runs-on: ubuntu-latest
47+
name: Monorepo mode (fork)
48+
if: github.event.pull_request.head.repo.fork
49+
steps:
50+
- name: Checkout repository
51+
uses: actions/checkout@v4
52+
with:
53+
fetch-depth: 0
54+
- name: Set up Node.js
55+
uses: actions/setup-node@v4
56+
with:
57+
node-version-file: .node-version
58+
cache: npm
59+
- name: Set base and head for Nx affected commands
60+
uses: nrwl/nx-set-shas@v4
61+
- name: Install dependencies
62+
run: npm ci
63+
- name: Run Code PushUp action
64+
uses: ./.github/actions/code-pushup
65+
with:
66+
token: ${{ secrets.GITHUB_TOKEN }}
67+
mode: monorepo

.github/workflows/code-pushup.yml

Lines changed: 31 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Code PushUp - Standalone Mode
1+
name: Code PushUp
22

33
on:
44
push:
@@ -14,9 +14,9 @@ permissions:
1414
pull-requests: write
1515

1616
jobs:
17-
code-pushup:
17+
standalone:
1818
runs-on: ubuntu-latest
19-
name: Run Code PushUp
19+
name: Standalone mode
2020
# ignore PRs from forks, handled by code-pushup-fork.yml
2121
if: ${{ !github.event.pull_request.head.repo.fork }}
2222
env:
@@ -39,3 +39,31 @@ jobs:
3939
uses: ./.github/actions/code-pushup
4040
with:
4141
token: ${{ secrets.GITHUB_TOKEN }}
42+
mode: standalone
43+
44+
monorepo:
45+
runs-on: ubuntu-latest
46+
name: Monorepo mode
47+
# ignore PRs from forks, handled by code-pushup-fork.yml
48+
if: ${{ !github.event.pull_request.head.repo.fork }}
49+
env:
50+
CP_API_KEY: ${{ secrets.CP_API_KEY }}
51+
steps:
52+
- name: Checkout repository
53+
uses: actions/checkout@v4
54+
with:
55+
fetch-depth: 0
56+
- name: Set up Node.js
57+
uses: actions/setup-node@v4
58+
with:
59+
node-version-file: .node-version
60+
cache: npm
61+
- name: Set base and head for Nx affected commands
62+
uses: nrwl/nx-set-shas@v4
63+
- name: Install dependencies
64+
run: npm ci
65+
- name: Run Code PushUp action
66+
uses: ./.github/actions/code-pushup
67+
with:
68+
token: ${{ secrets.GITHUB_TOKEN }}
69+
mode: monorepo

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,3 +56,5 @@ vite.config.*.timestamp*
5656
vitest.config.*.timestamp*
5757
.cursor/rules/nx-rules.mdc
5858
.github/instructions/nx.instructions.md
59+
60+
code-pushup.config.bundled_*.mjs

CHANGELOG.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,18 @@
1+
## 0.91.0 (2025-12-01)
2+
3+
### 🚀 Features
4+
5+
- **ci:** add jobId option to prevent conflicting PR comments ([d00606fa](https://github.com/code-pushup/cli/commit/d00606fa))
6+
- **plugin-typescript:** make init function synchronous ([62df7a67](https://github.com/code-pushup/cli/commit/62df7a67))
7+
8+
### 🩹 Fixes
9+
10+
- **cli:** handle multiple --persist.outputDir arguments ([a9ca7f94](https://github.com/code-pushup/cli/commit/a9ca7f94))
11+
12+
### ❤️ Thank You
13+
14+
- Matěj Chalk
15+
116
## 0.90.1 (2025-11-27)
217

318
### 🩹 Fixes

code-pushup.config.ts

Lines changed: 18 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -1,50 +1,27 @@
11
import 'dotenv/config';
22
import {
33
axeCoreConfig,
4-
coverageCoreConfigNx,
5-
eslintCoreConfigNx,
6-
jsDocsCoreConfig,
7-
jsPackagesCoreConfig,
8-
lighthouseCoreConfig,
9-
typescriptPluginConfig,
4+
configureCoveragePlugin,
5+
configureEslintPlugin,
6+
configureJsDocsPlugin,
7+
configureJsPackagesPlugin,
8+
configureLighthousePlugin,
9+
configureTypescriptPlugin,
10+
configureUpload,
1011
} from './code-pushup.preset.js';
11-
import type { CoreConfig } from './packages/models/src/index.js';
1212
import { mergeConfigs } from './packages/utils/src/index.js';
1313

14-
const project = process.env['NX_TASK_TARGET_PROJECT'] || 'cli-workspace';
15-
16-
const config: CoreConfig = {
17-
...(process.env['CP_API_KEY'] && {
18-
upload: {
19-
project,
20-
organization: 'code-pushup',
21-
server: 'https://api.staging.code-pushup.dev/graphql',
22-
apiKey: process.env['CP_API_KEY'],
23-
},
24-
}),
25-
plugins: [],
26-
};
14+
// TODO: replace with something meaningful, or move out of the repo
15+
const TARGET_URL =
16+
'https://github.com/code-pushup/cli?tab=readme-ov-file#code-pushup-cli/';
2717

2818
export default mergeConfigs(
29-
config,
30-
await coverageCoreConfigNx(),
31-
await jsPackagesCoreConfig(),
32-
await lighthouseCoreConfig(
33-
'https://github.com/code-pushup/cli?tab=readme-ov-file#code-pushup-cli/',
34-
),
35-
await typescriptPluginConfig({
36-
tsconfig: 'packages/cli/tsconfig.lib.json',
37-
}),
38-
await eslintCoreConfigNx(),
39-
jsDocsCoreConfig([
40-
'packages/**/src/**/*.ts',
41-
'!packages/**/node_modules',
42-
'!packages/**/{mocks,mock}',
43-
'!**/*.{spec,test}.ts',
44-
'!**/implementation/**',
45-
'!**/internal/**',
46-
]),
47-
axeCoreConfig(
48-
'https://github.com/code-pushup/cli?tab=readme-ov-file#code-pushup-cli/',
49-
),
19+
configureUpload(),
20+
await configureEslintPlugin(),
21+
await configureCoveragePlugin(),
22+
await configureJsPackagesPlugin(),
23+
configureTypescriptPlugin(),
24+
configureJsDocsPlugin(),
25+
await configureLighthousePlugin(TARGET_URL),
26+
axeCoreConfig(TARGET_URL),
5027
);

0 commit comments

Comments
 (0)