Skip to content
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

[eas-cli] log time that it took to complete the previous build in eas build:dev #2865

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
12 changes: 12 additions & 0 deletions packages/eas-cli/graphql.schema.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

62 changes: 49 additions & 13 deletions packages/eas-cli/src/commands/build/dev.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ import { evaluateConfigWithEnvVarsAsync } from '../../build/evaluateConfigWithEn
import { runBuildAndSubmitAsync } from '../../build/runBuildAndSubmit';
import { ensureRepoIsCleanAsync } from '../../build/utils/repository';
import EasCommand from '../../commandUtils/EasCommand';
import { BuildStatus, DistributionType } from '../../graphql/generated';
import { ExpoGraphqlClient } from '../../commandUtils/context/contextUtils/createGraphqlClient';
import { BuildFragment, BuildStatus, DistributionType } from '../../graphql/generated';
import { BuildQuery } from '../../graphql/queries/BuildQuery';
import { toAppPlatform } from '../../graphql/types/AppPlatform';
import Log from '../../log';
Expand Down Expand Up @@ -109,18 +110,11 @@ export default class BuildDev extends EasCommand {
Log.log(`✨ Calculated fingerprint hash: ${fingerprint.hash}`);
Log.newLine();

const builds = await BuildQuery.viewBuildsOnAppAsync(graphqlClient, {
appId: projectId,
filter: {
platform: toAppPlatform(platform),
fingerprintHash: fingerprint.hash,
status: BuildStatus.Finished,
simulator: platform === Platform.IOS ? true : undefined,
distribution: platform === Platform.ANDROID ? DistributionType.Internal : undefined,
developmentClient: true,
},
offset: 0,
limit: 1,
const builds = await this.getBuildsAsync({
graphqlClient,
projectId,
platform,
fingerprint,
});
if (builds.length !== 0) {
const build = builds[0];
Expand All @@ -142,6 +136,22 @@ export default class BuildDev extends EasCommand {

Log.log('🚀 No successful build with matching fingerprint found. Starting a new build...');

const previousBuildsForSelectedProfile = await this.getBuildsAsync({
graphqlClient,
projectId,
platform,
});
if (
previousBuildsForSelectedProfile.length > 0 &&
previousBuildsForSelectedProfile[0].metrics?.buildDuration
) {
Log.log(
`🕒 Previous build for "${buildProfile.profileName}" profile completed in ${Math.floor(
previousBuildsForSelectedProfile[0].metrics.buildDuration / 60000
)} minutes.`
);
}

await runBuildAndSubmitAsync({
graphqlClient,
analytics,
Expand Down Expand Up @@ -294,4 +304,30 @@ export default class BuildDev extends EasCommand {
});
return buildProfile;
}

private async getBuildsAsync({
graphqlClient,
projectId,
platform,
fingerprint,
}: {
graphqlClient: ExpoGraphqlClient;
projectId: string;
platform: Platform;
fingerprint?: { hash: string };
}): Promise<BuildFragment[]> {
return await BuildQuery.viewBuildsOnAppAsync(graphqlClient, {
appId: projectId,
filter: {
platform: toAppPlatform(platform),
fingerprintHash: fingerprint?.hash,
status: BuildStatus.Finished,
simulator: platform === Platform.IOS ? true : undefined,
distribution: platform === Platform.ANDROID ? DistributionType.Internal : undefined,
developmentClient: true,
},
offset: 0,
limit: 1,
});
}
}
Loading
Loading