Skip to content

Implement PR branch workflow#15

Merged
nicolo-ribaudo merged 10 commits intobabel:masterfrom
jbhoosreddy:compare-master-results
Oct 20, 2019
Merged

Implement PR branch workflow#15
nicolo-ribaudo merged 10 commits intobabel:masterfrom
jbhoosreddy:compare-master-results

Conversation

@jbhoosreddy
Copy link
Copy Markdown
Collaborator

@jbhoosreddy jbhoosreddy commented Oct 17, 2019

Summary of changes

  1. Implement download-master-artifact. ( ✅ )
  2. Implement compare-results. ( ✅ )

@jbhoosreddy jbhoosreddy marked this pull request as ready for review October 18, 2019 04:50
const prArtifactFilePath = path.resolve(process.cwd(), prArtifactFileArg);

const masterTests = await parseTestResults(masterArtifactFilePath);
const prTests = await parseTestResults(prArtifactFilePath);
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we to this in parallel?

const [masterTests, prTests] = await Promise.all([
  parseTestResults(masterArtifactFilePath),
  parseTestResults(prArtifactFilePath),
]);

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I always forget to do this

function parseTestResults(filePath) {
return new Promise((resolve) => {
_(fs.createReadStream(filePath).pipe(parser.stream())).toArray(results => resolve(results.map(buffer => JSON.parse(buffer.toString()))));
});
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can this be rewritten as follows, to process results as they come from the stream rather than waiting?

return _(fs.createReadStream(filePath).pipe(parser.stream()))
  .map(buffer => JSON.parse(buffer.toString()))
  .toPromise();

Copy link
Copy Markdown
Collaborator Author

@jbhoosreddy jbhoosreddy Oct 19, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will produce the same net result? Promise of Array?

for (let i = 0; i < masterTests.length; i++) {
const prTest = prTests[i];
const masterTest = masterTests[i];
if (prTest.title !== masterTest.title) {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are these guaranteed to always be in the same order? Or it could differ because the time needed to run each test is non-deterministic?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you have tried running a bunch of tests a few times and it works, it's ok.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This I am confident it comes in sorted order.


async function findTest262Artifact(buildNums) {
for (buildNum of buildNums) {
const buildArtfifacts = await getJSONData(`${CIRCLECI_BABEL_API}/${buildNum}/artifacts`);
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Typo (artfifacts)

@nicolo-ribaudo nicolo-ribaudo merged commit b184ad0 into babel:master Oct 20, 2019
@jbhoosreddy jbhoosreddy deleted the compare-master-results branch October 21, 2019 06:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants