-
Notifications
You must be signed in to change notification settings - Fork 0
Feat: skip building actors if only tests changed #33
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: pretify-build-logs
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -10,7 +10,7 @@ import { | |||||
| spawnCommandInGhWorkspace, | ||||||
| setCwd, | ||||||
| } from './utils.js'; | ||||||
| import { runBuilds } from './build.js'; | ||||||
| import {getAllDefaultBuilds, runBuilds} from './build.js'; | ||||||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
| import { getChangedFiles, getCommits } from './git.js'; | ||||||
| import { getPushData } from './github.js'; | ||||||
| import { notifyToSlack } from './slack.js'; | ||||||
|
|
@@ -107,7 +107,17 @@ await yargs() | |||||
| branch: args.sourceBranch.replace('origin/', ''), | ||||||
| dryRun: args.dryRun, | ||||||
| }); | ||||||
| console.log(JSON.stringify(builds)); | ||||||
|
|
||||||
| if (args.dryRun) { | ||||||
| console.log(JSON.stringify([...builds])); | ||||||
| return; | ||||||
| } | ||||||
|
|
||||||
| // add a build entry even if no build was triggered to run the tests on all actors | ||||||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 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 What I would do is to have 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 |
||||||
| const remainingActors = actorConfigs.filter((a) => !actorsChanged.find((ac) => ac.actorName === a.actorName)) | ||||||
| const existingBuilds = await getAllDefaultBuilds(remainingActors) | ||||||
|
|
||||||
| console.log(JSON.stringify([...builds, ...existingBuilds])); | ||||||
| }) | ||||||
| .command( | ||||||
| 'release', | ||||||
|
|
||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -117,6 +117,11 @@ const isIgnoredTopLevelFile = (lowercaseFilePath: string) => { | |
| return IGNORED_TOP_LEVEL_FILES.some((ignoredFile) => sanitizedLowercaseFilePath.startsWith(ignoredFile)); | ||
| }; | ||
|
|
||
| const isIgnoredTestFile = (lowercaseFilePath: string) => { | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this should check if the return lowercaseFilePath.match(/^(code\/)?test\/platform\//);I'd also rename it to |
||
| const sanitizedLowercaseFilePath = lowercaseFilePath.replace(/^code\//, '').replace(/^shared\//, ''); | ||
| return sanitizedLowercaseFilePath.startsWith('tests/'); | ||
| } | ||
|
|
||
| const isLatestBuildOnlyFile = (lowercaseFilePath: string) => { | ||
| if (lowercaseFilePath.endsWith('changelog.md')) { | ||
| return true; | ||
|
|
@@ -145,7 +150,7 @@ export const getChangedActors = ( | |
| const lowercaseFiles = filepathsChanged.map((file) => file.toLowerCase()); | ||
|
|
||
| for (const lowercaseFilePath of lowercaseFiles) { | ||
| if (isIgnoredTopLevelFile(lowercaseFilePath)) { | ||
| if (isIgnoredTopLevelFile(lowercaseFilePath) || isIgnoredTestFile(lowercaseFilePath)) { | ||
| continue; | ||
| } | ||
| // First we check for specific actors that have configs in /actors or standalone actors in /standalone-actors | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this isn't needed...you can extend
getDefaultVersionAndTagto returnbuildId: