Feat: skip building actors if only tests changed#33
Feat: skip building actors if only tests changed#33kazadoiyul wants to merge 2 commits intopretify-build-logsfrom
Conversation
| } | ||
| } | ||
|
|
||
| async getDefaultBuilt() { |
There was a problem hiding this comment.
I think this isn't needed...you can extend getDefaultVersionAndTag to return buildId:
const defaultBuildId = actorInfo.taggedBuilds![defaultBuildTag].buildId!;| setCwd, | ||
| } from './utils.js'; | ||
| import { runBuilds } from './build.js'; | ||
| import {getAllDefaultBuilds, runBuilds} from './build.js'; |
There was a problem hiding this comment.
| import {getAllDefaultBuilds, runBuilds} from './build.js'; | |
| import { getAllDefaultBuilds, runBuilds } from './build.js'; |
| return IGNORED_TOP_LEVEL_FILES.some((ignoredFile) => sanitizedLowercaseFilePath.startsWith(ignoredFile)); | ||
| }; | ||
|
|
||
| const isIgnoredTestFile = (lowercaseFilePath: string) => { |
There was a problem hiding this comment.
this should check if the lowercaseFilePath is a platform test, you can do it like this:
return lowercaseFilePath.match(/^(code\/)?test\/platform\//);I'd also rename it to isPlatformTestFile
| return; | ||
| } | ||
|
|
||
| // add a build entry even if no build was triggered to run the tests on all actors |
There was a problem hiding this comment.
this will run always the tests for the actors that we're not building, no? My idea was to run them only if there is a changed in platform tests (in test/platfrom).
What I would do is to have getChangedActors return actorsToTest if there is such change. So, if we detect that there is a change in platform tests, we put all the actors that are not being built to actorsToTest.
I prepared some unit tests that hopefully explain the logic:
test('only core tests changed', async () => {
const FILES = [
'test/platform/core/core.test.ts',
];
const { actorsChanged, actorsToTest, codeChanged } = await getChangedActors({ actorConfigs: ACTOR_CONFIGS, isLatest: false, filepathsChanged: FILES });
expect(actorsChanged).toEqual([]);
expect(actorsToTest).toEqual(ACTOR_CONFIGS);
expect(codeChanged).toBe(false);
});
test('core tests and src (excluding standalone actors) changed', async () => {
const FILES = [
'src/main.ts',
'test/platform/core/core.test.ts',
];
const { actorsChanged, actorsToTest, codeChanged } = await getChangedActors({ actorConfigs: ACTOR_CONFIGS, isLatest: false, filepathsChanged: FILES });
expect(actorsChanged).toEqual(ACTOR_CONFIGS.filter((actor) => actor.isStandalone));
expect(actorsToTest).toEqual(ACTOR_CONFIGS.filter((actor) => !actor.isStandalone));
expect(codeChanged).toBe(false);
});
test('core tests and one input_schema changed', async () => {
const FILES = [
'test/platform/core/core.test.ts',
'actors/lukaskrivka_testing-github-integration-1/.actor/INPUT_SCHEMA.json'
];
const { actorsChanged, actorsToTest, codeChanged } = await getChangedActors({ actorConfigs: ACTOR_CONFIGS, isLatest: false, filepathsChanged: FILES });
expect(actorsChanged).toEqual([ACTOR_CONFIGS[0]]);
expect(actorsToTest).toEqual(ACTOR_CONFIGS.slice(1));
expect(codeChanged).toBe(false);
});let me know if something's not clear
|
This is a good feature to have but currently it is a bit hard to implement since we don't know what builds to use. Let's look at it after we finish the current round of refactors, most likely just to write it from scratch. |
Closes #1