Skip to content

Commit b40825b

Browse files
committed
[RN][CI] Collect nightlies results
1 parent 9ddfadb commit b40825b

File tree

2 files changed

+155
-54
lines changed

2 files changed

+155
-54
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
/**
2+
* Copyright (c) Meta Platforms, Inc. and affiliates.
3+
*
4+
* This source code is licensed under the MIT license found in the
5+
* LICENSE file in the root directory of this source tree.
6+
*
7+
* @format
8+
*/
9+
10+
const fs = require('fs');
11+
const path = require('path');
12+
13+
function readOutcomes() {
14+
const baseDir = '/tmp';
15+
let outcomes = {};
16+
fs.readdirSync(baseDir).forEach(file => {
17+
const fullPath = path.join(baseDir, file);
18+
console.log(`Analizing ${fullPath}...`);
19+
if (fullPath.endsWith('outcome') && fs.statSync(fullPath).isDirectory){
20+
console.log(`\tFound ${fullPath} is a directory! Reading it`);
21+
fs.readdirSync(fullPath).forEach(subFile => {
22+
const subFullPath = path.join(fullPath, subFile);
23+
console.log(`\t\tAnalizing ${subFullPath}...`);
24+
if (subFullPath.endsWith('outcome')){
25+
const [library, status] = String(fs.readFileSync(subFullPath, 'utf8')).trim().split(":");
26+
console.log(`\t\t\t${library} completed with status ${status}`);
27+
outcomes[library] = status;
28+
}
29+
});
30+
} else if (fullPath.endsWith('outcome')){
31+
const [library, status] = String(fs.readFileSync(fullPath, 'utf8')).trim().split(":");
32+
console.log(`\t${library} completed with status ${status}`);
33+
outcomes[library] = status;
34+
}
35+
});
36+
return outcomes;
37+
}
38+
39+
function printFailures(outcomes) {
40+
let failures = 0;
41+
outcomes.forEach((status, library) => {
42+
if (status !== 'success') {
43+
console.log(`❌ ${library} failed with status ${status}`);
44+
failures++;
45+
}
46+
})
47+
return failures > 0;
48+
}
49+
50+
function collectResults() {
51+
const outcomes = readOutcomes();
52+
const failures = printFailures(outcomes);
53+
if (failures) {
54+
process.exit(1);
55+
}
56+
}
57+
module.exports = {
58+
collectResults,
59+
}
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
name: Test Libraries on Nightlies
22

33
on:
4+
pull_request:
45
workflow_call:
56

67

@@ -14,45 +15,56 @@ jobs:
1415
strategy:
1516
matrix:
1617
library: [
17-
"react-native-async-storage",
18-
"react-native-blob-util",
19-
"@react-native-clipboard/clipboard",
20-
"@react-native-community/datetimepicker",
21-
"react-native-gesture-handler",
22-
"react-native-image-picker",
23-
"react-native-linear-gradient",
24-
"@react-native-masked-view/masked-view",
25-
"react-native-maps",
26-
"@react-native-community/netinfo",
18+
# "react-native-async-storage",
19+
# "react-native-blob-util",
20+
# "@react-native-clipboard/clipboard",
21+
# "@react-native-community/datetimepicker",
22+
# "react-native-gesture-handler",
23+
# "react-native-image-picker",
24+
# "react-native-linear-gradient",
25+
# "@react-native-masked-view/masked-view",
26+
# "react-native-maps",
27+
# "@react-native-community/netinfo",
2728
"react-native-reanimated@nightly react-native-worklets@nightly", #reanimated requires worklet to be explicitly installed as a separate package
2829
"react-native-svg",
2930
"react-native-video",
3031
"react-native-webview",
31-
"react-native-mmkv",
32-
"react-native-screens",
33-
"react-native-pager-view",
34-
"@react-native-community/slider",
35-
#additional OSS libs used internally
36-
"scandit-react-native-datacapture-barcode scandit-react-native-datacapture-core",
37-
"react-native-contacts",
38-
"react-native-device-info",
39-
"react-native-email-link",
40-
"react-native-exit-app",
41-
"@dr.pogodin/react-native-fs",
42-
"react-native-maps",
43-
"react-native-permissions",
44-
"react-native-vector-icons",
45-
"react-native-masked-view",
46-
"@react-native-community/image-editor",
32+
# "react-native-mmkv",
33+
# "react-native-screens",
34+
# "react-native-pager-view",
35+
# "@react-native-community/slider",
36+
# #additional OSS libs used internally
37+
# "scandit-react-native-datacapture-barcode scandit-react-native-datacapture-core",
38+
# "react-native-contacts",
39+
# "react-native-device-info",
40+
# "react-native-email-link",
41+
# "react-native-exit-app",
42+
# "@dr.pogodin/react-native-fs",
43+
# "react-native-maps",
44+
# "react-native-permissions",
45+
# "react-native-vector-icons",
46+
# "react-native-masked-view",
47+
# "@react-native-community/image-editor",
4748
]
4849
steps:
4950
- name: Checkout
5051
uses: actions/checkout@v4
51-
- name: Test ${{ inputs.library-name }}
52+
- name: Test ${{ matrix.library }}
53+
id: run-test
5254
uses: ./.github/actions/test-library-on-nightly
5355
with:
5456
library-npm-package: ${{ matrix.library }}
5557
platform: android
58+
- name: Save outcome
59+
if: always()
60+
run: |
61+
echo "${{matrix.library}}: ${{steps.run-test.outcome}}\n" >> "/tmp/${{matrix.library}}-android-outcome"
62+
- name: Upload Artifact
63+
if: always()
64+
uses: actions/upload-artifact@v4
65+
with:
66+
name: ${{ matrix.library }}-android-outcome
67+
path: /tmp/${{ matrix.library }}-android-outcome
5668

5769
test-library-on-nightly-ios:
5870
name: "[iOS] ${{ matrix.library }}"
@@ -61,42 +73,72 @@ jobs:
6173
strategy:
6274
matrix:
6375
library: [
64-
"react-native-async-storage",
65-
"react-native-blob-util",
66-
"@react-native-clipboard/clipboard",
67-
"@react-native-community/datetimepicker",
68-
"react-native-gesture-handler",
69-
"react-native-image-picker",
70-
"react-native-linear-gradient",
71-
"@react-native-masked-view/masked-view",
72-
"react-native-maps",
73-
"@react-native-community/netinfo",
76+
# "react-native-async-storage",
77+
# "react-native-blob-util",
78+
# "@react-native-clipboard/clipboard",
79+
# "@react-native-community/datetimepicker",
80+
# "react-native-gesture-handler",
81+
# "react-native-image-picker",
82+
# "react-native-linear-gradient",
83+
# "@react-native-masked-view/masked-view",
84+
# "react-native-maps",
85+
# "@react-native-community/netinfo",
7486
"react-native-reanimated@nightly react-native-worklets@nightly", #reanimated requires worklet to be explicitly installed as a separate package
7587
"react-native-svg",
7688
"react-native-video",
7789
"react-native-webview",
78-
"react-native-mmkv",
79-
"react-native-screens",
80-
"react-native-pager-view",
81-
"@react-native-community/slider",
82-
#additional OSS libs used internally
83-
"scandit-react-native-datacapture-barcode scandit-react-native-datacapture-core",
84-
"react-native-contacts",
85-
"react-native-device-info",
86-
"react-native-email-link",
87-
"react-native-exit-app",
88-
"@dr.pogodin/react-native-fs",
89-
"react-native-maps",
90-
"react-native-permissions",
91-
"react-native-vector-icons",
92-
"react-native-masked-view",
93-
"@react-native-community/image-editor",
90+
# "react-native-mmkv",
91+
# "react-native-screens",
92+
# "react-native-pager-view",
93+
# "@react-native-community/slider",
94+
# #additional OSS libs used internally
95+
# "scandit-react-native-datacapture-barcode scandit-react-native-datacapture-core",
96+
# "react-native-contacts",
97+
# "react-native-device-info",
98+
# "react-native-email-link",
99+
# "react-native-exit-app",
100+
# "@dr.pogodin/react-native-fs",
101+
# "react-native-maps",
102+
# "react-native-permissions",
103+
# "react-native-vector-icons",
104+
# "react-native-masked-view",
105+
# "@react-native-community/image-editor",
94106
]
95107
steps:
96108
- name: Checkout
97109
uses: actions/checkout@v4
98-
- name: Test ${{ inputs.library-name }}
110+
- name: Test ${{ matrix.library }}
111+
id: run-test
99112
uses: ./.github/actions/test-library-on-nightly
100113
with:
101114
library-npm-package: ${{ matrix.library }}
102115
platform: ios
116+
- name: Save outcome
117+
if: always()
118+
run: |
119+
echo "${{matrix.library}}: ${{steps.run-test.outcome}}\n" > "/tmp/${{matrix.library}}-ios-outcome"
120+
- name: Upload Artifact
121+
if: always()
122+
uses: actions/upload-artifact@v4
123+
with:
124+
name: ${{ matrix.library }}-ios-outcome
125+
path: /tmp/${{ matrix.library }}-ios-outcome
126+
127+
128+
collect-results:
129+
runs-on: ubuntu-latest
130+
needs: [test-library-on-nightly-android, test-library-on-nightly-ios]
131+
steps:
132+
- name: Checkout
133+
uses: actions/checkout@v4
134+
- name: Restore outcomes
135+
uses: actions/download-artifact@v4
136+
with:
137+
pattern: '*-outcome'
138+
path: /tmp
139+
- name: Collect failures
140+
uses: actions/github-script@v6
141+
with:
142+
script: |
143+
const {collectResults} = require('./.github/workflow-scripts/collectNightlyOutcomes.js');
144+
collectResults();

0 commit comments

Comments
 (0)