mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
Collect nightlies results (#50488)
Summary: This change adds a job to collect nightlies results so we can then post on discord or internally ## Changelog: [Internal] - Add a job to collect nightlies results Pull Request resolved: https://github.com/facebook/react-native/pull/50488 Test Plan: GHA - tested as a job on PRs: https://github.com/facebook/react-native/actions/runs/14283415968/job/40035831913 Reviewed By: cortinico Differential Revision: D72555358 Pulled By: cipolleschi fbshipit-source-id: 35ec7e571992f5f27179256570b5d143e0d76586
This commit is contained in:
committed by
Facebook GitHub Bot
parent
1853957773
commit
26a6ae0e89
@@ -0,0 +1,74 @@
|
||||
/**
|
||||
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*
|
||||
* @format
|
||||
*/
|
||||
|
||||
const fs = require('fs');
|
||||
const path = require('path');
|
||||
|
||||
function readOutcomes() {
|
||||
const baseDir = '/tmp';
|
||||
let outcomes = {};
|
||||
fs.readdirSync(baseDir).forEach(file => {
|
||||
const fullPath = path.join(baseDir, file);
|
||||
if (fullPath.endsWith('outcome') && fs.statSync(fullPath).isDirectory) {
|
||||
fs.readdirSync(fullPath).forEach(subFile => {
|
||||
const subFullPath = path.join(fullPath, subFile);
|
||||
if (subFullPath.endsWith('outcome')) {
|
||||
const [library, status] = String(fs.readFileSync(subFullPath, 'utf8'))
|
||||
.trim()
|
||||
.split(':');
|
||||
const platform = subFile.includes('android') ? 'Android' : 'iOS';
|
||||
console.log(
|
||||
`[${platform}] ${library} completed with status ${status}`,
|
||||
);
|
||||
outcomes[library.trim()] = {
|
||||
platform,
|
||||
status: status.trim(),
|
||||
};
|
||||
}
|
||||
});
|
||||
} else if (fullPath.endsWith('outcome')) {
|
||||
const [library, status] = String(fs.readFileSync(fullPath, 'utf8'))
|
||||
.trim()
|
||||
.split(':');
|
||||
const platform = file.includes('android') ? 'Android' : 'iOS';
|
||||
console.log(`[${platform}] ${library} completed with status ${status}`);
|
||||
outcomes[library.trim()] = {
|
||||
platform,
|
||||
status: status.trim(),
|
||||
};
|
||||
}
|
||||
});
|
||||
return outcomes;
|
||||
}
|
||||
|
||||
function printFailures(outcomes) {
|
||||
console.log('Printing failures...');
|
||||
let failures = 0;
|
||||
Object.entries(outcomes).forEach(([library, value]) => {
|
||||
if (value.status !== 'success') {
|
||||
console.log(
|
||||
`❌ [${value.platform}] ${library} failed with status ${value.status}`,
|
||||
);
|
||||
failures++;
|
||||
}
|
||||
});
|
||||
return failures > 0;
|
||||
}
|
||||
|
||||
function collectResults() {
|
||||
const outcomes = readOutcomes();
|
||||
const failures = printFailures(outcomes);
|
||||
if (failures) {
|
||||
process.exit(1);
|
||||
}
|
||||
console.log('✅ All tests passed!');
|
||||
}
|
||||
module.exports = {
|
||||
collectResults,
|
||||
};
|
||||
Reference in New Issue
Block a user