Skip to content

Commit 694dafa

Browse files
committed
feat(ci): disable nx/turbo cache for non-autorun code-pushup commands
1 parent a277356 commit 694dafa

File tree

7 files changed

+41
-16
lines changed

7 files changed

+41
-16
lines changed

packages/ci/src/lib/cli/context.unit.test.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,12 @@ describe('createCommandContext', () => {
1212
directory: '/test',
1313
logger: console,
1414
monorepo: false,
15+
parallel: false,
1516
nxProjectsFilter: '--with-target={task}',
1617
projects: null,
1718
silent: false,
1819
task: 'code-pushup',
20+
skipComment: false,
1921
},
2022
null,
2123
),
@@ -38,10 +40,12 @@ describe('createCommandContext', () => {
3840
directory: '/test',
3941
logger: console,
4042
monorepo: false,
43+
parallel: false,
4144
nxProjectsFilter: '--with-target={task}',
4245
projects: null,
4346
silent: false,
4447
task: 'code-pushup',
48+
skipComment: false,
4549
},
4650
{
4751
name: 'ui',

packages/ci/src/lib/monorepo/handlers/nx.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ export const nxHandler: MonorepoToolHandler = {
4343
const projects = parseProjects(stdout);
4444
return projects.toSorted().map(project => ({
4545
name: project,
46-
bin: `npx nx run ${project}:${options.task} --`,
46+
bin: `npx nx run ${project}:${options.task} --skip-nx-cache --`,
4747
}));
4848
},
4949

packages/ci/src/lib/monorepo/handlers/nx.unit.test.ts

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -56,8 +56,14 @@ describe('nxHandler', () => {
5656

5757
it('should list projects from `nx show projects`', async () => {
5858
await expect(nxHandler.listProjects(options)).resolves.toEqual([
59-
{ name: 'backend', bin: 'npx nx run backend:code-pushup --' },
60-
{ name: 'frontend', bin: 'npx nx run frontend:code-pushup --' },
59+
{
60+
name: 'backend',
61+
bin: 'npx nx run backend:code-pushup --skip-nx-cache --',
62+
},
63+
{
64+
name: 'frontend',
65+
bin: 'npx nx run frontend:code-pushup --skip-nx-cache --',
66+
},
6167
] satisfies ProjectConfig[]);
6268
});
6369

@@ -119,8 +125,14 @@ describe('nxHandler', () => {
119125
describe('createRunManyCommand', () => {
120126
const projects: MonorepoHandlerProjectsContext = {
121127
all: [
122-
{ name: 'backend', bin: 'npx nx run backend:code-pushup --' },
123-
{ name: 'frontend', bin: 'npx nx run frontend:code-pushup --' },
128+
{
129+
name: 'backend',
130+
bin: 'npx nx run backend:code-pushup --skip-nx-cache --',
131+
},
132+
{
133+
name: 'frontend',
134+
bin: 'npx nx run frontend:code-pushup --skip-nx-cache --',
135+
},
124136
],
125137
};
126138

packages/ci/src/lib/monorepo/handlers/turbo.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ export const turboHandler: MonorepoToolHandler = {
3232
.map(({ name, directory }) => ({
3333
name,
3434
directory,
35-
bin: `npx turbo run ${options.task} --`,
35+
bin: `npx turbo run ${options.task} --no-cache --force --`,
3636
}));
3737
}
3838
}

packages/ci/src/lib/monorepo/handlers/turbo.unit.test.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -137,12 +137,12 @@ describe('turboHandler', () => {
137137
{
138138
name: '@example/cli',
139139
directory: path.join(MEMFS_VOLUME, 'packages', 'cli'),
140-
bin: 'npx turbo run code-pushup --',
140+
bin: 'npx turbo run code-pushup --no-cache --force --',
141141
},
142142
{
143143
name: '@example/core',
144144
directory: path.join(MEMFS_VOLUME, 'packages', 'core'),
145-
bin: 'npx turbo run code-pushup --',
145+
bin: 'npx turbo run code-pushup --no-cache --force --',
146146
},
147147
] satisfies ProjectConfig[]);
148148
},
@@ -171,16 +171,19 @@ describe('turboHandler', () => {
171171
name: 'api',
172172
directory: path.join(MEMFS_VOLUME, 'api'),
173173
bin: 'npx turbo run code-pushup --',
174+
binUncached: 'npx turbo run code-pushup --no-cache --force --',
174175
},
175176
{
176177
name: 'cms',
177178
directory: path.join(MEMFS_VOLUME, 'cms'),
178179
bin: 'npx turbo run code-pushup --',
180+
binUncached: 'npx turbo run code-pushup --no-cache --force --',
179181
},
180182
{
181183
name: 'web',
182184
directory: path.join(MEMFS_VOLUME, 'web'),
183185
bin: 'npx turbo run code-pushup --',
186+
binUncached: 'npx turbo run code-pushup --no-cache --force --',
184187
},
185188
],
186189
};

packages/ci/src/lib/monorepo/list-projects.unit.test.ts

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,14 @@ describe('listMonorepoProjects', () => {
5858
await expect(listMonorepoProjects(MONOREPO_SETTINGS)).resolves.toEqual({
5959
tool: 'nx',
6060
projects: [
61-
{ name: 'backend', bin: 'npx nx run backend:code-pushup --' },
62-
{ name: 'frontend', bin: 'npx nx run frontend:code-pushup --' },
61+
{
62+
name: 'backend',
63+
bin: 'npx nx run backend:code-pushup --skip-nx-cache --',
64+
},
65+
{
66+
name: 'frontend',
67+
bin: 'npx nx run frontend:code-pushup --skip-nx-cache --',
68+
},
6369
],
6470
runManyCommand: expect.any(Function),
6571
} satisfies MonorepoProjects);
@@ -120,22 +126,22 @@ describe('listMonorepoProjects', () => {
120126
{
121127
name: 'api',
122128
directory: path.join(MEMFS_VOLUME, 'backend', 'api'),
123-
bin: 'npx turbo run code-pushup --',
129+
bin: 'npx turbo run code-pushup --no-cache --force --',
124130
},
125131
{
126132
name: 'auth',
127133
directory: path.join(MEMFS_VOLUME, 'backend', 'auth'),
128-
bin: 'npx turbo run code-pushup --',
134+
bin: 'npx turbo run code-pushup --no-cache --force --',
129135
},
130136
{
131137
name: 'cms',
132138
directory: path.join(MEMFS_VOLUME, 'frontend', 'cms'),
133-
bin: 'npx turbo run code-pushup --',
139+
bin: 'npx turbo run code-pushup --no-cache --force --',
134140
},
135141
{
136142
name: 'web',
137143
directory: path.join(MEMFS_VOLUME, 'frontend', 'web'),
138-
bin: 'npx turbo run code-pushup --',
144+
bin: 'npx turbo run code-pushup --no-cache --force --',
139145
},
140146
],
141147
runManyCommand: expect.any(Function),

packages/ci/src/lib/run.integration.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -455,15 +455,15 @@ describe('runInCI', () => {
455455
name: 'Nx',
456456
tool: 'nx',
457457
run: expect.stringMatching(
458-
/^npx nx run (cli|core|utils):code-pushup --$/,
458+
/^npx nx run (cli|core|utils):code-pushup --skip-nx-cache --$/,
459459
),
460460
runMany:
461461
'npx nx run-many --targets=code-pushup --parallel=false --projects=cli,core,utils --',
462462
},
463463
{
464464
name: 'Turborepo',
465465
tool: 'turbo',
466-
run: 'npx turbo run code-pushup --',
466+
run: 'npx turbo run code-pushup --no-cache --force --',
467467
runMany: 'npx turbo run code-pushup --concurrency=1 --',
468468
},
469469
{

0 commit comments

Comments
 (0)