|
50 | 50 | env: |
51 | 51 | FLAKINESS_ACCESS_TOKEN: ${{ secrets.FLAKINESS_ACCESS_TOKEN }} |
52 | 52 | run: | |
53 | | - # Install the flakiness SDK |
54 | | - npm install @flakiness/sdk |
| 53 | + find . -name report.json -exec npx -y flakiness upload {} + |
55 | 54 |
|
56 | | - # Upload each shard's report |
57 | | - node --input-type=module << 'EOF' |
58 | | - import { readReport, uploadReport } from '@flakiness/sdk'; |
59 | | - import fs from 'fs'; |
60 | | - import path from 'path'; |
61 | | -
|
62 | | - const reportsBaseDir = 'flakiness-reports'; |
63 | | -
|
64 | | - // Each artifact is downloaded to its own subdirectory |
65 | | - // e.g., flakiness-reports/flakiness-report-macos-shard-1/report.json |
66 | | - const shardDirs = fs.readdirSync(reportsBaseDir).filter(name => |
67 | | - fs.statSync(path.join(reportsBaseDir, name)).isDirectory() |
68 | | - ); |
69 | | -
|
70 | | - if (shardDirs.length === 0) { |
71 | | - console.log('No flakiness report directories found'); |
72 | | - process.exit(0); |
73 | | - } |
74 | | -
|
75 | | - console.log(`Found ${shardDirs.length} shard report(s):`, shardDirs); |
76 | | -
|
77 | | - for (const shardDir of shardDirs) { |
78 | | - const reportDir = path.join(reportsBaseDir, shardDir); |
79 | | - const reportJsonPath = path.join(reportDir, 'report.json'); |
80 | | -
|
81 | | - if (!fs.existsSync(reportJsonPath)) { |
82 | | - console.log(`Skipping ${shardDir}: no report.json found`); |
83 | | - continue; |
84 | | - } |
85 | | -
|
86 | | - console.log(`\nUploading flakiness report from: ${reportDir}`); |
87 | | - try { |
88 | | - const { report, attachments, missingAttachments } = await readReport(reportDir); |
89 | | -
|
90 | | - if (missingAttachments.length > 0) { |
91 | | - console.warn('Missing attachments:', missingAttachments.map(a => a.id)); |
92 | | - } |
93 | | -
|
94 | | - const result = await uploadReport(report, attachments, { |
95 | | - flakinessEndpoint: 'https://flakiness.io' |
96 | | - }); |
97 | | -
|
98 | | - console.log('Upload result:', result); |
99 | | - } catch (error) { |
100 | | - console.error(`Failed to upload ${shardDir}:`, error.message); |
101 | | - } |
102 | | - } |
103 | | - EOF |
0 commit comments