Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
130 commits
Select commit Hold shift + click to select a range
dae22a9
chore: add local eslint targets
BioPhoton Jul 23, 2025
1c61157
chore: add adjust global cp logic
BioPhoton Jul 23, 2025
52d0309
Merge branch 'main' into cp-targets
BioPhoton Aug 5, 2025
e81aef0
core: add code-pushup.config.ts projects
BioPhoton Aug 6, 2025
1a320c7
fix: revert changes
BioPhoton Aug 6, 2025
dfc1171
fix: revert changes
BioPhoton Aug 6, 2025
ab75868
fix: remove tests
BioPhoton Aug 6, 2025
b952966
Merge remote-tracking branch 'origin/main' into cp-targets
BioPhoton Aug 6, 2025
d72a81d
core: adjust gitignore
BioPhoton Aug 6, 2025
0fb0058
core: fix main cp config
BioPhoton Aug 6, 2025
e2cfbe8
fix: remove tests
BioPhoton Aug 6, 2025
973d1e1
fix: avoid cyclic
BioPhoton Aug 6, 2025
14d438a
fix: wip
BioPhoton Aug 6, 2025
0aa32b1
fix: wip
BioPhoton Aug 6, 2025
0e77081
fix: wip 2
BioPhoton Aug 6, 2025
7e722f0
fix: wip 3
BioPhoton Aug 6, 2025
34909f9
fix: add task deps to cp targets
BioPhoton Aug 6, 2025
ec24332
fix: revert
BioPhoton Aug 7, 2025
0b8f745
Merge remote-tracking branch 'origin/main' into cp-targets
BioPhoton Aug 11, 2025
8dc3fba
fix: adjust nx.json
BioPhoton Aug 12, 2025
da5de15
chore: add code-pushup to testing targets
BioPhoton Aug 12, 2025
07ace2f
chore: update code-pushup targets
BioPhoton Aug 12, 2025
880d202
Merge branch 'main' into cp-targets
BioPhoton Aug 12, 2025
e72b00f
chore: wip caching
BioPhoton Aug 12, 2025
b17323f
chore: wip caching cp configs
BioPhoton Aug 12, 2025
5f438c5
chore: wip caching cp configs 2
Aug 12, 2025
650d300
fix: fix lint issues
Aug 12, 2025
0a6467e
fix: revert changed
Aug 12, 2025
c770455
fix: wip
Aug 12, 2025
21a4f04
chore: add new cp action
Aug 12, 2025
4ee6001
chore: wip gh action 2
Aug 12, 2025
3261c0e
chore: refactor unit and int test targets
Aug 12, 2025
ad988ab
chore: refactor unit and int test targets 2
Aug 12, 2025
709bb88
chore: add env var helper
Aug 12, 2025
0958ad0
chore: add default targets
Aug 12, 2025
30fa5b3
chore: adjust gh actions
Aug 12, 2025
822a323
chore: add coverage to existing test targets
Aug 12, 2025
3166645
chore: refine e2e and int test targets
Aug 12, 2025
28213f0
chore: refine preset
Aug 12, 2025
139b941
chore: refine targets
Aug 13, 2025
454f986
chore: refine targets 2
Aug 13, 2025
55bc628
chore: refine targets 3
Aug 13, 2025
622a5ac
chore: refine targets 4
Aug 13, 2025
503be8f
chore: refine targets 5
Aug 13, 2025
503b076
chore: refine targets 6
Aug 13, 2025
1d5bb72
chore: refine gh action
Aug 13, 2025
5c24708
chore: refine preset
Aug 13, 2025
3541c80
chore: refine preset 2
Aug 13, 2025
52612d7
fix: avoid graph generation if possible
Aug 13, 2025
a9c3afa
fix: imports
Aug 13, 2025
9fd1985
Merge branch 'chore/refactor-targets' into cp-targets
Aug 13, 2025
6234d00
merge
Aug 13, 2025
444bf05
Merge branch 'main' into chore/refactor-targets
Aug 13, 2025
61eb942
chore: adjust int-test targets
Aug 13, 2025
5b75d06
chore: adjust int-test target
Aug 13, 2025
867b3c6
chore: remove int-target as no int tests available
Aug 13, 2025
88e43d5
chore: add passWithNoTests:true to all test configs
Aug 13, 2025
bdb7f02
chore: remove unused int test config from models and plugin-lighthouse
Aug 13, 2025
5dba960
Merge branch 'main' into cp-targets
Aug 13, 2025
ba74094
Merge branch 'chore/refactor-targets' into cp-targets
Aug 13, 2025
9565128
chore: adjust preset
Aug 13, 2025
82ad7fb
Merge branch 'chore/refactor-targets' into cp-targets
Aug 13, 2025
b0df7cd
chore: adjust preset
Aug 13, 2025
be95512
chore: remove js-package config from all but root
Aug 13, 2025
8e66b4f
chore: adjust old targets
Aug 13, 2025
ac1d5c8
chore: adjust gh actions
Aug 13, 2025
541ed9a
wip
Aug 13, 2025
1c8b719
fix: make all targets pass, title GH actions
Aug 14, 2025
f964825
wip gh action
Aug 14, 2025
a9b0b6c
fix: adjust action logic
Aug 14, 2025
62d0a68
fix: adjust action logic 2
Aug 14, 2025
33ca073
fix: adjust action logic 3
Aug 14, 2025
26068d4
Merge branch 'main' into add-plugin-targets
Aug 14, 2025
d9c0411
Merge branch 'main' into add-plugin-targets
Aug 14, 2025
aa35b3f
Merge branch 'main' into cp-targets
Aug 14, 2025
0bcba8f
fix: revert code
BioPhoton Aug 16, 2025
53cb658
revert
BioPhoton Aug 16, 2025
f18e6e5
chore: adjust parallel in gh action
BioPhoton Aug 16, 2025
7d2fbb3
chore: adjust nx caching
BioPhoton Aug 16, 2025
18707a6
chore: adjust project graph creation
BioPhoton Aug 16, 2025
2637c38
chore: adjust project graph creation 2
BioPhoton Aug 16, 2025
da01d55
chore: adjust project graph creation 3
BioPhoton Aug 16, 2025
05891ea
chore: adjust project graph creation 4
BioPhoton Aug 16, 2025
32499ab
chore: adjust project graph creation 4
BioPhoton Aug 16, 2025
c9c2c5c
chore: adjust caching
BioPhoton Aug 16, 2025
5e2a859
fix: adjust path helper
BioPhoton Aug 16, 2025
3cc8269
fix: adjust default inputs
BioPhoton Aug 16, 2025
df60ab7
fix: lint issues
BioPhoton Aug 16, 2025
dd9e314
fix: update nx.json
BioPhoton Aug 16, 2025
b9b37bf
fix: update nx.json 2
BioPhoton Aug 16, 2025
0ab3b50
fix: use "*" matcher for dependsOn tasks
BioPhoton Aug 18, 2025
3cdb563
Update nx.json
BioPhoton Aug 19, 2025
787fbf0
fix: add fetch 0
BioPhoton Aug 19, 2025
51fc913
fix: rename root project
BioPhoton Aug 19, 2025
9794a7e
Merge branch 'main' into add-plugin-targets
BioPhoton Aug 19, 2025
458d500
chore: adjust caching settings
BioPhoton Aug 19, 2025
13d03b4
chore: fix caching settings
BioPhoton Aug 19, 2025
59f9ded
chore: reduce args
BioPhoton Aug 19, 2025
f7005d4
chore: rename GH actions
BioPhoton Aug 19, 2025
9192a60
chore: reduce target options
BioPhoton Aug 20, 2025
a051e40
chore: test bail
BioPhoton Aug 20, 2025
61b4d79
Update nx.json
BioPhoton Aug 20, 2025
84bb7e3
fix: fix format
BioPhoton Aug 20, 2025
d6cc8b3
fix: adjust format
BioPhoton Aug 20, 2025
8f6c5aa
Update .github/workflows/code-pushup-fork.yml
BioPhoton Aug 20, 2025
0701f3b
Update .github/workflows/code-pushup.yml
BioPhoton Aug 20, 2025
95ac32f
chore: adjust GH action for CP
BioPhoton Aug 20, 2025
5dae379
chore: adjust GH action for CP 2
BioPhoton Aug 20, 2025
e7a50bd
chore: add nxCloudId
BioPhoton Aug 20, 2025
23d9f71
fix: adjust GH actions
BioPhoton Aug 20, 2025
7c792f9
chore: move config into targets
BioPhoton Aug 20, 2025
d114076
Update nx.json
BioPhoton Aug 21, 2025
84744b2
Merge remote-tracking branch 'origin/main' into add-plugin-targets
BioPhoton Aug 21, 2025
cfaedf8
fix: remove cloud id
BioPhoton Aug 21, 2025
2733442
fix: wip
BioPhoton Aug 21, 2025
c176d37
chore: cache js-packages and invalidate daily
BioPhoton Aug 21, 2025
e748af9
chore: update inputs
BioPhoton Aug 21, 2025
828d8fc
fix: test caching issue
BioPhoton Aug 21, 2025
bd4fb1f
fix: build step
BioPhoton Aug 22, 2025
0892245
fix: add required options to build target
BioPhoton Aug 22, 2025
858997f
wip
BioPhoton Aug 22, 2025
45c9bc4
Merge remote-tracking branch 'refs/remotes/origin/main' into add-plug…
BioPhoton Aug 22, 2025
8ffbd67
refactor: evert changes
BioPhoton Aug 22, 2025
6075043
refactor: keep vitest target empty in nx.json to pass e2e
BioPhoton Aug 22, 2025
ff016c4
refactor: make executor defaults meaningful
BioPhoton Aug 22, 2025
0589e60
Merge remote-tracking branch 'origin/main' into cp-targets
BioPhoton Aug 22, 2025
c71ccf8
refactor: merge main
BioPhoton Aug 22, 2025
fbaf009
Merge branch 'add-plugin-targets' into cp-targets
BioPhoton Aug 22, 2025
940afea
Merge remote-tracking branch 'origin/main' into cp-targets
BioPhoton Aug 25, 2025
50f2ca4
Merge branch 'main' into cp-targets
BioPhoton Aug 27, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Code PushUp (fork)
name: Code PushUp - Standalone Mode (fork)

# separated from code-pushup.yml for security reasons
# => requires permissions to create PR comment
Expand All @@ -20,19 +20,23 @@ permissions:
jobs:
code-pushup:
runs-on: ubuntu-latest
name: Code PushUp
name: Run Code PushUp (fork)
if: github.event.pull_request.head.repo.fork
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version-file: .nvmrc
cache: npm
- name: Set base and head for Nx affected commands
uses: nrwl/nx-set-shas@v4
- name: Install dependencies
run: npm ci
- name: Run Code PushUp action
uses: code-pushup/github-action@v0
with:
bin: npx nx code-pushup --
bin: npx nx code-pushup --nx-bail --
44 changes: 44 additions & 0 deletions .github/workflows/code-pushup-fork.monorepo.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
name: Code PushUp - Monorepo/Cache (fork)

# separated from code-pushup.yml for security reasons
# => requires permissions to create PR comment
# => for PRs from forks, needs to run on `pull_request_target`, not `pull_request`
# => `pull_request_target` is a security risk when secrets are being used
# => secrets needed for code-pushup upload
# => code-pushup for forks runs in separate workflow with no secrets access

on:
pull_request_target:
branches: [main]

env:
NX_NON_NATIVE_HASHER: true

permissions:
pull-requests: write

jobs:
code-pushup:
runs-on: ubuntu-latest
name: Run monorepo layout with caching
if: github.event.pull_request.head.repo.fork
steps:
- name: Checkout PR head
uses: actions/checkout@v4
with:
repository: ${{ github.event.pull_request.head.repo.full_name }}
ref: ${{ github.event.pull_request.head.ref }}
fetch-depth: 0
- name: Derive Nx SHAs
uses: nrwl/nx-set-shas@v4
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version-file: .nvmrc
cache: npm
- name: Install dependencies
run: npm ci
- name: Run Code PushUp action
uses: code-pushup/github-action@v0
with:
bin: npx nx affected -t code-pushup --
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Code PushUp
name: Code PushUp - Standalone Mode

on:
push:
Expand All @@ -16,7 +16,7 @@ permissions:
jobs:
code-pushup:
runs-on: ubuntu-latest
name: Code PushUp
name: Run Code PushUp
# ignore PRs from forks, handled by code-pushup-fork.yml
if: ${{ !github.event.pull_request.head.repo.fork }}
env:
Expand All @@ -27,14 +27,18 @@ jobs:
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version-file: .nvmrc
cache: npm
- name: Set base and head for Nx affected commands
uses: nrwl/nx-set-shas@v4
- name: Install dependencies
run: npm ci
- name: Run Code PushUp action
uses: code-pushup/github-action@v0
with:
bin: npx nx code-pushup --
bin: npx nx code-pushup --nx-bail --
45 changes: 45 additions & 0 deletions .github/workflows/code-pushup.monorepo.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
name: Code PushUp - Monorepo/Cache

on:
push:
branches: [main]
pull_request:
branches: [main]

env:
NX_NON_NATIVE_HASHER: true

permissions:
pull-requests: write

jobs:
code-pushup:
runs-on: ubuntu-latest
name: Run monorepo layout with caching
# ignore PRs from forks, handled by code-pushup-fork.yml
if: ${{ !github.event.pull_request.head.repo.fork }}
env:
CP_SERVER: ${{ secrets.CP_SERVER }}
CP_API_KEY: ${{ secrets.CP_API_KEY }}
CP_ORGANIZATION: code-pushup
CP_PROJECT: cli
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Derive Nx SHAs
uses: nrwl/nx-set-shas@v4
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version-file: .nvmrc
cache: npm
- name: Install dependencies
run: npm ci
- name: Run Code PushUp action
uses: code-pushup/github-action@v0
with:
bin: npx nx affected -t code-pushup --
monorepo: nx
parallel: 3
3 changes: 3 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,6 @@
/coverage
/.nx
__snapshots__

/.nx/cache
/.nx/workspace-data
35 changes: 35 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,41 @@ You can control the execution of long-running tests over the `INCLUDE_SLOW_TESTS
To change this setup, open (or create) the `.env` file in the root folder.
Edit or add the environment variable there as follows: `INCLUDE_SLOW_TESTS=true`.

### Testing with pkg-new

You can test the CLI using published packages from pull requests via [pkg-new](https://pkg.pr.new/). This is useful for testing changes before they are merged.

To test a specific PR (replace `<PR_NUMBER>` with the actual PR number):

```bash
# Install required dependencies first
npm install \
https://pkg.pr.new/code-pushup/cli/@code-pushup/utils@<PR_NUMBER> \
https://pkg.pr.new/code-pushup/cli/@code-pushup/models@<PR_NUMBER> \
https://pkg.pr.new/code-pushup/cli/@code-pushup/core@<PR_NUMBER> \
https://pkg.pr.new/code-pushup/cli/@code-pushup/cli@<PR_NUMBER>
```

Update nx.json to use pkg-new:

```jsonc
{
"targetDefaults": {
"code-pushup": {
"executor": "nx:run-commands",
"options": {
"command": "npx https://pkg.pr.new/code-pushup/cli/@code-pushup/cli@<PR_NUMBER>", // instead of "command": "node packages/cli/src/index.ts"
"args": [
// ...
],
},
},
},
}
```

**Note:** The `@code-pushup/portal-client` package may not be available via pkg-new, but it's an optional peer dependency and won't affect collect functionality. Only the upload command is not working.

## Git

Commit messages must follow [conventional commits](https://conventionalcommits.org/) format.
Expand Down
46 changes: 46 additions & 0 deletions code-pushup.central.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
import 'dotenv/config';
import {
coverageCoreConfigNx,
eslintCoreConfigNx,
jsDocsCoreConfig,
jsPackagesCoreConfig,
lighthouseCoreConfig,
loadEnv,
typescriptPluginConfig,
} from './code-pushup.preset.js';
import type { CoreConfig } from './packages/models/src/index.js';
import { mergeConfigs } from './packages/utils/src/index.js';

const config: CoreConfig = {
...(await loadEnv()),
plugins: [],
};

const merged = mergeConfigs(
config,
await coverageCoreConfigNx('cli'),
await jsPackagesCoreConfig(),
await lighthouseCoreConfig(
'https://github.com/code-pushup/cli?tab=readme-ov-file#code-pushup-cli/',
),
await typescriptPluginConfig({
tsconfig: 'packages/cli/tsconfig.lib.json',
}),

await eslintCoreConfigNx(),
jsDocsCoreConfig([
'packages/**/src/**/*.ts',
'!packages/**/node_modules',
'!packages/**/{mocks,mock}',
'!**/*.{spec,test}.ts',
'!**/implementation/**',
'!**/internal/**',
]),
);

export default {
...merged,
categories: merged.categories?.filter(
c => c.slug !== 'bug-prevention' && c.slug !== 'code-style',
),
} satisfies CoreConfig;
38 changes: 6 additions & 32 deletions code-pushup.config.ts
Original file line number Diff line number Diff line change
@@ -1,55 +1,29 @@
import 'dotenv/config';
import { z } from 'zod';
import {
coverageCoreConfigNx,
eslintCoreConfigNx,
jsDocsCoreConfig,
jsPackagesCoreConfig,
lighthouseCoreConfig,
typescriptPluginConfig,
} from './code-pushup.preset.js';
import type { CoreConfig } from './packages/models/src/index.js';
import { mergeConfigs } from './packages/utils/src/index.js';

// load upload configuration from environment
const envSchema = z.object({
CP_SERVER: z.string().url(),
CP_API_KEY: z.string().min(1),
CP_ORGANIZATION: z.string().min(1),
CP_PROJECT: z.string().min(1),
});
const { data: env } = await envSchema.safeParseAsync(process.env);
const project = process.env['NX_TASK_TARGET_PROJECT'] || 'cli-workspace';

const config: CoreConfig = {
...(env && {
...(process.env['CP_API_KEY'] && {
upload: {
server: env.CP_SERVER,
apiKey: env.CP_API_KEY,
organization: env.CP_ORGANIZATION,
project: 'cli-workspace',
project,
organization: 'code-pushup',
server: 'https://api.staging.code-pushup.dev/graphql',
apiKey: process.env['CP_API_KEY'],
},
}),

plugins: [],
};

export default mergeConfigs(
config,
await coverageCoreConfigNx(),
await jsPackagesCoreConfig(),
await lighthouseCoreConfig(
'https://github.com/code-pushup/cli?tab=readme-ov-file#code-pushup-cli/',
),
await typescriptPluginConfig({
tsconfig: 'packages/cli/tsconfig.lib.json',
}),
await eslintCoreConfigNx(),
jsDocsCoreConfig([
'packages/**/src/**/*.ts',
'!packages/**/node_modules',
'!packages/**/{mocks,mock}',
'!**/*.{spec,test}.ts',
'!**/implementation/**',
'!**/internal/**',
]),
);
Loading
Loading