Skip to content

Commit 6ff3f55

Browse files
author
Michael Hladky
committed
Merge branch 'main' into use-cp-nx-plugin
# Conflicts: # e2e/nx-plugin-e2e/tests/plugin-create-nodes.e2e.test.ts # packages/nx-plugin/src/executors/cli/executor.int.test.ts # packages/nx-plugin/src/executors/cli/executor.unit.test.ts # packages/utils/src/index.ts # packages/utils/src/lib/logger.ts # packages/utils/src/lib/transform.unit.test.ts
2 parents 3bc16a9 + a863abb commit 6ff3f55

File tree

33 files changed

+416
-223
lines changed

33 files changed

+416
-223
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,6 @@ runs:
1717
run: npx tsx .github/actions/code-pushup/src/runner.ts
1818
shell: bash
1919
env:
20-
TSX_TSCONFIG_PATH: .github/actions/code-pushup/tsconfig.json
20+
TSX_TSCONFIG_PATH: ${{ github.workspace }}/.github/actions/code-pushup/tsconfig.json
2121
GH_TOKEN: ${{ inputs.token }}
2222
MODE: ${{ inputs.mode }}

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

Lines changed: 37 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -129,42 +129,51 @@ function createGitHubApiClient(): ProviderAPIClient {
129129
};
130130
}
131131

132+
function setupOptions(): Options {
133+
const isMonorepo = process.env['MODE'] === 'monorepo';
134+
135+
if (isMonorepo) {
136+
return {
137+
jobId: 'monorepo-mode',
138+
monorepo: 'nx',
139+
nxProjectsFilter: '--with-target=code-pushup --exclude=workspace',
140+
configPatterns: {
141+
persist: {
142+
...DEFAULT_PERSIST_CONFIG,
143+
outputDir: '.code-pushup/{projectName}',
144+
},
145+
...(process.env['CP_API_KEY'] && {
146+
upload: {
147+
server: 'https://api.staging.code-pushup.dev/graphql',
148+
apiKey: process.env['CP_API_KEY'],
149+
organization: 'code-pushup',
150+
project: 'cli-{projectName}',
151+
},
152+
}),
153+
},
154+
};
155+
}
156+
157+
// tsx importer need to resolve plugin runner scripts
158+
// eslint-disable-next-line functional/immutable-data
159+
process.env['NODE_OPTIONS'] = '--import=tsx';
160+
161+
return {
162+
jobId: 'standalone-mode',
163+
// run without Nx to demonstrate native GitHub Actions log groups
164+
bin: 'node packages/cli/src/index.ts',
165+
};
166+
}
167+
132168
async function run(): Promise<void> {
133169
try {
134170
if (core.isDebug()) {
135171
logger.setVerbose(true);
136172
}
137173

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-
};
164-
165174
const gitRefs = parseGitRefs();
166-
167175
const apiClient = createGitHubApiClient();
176+
const options = setupOptions();
168177

169178
const result = await runInCI(gitRefs, apiClient, options);
170179

CHANGELOG.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,14 @@
1+
## 0.92.1 (2025-12-03)
2+
3+
### 🩹 Fixes
4+
5+
- **utils:** prevent nested github actions log groups when run within nx target ([cb9ffd52](https://github.com/code-pushup/cli/commit/cb9ffd52))
6+
- **utils:** fix long word wrapping with ansis styles in tables ([f20b3b87](https://github.com/code-pushup/cli/commit/f20b3b87))
7+
8+
### ❤️ Thank You
9+
10+
- Matěj Chalk
11+
112
## 0.92.0 (2025-12-02)
213

314
### 🚀 Features

e2e/nx-plugin-e2e/tests/executor-cli.e2e.test.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -199,6 +199,7 @@ describe('executor command', () => {
199199
`${project}:code-pushup`,
200200
'collect',
201201
'--persist.filename=terminal-report',
202+
'--verbose',
202203
],
203204
cwd,
204205
});

e2e/nx-plugin-e2e/tests/plugin-create-nodes.e2e.test.ts

Lines changed: 5 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@ describe('nx-plugin', () => {
2929
TEST_OUTPUT_DIR,
3030
'plugin-create-nodes',
3131
);
32-
const PACKAGE_NAME = '@code-pushup/nx-plugin';
3332

3433
beforeEach(async () => {
3534
tree = await generateWorkspaceAndProject(project);
@@ -104,29 +103,6 @@ describe('nx-plugin', () => {
104103
});
105104
});
106105

107-
it('should consider plugin option bin in configuration target', async () => {
108-
const cwd = path.join(testFileDir, 'configuration-option-bin');
109-
registerPluginInWorkspace(tree, {
110-
plugin: '@code-pushup/nx-plugin',
111-
options: {
112-
bin: 'XYZ',
113-
},
114-
});
115-
await materializeTree(tree, cwd);
116-
117-
const { code, projectJson } = await nxShowProjectJson(cwd, project);
118-
119-
expect(code).toBe(0);
120-
121-
expect(projectJson.targets).toStrictEqual({
122-
'code-pushup--configuration': expect.objectContaining({
123-
options: {
124-
command: `nx g ${PACKAGE_NAME}:configuration --project="${project}"`,
125-
},
126-
}),
127-
});
128-
});
129-
130106
it('should NOT add config targets dynamically if the project is configured', async () => {
131107
const cwd = path.join(testFileDir, 'configuration-already-configured');
132108
registerPluginInWorkspace(tree, '@code-pushup/nx-plugin');
@@ -197,12 +173,14 @@ describe('nx-plugin', () => {
197173
});
198174

199175
const cleanStdout = removeColorCodes(stdout);
176+
200177
// Nx command
201-
expect(cleanStdout).toContain('nx run my-lib:code-pushup');
202-
// Run CLI executor - check for DryRun execution message
178+
expect(cleanStdout).toContain('nx run my-lib:code-pushup --dryRun');
179+
// Run CLI executor
203180
expect(cleanStdout).toContain('DryRun execution of:');
204181
expect(cleanStdout).toContain('npx @code-pushup/cli');
205-
expect(cleanStdout).toContain('--dryRun --verbose');
182+
expect(cleanStdout).not.toContain('--verbose');
183+
expect(cleanStdout).toContain('CP_VERBOSE="true"');
206184
});
207185

208186
it('should consider plugin option bin in executor target', async () => {

nx.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@
7474
},
7575
"unit-test": {
7676
"cache": true,
77-
"inputs": ["default", "test-vitest-inputs"],
77+
"inputs": ["default", "^production", "test-vitest-inputs"],
7878
"outputs": [
7979
"{workspaceRoot}/coverage/{projectName}/unit-tests/lcov.info"
8080
],
@@ -88,7 +88,7 @@
8888
},
8989
"int-test": {
9090
"cache": true,
91-
"inputs": ["default", "test-vitest-inputs"],
91+
"inputs": ["default", "^production", "test-vitest-inputs"],
9292
"outputs": ["{workspaceRoot}/coverage/{projectName}/int-tests/lcov.info"],
9393
"executor": "@nx/vite:test",
9494
"options": {

packages/ci/package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@code-pushup/ci",
3-
"version": "0.92.0",
3+
"version": "0.92.1",
44
"description": "CI automation logic for Code PushUp (provider-agnostic)",
55
"license": "MIT",
66
"homepage": "https://github.com/code-pushup/cli/tree/main/packages/ci#readme",
@@ -26,9 +26,9 @@
2626
},
2727
"type": "module",
2828
"dependencies": {
29-
"@code-pushup/models": "0.92.0",
29+
"@code-pushup/models": "0.92.1",
3030
"@code-pushup/portal-client": "^0.16.0",
31-
"@code-pushup/utils": "0.92.0",
31+
"@code-pushup/utils": "0.92.1",
3232
"ansis": "^3.3.2",
3333
"glob": "^11.0.1",
3434
"simple-git": "^3.20.0",

packages/cli/package.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@code-pushup/cli",
3-
"version": "0.92.0",
3+
"version": "0.92.1",
44
"license": "MIT",
55
"description": "A CLI to run all kinds of code quality measurements to align your team with company goals",
66
"homepage": "https://code-pushup.dev",
@@ -45,9 +45,9 @@
4545
"node": ">=20"
4646
},
4747
"dependencies": {
48-
"@code-pushup/models": "0.92.0",
49-
"@code-pushup/core": "0.92.0",
50-
"@code-pushup/utils": "0.92.0",
48+
"@code-pushup/models": "0.92.1",
49+
"@code-pushup/core": "0.92.1",
50+
"@code-pushup/utils": "0.92.1",
5151
"yargs": "^17.7.2",
5252
"ansis": "^3.3.0",
5353
"simple-git": "^3.20.0"

packages/core/package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@code-pushup/core",
3-
"version": "0.92.0",
3+
"version": "0.92.1",
44
"license": "MIT",
55
"description": "Core business logic for the used by the Code PushUp CLI",
66
"homepage": "https://github.com/code-pushup/cli/tree/main/packages/core#readme",
@@ -39,8 +39,8 @@
3939
},
4040
"type": "module",
4141
"dependencies": {
42-
"@code-pushup/models": "0.92.0",
43-
"@code-pushup/utils": "0.92.0",
42+
"@code-pushup/models": "0.92.1",
43+
"@code-pushup/utils": "0.92.1",
4444
"ansis": "^3.3.0"
4545
},
4646
"peerDependencies": {

packages/create-cli/package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@code-pushup/create-cli",
3-
"version": "0.92.0",
3+
"version": "0.92.1",
44
"license": "MIT",
55
"bin": "index.js",
66
"homepage": "https://github.com/code-pushup/cli/tree/main/packages/create-cli#readme",
@@ -26,8 +26,8 @@
2626
},
2727
"type": "module",
2828
"dependencies": {
29-
"@code-pushup/nx-plugin": "0.92.0",
30-
"@code-pushup/utils": "0.92.0"
29+
"@code-pushup/nx-plugin": "0.92.1",
30+
"@code-pushup/utils": "0.92.1"
3131
},
3232
"files": [
3333
"src",

0 commit comments

Comments
 (0)