gha-workflow-testing 1.0.0 → 1.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +16 -19
- package/dist/check_run.d.ts +20 -0
- package/dist/check_run.d.ts.map +1 -0
- package/dist/check_run.js +110 -0
- package/dist/check_run.js.map +1 -0
- package/dist/github-api.d.ts +2 -0
- package/dist/github-api.d.ts.map +1 -1
- package/dist/github-api.js +37 -11
- package/dist/github-api.js.map +1 -1
- package/dist/global_setup.d.ts +9 -0
- package/dist/global_setup.d.ts.map +1 -0
- package/dist/global_setup.js +50 -0
- package/dist/global_setup.js.map +1 -0
- package/dist/global_teardown.d.ts +10 -0
- package/dist/global_teardown.d.ts.map +1 -0
- package/dist/global_teardown.js +77 -0
- package/dist/global_teardown.js.map +1 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -0
- package/dist/index.js.map +1 -1
- package/dist/reporter.d.ts +28 -0
- package/dist/reporter.d.ts.map +1 -1
- package/dist/reporter.js +106 -51
- package/dist/reporter.js.map +1 -1
- package/dist/reusable_reporter.d.ts +211 -0
- package/dist/reusable_reporter.d.ts.map +1 -0
- package/dist/reusable_reporter.js +749 -0
- package/dist/reusable_reporter.js.map +1 -0
- package/dist/workflow_status.d.ts +57 -0
- package/dist/workflow_status.d.ts.map +1 -0
- package/dist/workflow_status.js +165 -0
- package/dist/workflow_status.js.map +1 -0
- package/package.json +6 -7
- package/src/check_run.ts +122 -0
- package/src/github-api.ts +44 -12
- package/src/global_setup.ts +16 -0
- package/src/global_teardown.ts +53 -0
- package/src/index.ts +3 -0
- package/src/reporter.ts +121 -21
- package/src/reusable_reporter.ts +890 -0
- package/src/workflow_status.ts +181 -0
package/README.md
CHANGED
|
@@ -12,21 +12,10 @@ TypeScript library for testing GitHub Actions workflows with detailed reporting
|
|
|
12
12
|
|
|
13
13
|
## Installation
|
|
14
14
|
|
|
15
|
-
### Option 1: Via Git (Immediate - No setup required)
|
|
16
|
-
|
|
17
15
|
```bash
|
|
18
|
-
npm install
|
|
16
|
+
npm install npm i gha-workflow-testing
|
|
19
17
|
```
|
|
20
18
|
|
|
21
|
-
### Option 2: Via GitHub Packages (Coming soon)
|
|
22
|
-
|
|
23
|
-
```bash
|
|
24
|
-
# Configure .npmrc
|
|
25
|
-
echo "@global-data-analytics:registry=https://npm.pkg.github.com" >> .npmrc
|
|
26
|
-
|
|
27
|
-
# Install
|
|
28
|
-
npm install @global-data-analytics/gha-test
|
|
29
|
-
```
|
|
30
19
|
|
|
31
20
|
## Quick Start
|
|
32
21
|
|
|
@@ -40,7 +29,7 @@ export GITHUB_REPOSITORY="owner/repo"
|
|
|
40
29
|
### 2. Write Tests
|
|
41
30
|
|
|
42
31
|
```typescript
|
|
43
|
-
import { GitHubAPI, assertJobSuccess, getReporter } from '
|
|
32
|
+
import { GitHubAPI, assertJobSuccess, getReporter } from 'gha-workflow-testing';
|
|
44
33
|
|
|
45
34
|
const WORKFLOW_NAME = 'CI Workflow';
|
|
46
35
|
|
|
@@ -109,6 +98,15 @@ const artifacts = await api.getArtifacts(runId);
|
|
|
109
98
|
|
|
110
99
|
Functions for testing workflow components.
|
|
111
100
|
|
|
101
|
+
| Function | Parameters | Description |
|
|
102
|
+
|----------|------------|-------------|
|
|
103
|
+
| `assertJobSuccess` | `jobs`, `jobName`, `reporter`, `expectedConclusion?` | Assert a job completed with the expected conclusion (default: 'success') |
|
|
104
|
+
| `assertStepSuccess` | `steps`, `stepName`, `jobName`, `reporter`, `expectedConclusion?` | Assert a step completed with the expected conclusion (default: 'success') |
|
|
105
|
+
| `assertArtifactExists` | `artifacts`, `artifactName`, `reporter` | Assert that an artifact was uploaded in the workflow run |
|
|
106
|
+
| `assertJFrogArtifactExists` | `options`, `reporter` | Assert that an artifact exists in JFrog Artifactory |
|
|
107
|
+
|
|
108
|
+
#### Usage Examples
|
|
109
|
+
|
|
112
110
|
```typescript
|
|
113
111
|
// Assert job completed with expected conclusion
|
|
114
112
|
assertJobSuccess(jobs, 'job-name', reporter, 'success');
|
|
@@ -121,9 +119,9 @@ assertArtifactExists(artifacts, 'artifact-name', reporter);
|
|
|
121
119
|
|
|
122
120
|
// Assert JFrog artifact exists
|
|
123
121
|
await assertJFrogArtifactExists({
|
|
124
|
-
jfrogUrl: '
|
|
125
|
-
repository: '
|
|
126
|
-
artifactPath: '
|
|
122
|
+
jfrogUrl: 'URL',
|
|
123
|
+
repository: 'REPO_NAME',
|
|
124
|
+
artifactPath: 'apps/your-app',
|
|
127
125
|
artifactName: 'dev',
|
|
128
126
|
jfrogToken: process.env.JFROG_TOKEN,
|
|
129
127
|
reporter,
|
|
@@ -199,11 +197,10 @@ npm run build
|
|
|
199
197
|
| `GITHUB_REPOSITORY` | Yes | Repository in `owner/repo` format |
|
|
200
198
|
| `GITHUB_STEP_SUMMARY` | No | Path to GitHub Actions summary file (auto-set in CI) |
|
|
201
199
|
| `JFROG_TOKEN` | No | JFrog access token for artifact verification |
|
|
202
|
-
| `GDAP_ARTIFACTORY_ACCESS_TOKEN` | No | Alternative JFrog token |
|
|
203
200
|
|
|
204
201
|
## Example Usage
|
|
205
202
|
|
|
206
|
-
|
|
203
|
+
- TBA
|
|
207
204
|
|
|
208
205
|
## License
|
|
209
206
|
|
|
@@ -211,4 +208,4 @@ MIT
|
|
|
211
208
|
|
|
212
209
|
## Maintainers
|
|
213
210
|
|
|
214
|
-
|
|
211
|
+
Rohit Patil
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* check_run.ts
|
|
3
|
+
*
|
|
4
|
+
* Creates one GitHub Check Run per workflow test suite after all suites
|
|
5
|
+
* have finished (called from globalTeardown).
|
|
6
|
+
*
|
|
7
|
+
* Requirements (automatically satisfied when running inside GitHub Actions):
|
|
8
|
+
* - GITHUB_TOKEN — needs `checks: write` permission
|
|
9
|
+
* - GITHUB_REPOSITORY — set automatically
|
|
10
|
+
* - GITHUB_SHA — commit SHA the check attaches to
|
|
11
|
+
*
|
|
12
|
+
* When any of the above are absent (local dev run) the function is a no-op.
|
|
13
|
+
*/
|
|
14
|
+
import { WorkflowStatusFile } from './workflow_status';
|
|
15
|
+
/**
|
|
16
|
+
* Post one Check Run per suite to the GitHub Checks API.
|
|
17
|
+
* Safe to call unconditionally — skips silently outside of GitHub Actions.
|
|
18
|
+
*/
|
|
19
|
+
export declare function createCheckRuns(data: WorkflowStatusFile): Promise<void>;
|
|
20
|
+
//# sourceMappingURL=check_run.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"check_run.d.ts","sourceRoot":"","sources":["../src/check_run.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAGH,OAAO,EAAE,kBAAkB,EAAuB,MAAM,mBAAmB,CAAC;AA6C5E;;;GAGG;AACH,wBAAsB,eAAe,CAAC,IAAI,EAAE,kBAAkB,GAAG,OAAO,CAAC,IAAI,CAAC,CAyD7E"}
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* check_run.ts
|
|
4
|
+
*
|
|
5
|
+
* Creates one GitHub Check Run per workflow test suite after all suites
|
|
6
|
+
* have finished (called from globalTeardown).
|
|
7
|
+
*
|
|
8
|
+
* Requirements (automatically satisfied when running inside GitHub Actions):
|
|
9
|
+
* - GITHUB_TOKEN — needs `checks: write` permission
|
|
10
|
+
* - GITHUB_REPOSITORY — set automatically
|
|
11
|
+
* - GITHUB_SHA — commit SHA the check attaches to
|
|
12
|
+
*
|
|
13
|
+
* When any of the above are absent (local dev run) the function is a no-op.
|
|
14
|
+
*/
|
|
15
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
16
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
17
|
+
};
|
|
18
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
19
|
+
exports.createCheckRuns = createCheckRuns;
|
|
20
|
+
const axios_1 = __importDefault(require("axios"));
|
|
21
|
+
// ---------------------------------------------------------------------------
|
|
22
|
+
// Helpers
|
|
23
|
+
// ---------------------------------------------------------------------------
|
|
24
|
+
/** Build the Markdown body for a single Check Run's "details" pane. */
|
|
25
|
+
function buildCheckRunBody(e) {
|
|
26
|
+
const lines = [];
|
|
27
|
+
lines.push(`## Test suite: \`${e.workflowName}\``);
|
|
28
|
+
lines.push('');
|
|
29
|
+
lines.push(`| Metric | Value |`);
|
|
30
|
+
lines.push(`|--------|-------|`);
|
|
31
|
+
lines.push(`| Result | **${e.result}** |`);
|
|
32
|
+
lines.push(`| Tests passed | ${e.passedTests} / ${e.totalTests} |`);
|
|
33
|
+
lines.push(`| Tests failed | ${e.failedTests} |`);
|
|
34
|
+
lines.push(`| Jobs passed | ${e.jobs.passed} / ${e.jobs.total} |`);
|
|
35
|
+
lines.push(`| Jobs failed | ${e.jobs.failed} |`);
|
|
36
|
+
lines.push(`| Jobs skipped | ${e.jobs.skipped} |`);
|
|
37
|
+
if (e.runId)
|
|
38
|
+
lines.push(`| Run ID | \`${e.runId}\` |`);
|
|
39
|
+
lines.push('');
|
|
40
|
+
if (e.jobDetails && e.jobDetails.length > 0) {
|
|
41
|
+
lines.push('### Job conclusions');
|
|
42
|
+
lines.push('');
|
|
43
|
+
lines.push('| Job | Conclusion |');
|
|
44
|
+
lines.push('|-----|------------|');
|
|
45
|
+
for (const { name, conclusion } of e.jobDetails) {
|
|
46
|
+
const icon = conclusion === 'success' ? '✅' :
|
|
47
|
+
conclusion === 'skipped' ? '⏭️' :
|
|
48
|
+
conclusion === 'neutral' ? 'ℹ️' :
|
|
49
|
+
conclusion === null ? '🕐' : '❌';
|
|
50
|
+
lines.push(`| ${icon} \`${name}\` | ${conclusion ?? 'in-progress'} |`);
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
return lines.join('\n');
|
|
54
|
+
}
|
|
55
|
+
// ---------------------------------------------------------------------------
|
|
56
|
+
// Public API
|
|
57
|
+
// ---------------------------------------------------------------------------
|
|
58
|
+
/**
|
|
59
|
+
* Post one Check Run per suite to the GitHub Checks API.
|
|
60
|
+
* Safe to call unconditionally — skips silently outside of GitHub Actions.
|
|
61
|
+
*/
|
|
62
|
+
async function createCheckRuns(data) {
|
|
63
|
+
const token = process.env.GITHUB_TOKEN;
|
|
64
|
+
const repo = process.env.GITHUB_REPOSITORY;
|
|
65
|
+
const sha = process.env.GITHUB_SHA;
|
|
66
|
+
if (!token || !repo || !sha) {
|
|
67
|
+
console.log('ℹ️ Skipping Check Run creation (not running in GitHub Actions)');
|
|
68
|
+
return;
|
|
69
|
+
}
|
|
70
|
+
const client = axios_1.default.create({
|
|
71
|
+
baseURL: 'https://api.github.com',
|
|
72
|
+
headers: {
|
|
73
|
+
Authorization: `Bearer ${token}`,
|
|
74
|
+
Accept: 'application/vnd.github+json',
|
|
75
|
+
},
|
|
76
|
+
});
|
|
77
|
+
for (const e of data.entries) {
|
|
78
|
+
const conclusion = e.result === 'passed' ? 'success' : 'failure';
|
|
79
|
+
const failedJobNames = (e.jobDetails ?? [])
|
|
80
|
+
.filter((j) => j.conclusion !== 'success' && j.conclusion !== 'skipped' && j.conclusion !== 'neutral' && j.conclusion !== null)
|
|
81
|
+
.map((j) => j.name);
|
|
82
|
+
const summary = conclusion === 'success'
|
|
83
|
+
? `✅ All ${e.totalTests} tests passed across ${e.jobs.total} jobs.`
|
|
84
|
+
: `❌ ${e.failedTests} test(s) failed. Failed jobs: ${failedJobNames.join(', ') || 'see details'}.`;
|
|
85
|
+
const payload = {
|
|
86
|
+
name: `${e.workflowName} — Test Suite`,
|
|
87
|
+
head_sha: sha,
|
|
88
|
+
status: 'completed',
|
|
89
|
+
conclusion,
|
|
90
|
+
completed_at: e.recordedAt,
|
|
91
|
+
output: {
|
|
92
|
+
title: `${conclusion === 'success' ? '✅' : '❌'} ${e.workflowName}: ${e.passedTests}/${e.totalTests} tests passed`,
|
|
93
|
+
summary,
|
|
94
|
+
// Full workflow report: Workflow Summary + Job Summary + Detailed Results + Artifacts
|
|
95
|
+
text: e.reportMarkdown ?? buildCheckRunBody(e),
|
|
96
|
+
},
|
|
97
|
+
};
|
|
98
|
+
try {
|
|
99
|
+
const resp = await client.post(`/repos/${repo}/check-runs`, payload);
|
|
100
|
+
console.log(`✅ Check Run created: "${payload.name}" → ${conclusion} ` +
|
|
101
|
+
`(id: ${resp.data.id}, url: ${resp.data.html_url})`);
|
|
102
|
+
}
|
|
103
|
+
catch (err) {
|
|
104
|
+
const status = err?.response?.status;
|
|
105
|
+
const message = err?.response?.data?.message ?? err?.message;
|
|
106
|
+
console.warn(`⚠️ Could not create Check Run for "${e.workflowName}": [${status}] ${message}`);
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
//# sourceMappingURL=check_run.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"check_run.js","sourceRoot":"","sources":["../src/check_run.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;GAYG;;;;;AAoDH,0CAyDC;AA3GD,kDAA0B;AAG1B,8EAA8E;AAC9E,UAAU;AACV,8EAA8E;AAE9E,uEAAuE;AACvE,SAAS,iBAAiB,CAAC,CAAsB;IAC/C,MAAM,KAAK,GAAa,EAAE,CAAC;IAE3B,KAAK,CAAC,IAAI,CAAC,oBAAoB,CAAC,CAAC,YAAY,IAAI,CAAC,CAAC;IACnD,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IACf,KAAK,CAAC,IAAI,CAAC,oBAAoB,CAAC,CAAC;IACjC,KAAK,CAAC,IAAI,CAAC,oBAAoB,CAAC,CAAC;IACjC,KAAK,CAAC,IAAI,CAAC,gBAAgB,CAAC,CAAC,MAAM,MAAM,CAAC,CAAC;IAC3C,KAAK,CAAC,IAAI,CAAC,oBAAoB,CAAC,CAAC,WAAW,MAAM,CAAC,CAAC,UAAU,IAAI,CAAC,CAAC;IACpE,KAAK,CAAC,IAAI,CAAC,oBAAoB,CAAC,CAAC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KAAK,OAAO,EAAE,CAAC,CAAC;QACjG,CAAC;IACH,CAAC;AACH,CAAC"}
|
package/dist/github-api.d.ts
CHANGED
package/dist/github-api.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"github-api.d.ts","sourceRoot":"","sources":["../src/github-api.ts"],"names":[],"mappings":"AAEA,MAAM,WAAW,OAAO;IACtB,MAAM,EAAE,MAAM,CAAC;IACf,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;
|
|
1
|
+
{"version":3,"file":"github-api.d.ts","sourceRoot":"","sources":["../src/github-api.ts"],"names":[],"mappings":"AAEA,MAAM,WAAW,OAAO;IACtB,MAAM,EAAE,MAAM,CAAC;IACf,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;IAC1B,gGAAgG;IAChG,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB;AAED,MAAM,WAAW,IAAI;IACnB,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC;CAC5B;AAED,MAAM,WAAW,QAAQ;IACvB,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;IAC1B,MAAM,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,WAAW,KAAK;IACpB,CAAC,QAAQ,EAAE,MAAM,GAAG,QAAQ,CAAC;CAC9B;AAED,MAAM,WAAW,YAAY;IAC3B,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,OAAO,CAAC;IACjB,GAAG,EAAE,MAAM,CAAC;CACb;AAED,MAAM,WAAW,SAAS;IACxB,CAAC,YAAY,EAAE,MAAM,GAAG,YAAY,CAAC;CACtC;AAED,qBAAa,SAAS;IACpB,OAAO,CAAC,IAAI,CAAS;IACrB,OAAO,CAAC,MAAM,CAAgB;;IAqBxB,YAAY,CAAC,YAAY,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;IA+CnD,OAAO,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAqBrC,qBAAqB,CACzB,KAAK,EAAE,MAAM,EACb,OAAO,GAAE,MAAY,EACrB,YAAY,GAAE,MAAW,GACxB,OAAO,CAAC,IAAI,CAAC;IAyBV,QAAQ,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,KAAK,CAAC;IAwBxD,YAAY,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,SAAS,CAAC;IAqB/C,gBAAgB,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC;QAAE,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,CAAA;KAAE,CAAC;IAcnF,OAAO,CAAC,KAAK;CAGd"}
|
package/dist/github-api.js
CHANGED
|
@@ -22,19 +22,43 @@ class GitHubAPI {
|
|
|
22
22
|
});
|
|
23
23
|
}
|
|
24
24
|
async getLatestRun(workflowName) {
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
const
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
25
|
+
// Step 1: find the workflow definition by display name so we can query
|
|
26
|
+
// its runs directly instead of scanning all recent runs (avoids pagination issues).
|
|
27
|
+
console.log(`📡 Looking up workflow definition for: ${workflowName}`);
|
|
28
|
+
const wfResponse = await this.client.get(`/repos/${this.repo}/actions/workflows`, {
|
|
29
|
+
params: { per_page: 100 },
|
|
30
|
+
});
|
|
31
|
+
const workflow = wfResponse.data.workflows.find((w) => w.name === workflowName);
|
|
32
|
+
if (workflow) {
|
|
33
|
+
console.log(`✅ Found workflow definition: ${workflowName} (id: ${workflow.id})`);
|
|
34
|
+
const runsResponse = await this.client.get(`/repos/${this.repo}/actions/workflows/${workflow.id}/runs`, { params: { per_page: 1 } });
|
|
35
|
+
const runs = runsResponse.data.workflow_runs;
|
|
36
|
+
if (runs.length > 0) {
|
|
37
|
+
console.log(`✅ Latest run ID: ${runs[0].id}`);
|
|
38
|
+
return runs[0].id;
|
|
39
|
+
}
|
|
40
|
+
throw new Error(`Workflow '${workflowName}' found but has no runs`);
|
|
41
|
+
}
|
|
42
|
+
// Fallback: scan recent runs across all workflows (handles workflows whose
|
|
43
|
+
// display name differs from what /actions/workflows returns).
|
|
44
|
+
console.log(`⚠️ Workflow definition not found, falling back to paginated run search`);
|
|
45
|
+
for (let page = 1; page <= 5; page++) {
|
|
46
|
+
const response = await this.client.get(`/repos/${this.repo}/actions/runs`, {
|
|
47
|
+
params: { per_page: 100, page },
|
|
48
|
+
});
|
|
49
|
+
const runs = response.data.workflow_runs;
|
|
50
|
+
console.log(` Page ${page}: ${runs.length} runs`);
|
|
51
|
+
for (const run of runs) {
|
|
52
|
+
if (run.name === workflowName) {
|
|
53
|
+
console.log(`✅ Found matching run on page ${page}: ${workflowName} (ID: ${run.id})`);
|
|
54
|
+
return run.id;
|
|
55
|
+
}
|
|
34
56
|
}
|
|
57
|
+
if (runs.length < 100)
|
|
58
|
+
break; // no more pages
|
|
35
59
|
}
|
|
36
|
-
console.log(`❌ Workflow '${workflowName}' not found
|
|
37
|
-
throw new Error(
|
|
60
|
+
console.log(`❌ Workflow '${workflowName}' not found`);
|
|
61
|
+
throw new Error(`Workflow run not found: '${workflowName}'`);
|
|
38
62
|
}
|
|
39
63
|
async getJobs(runId) {
|
|
40
64
|
const url = `/repos/${this.repo}/actions/runs/${runId}/jobs`;
|
|
@@ -47,6 +71,8 @@ class GitHubAPI {
|
|
|
47
71
|
result[job.name] = {
|
|
48
72
|
status: job.status,
|
|
49
73
|
conclusion: job.conclusion,
|
|
74
|
+
// workflow_name identifies which reusable workflow defined this job
|
|
75
|
+
workflowName: job.workflow_name ?? undefined,
|
|
50
76
|
};
|
|
51
77
|
}
|
|
52
78
|
return result;
|
package/dist/github-api.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"github-api.js","sourceRoot":"","sources":["../src/github-api.ts"],"names":[],"mappings":";;;;;;AAAA,kDAA6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EAAE,QAAQ,CAAC,oBAAoB;aACnC,CAAC;QACJ,CAAC;QAED,OAAO,MAAM,CAAC;IAChB,CAAC;IAED,KAAK,CAAC,gBAAgB,CAAC,UAAkB;QACvC,MAAM,GAAG,GAAG,UAAU,IAAI,CAAC,IAAI,sBAAsB,UAAU,MAAM,CAAC;QACtE,OAAO,CAAC,GAAG,CAAC,8BAA8B,UAAU,EAAE,CAAC,CAAC;QAExD,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,GAAG,EAAE,EAAE,YAAY,EAAE,aAAa,EAAE,CAAC,CAAC;QAE7E,yDAAyD;QACzD,0CAA0C;QAC1C,OAAO,CAAC,GAAG,CAAC,mFAAmF,CAAC,CAAC;QACjG,OAAO;YACL,mBAAmB,EAAE,MAAM,CAAC,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC;SAChD,CAAC;IACJ,CAAC;IAEO,KAAK,CAAC,EAAU;QACtB,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,UAAU,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC,CAAC;IAC3D,CAAC;CACF;AAtLD,8BAsLC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"global_setup.d.ts","sourceRoot":"","sources":["../src/global_setup.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG"}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* global_setup.ts
|
|
4
|
+
*
|
|
5
|
+
* Jest globalSetup — runs once before any test suite.
|
|
6
|
+
* Clears the shared workflow-status.json so stale results from a previous
|
|
7
|
+
* run don't bleed into the new one.
|
|
8
|
+
*/
|
|
9
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
12
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
13
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
14
|
+
}
|
|
15
|
+
Object.defineProperty(o, k2, desc);
|
|
16
|
+
}) : (function(o, m, k, k2) {
|
|
17
|
+
if (k2 === undefined) k2 = k;
|
|
18
|
+
o[k2] = m[k];
|
|
19
|
+
}));
|
|
20
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
21
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
22
|
+
}) : function(o, v) {
|
|
23
|
+
o["default"] = v;
|
|
24
|
+
});
|
|
25
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
26
|
+
var ownKeys = function(o) {
|
|
27
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
28
|
+
var ar = [];
|
|
29
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
30
|
+
return ar;
|
|
31
|
+
};
|
|
32
|
+
return ownKeys(o);
|
|
33
|
+
};
|
|
34
|
+
return function (mod) {
|
|
35
|
+
if (mod && mod.__esModule) return mod;
|
|
36
|
+
var result = {};
|
|
37
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
38
|
+
__setModuleDefault(result, mod);
|
|
39
|
+
return result;
|
|
40
|
+
};
|
|
41
|
+
})();
|
|
42
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
43
|
+
const fs = __importStar(require("fs"));
|
|
44
|
+
const workflow_status_1 = require("./workflow_status");
|
|
45
|
+
module.exports = async function globalSetup() {
|
|
46
|
+
fs.mkdirSync(workflow_status_1.STATUS_DIR, { recursive: true });
|
|
47
|
+
fs.writeFileSync(workflow_status_1.STATUS_FILE, JSON.stringify({ entries: [] }, null, 2), 'utf8');
|
|
48
|
+
console.log(`\n🧹 Cleared workflow status file: ${workflow_status_1.STATUS_FILE}`);
|
|
49
|
+
};
|
|
50
|
+
//# sourceMappingURL=global_setup.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"global_setup.js","sourceRoot":"","sources":["../src/global_setup.ts"],"names":[],"mappings":";AAAA;;;;;;GAMG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,uCAAyB;AACzB,uDAA4D;AAE5D,MAAM,CAAC,OAAO,GAAG,KAAK,UAAU,WAAW;IACzC,EAAE,CAAC,SAAS,CAAC,4BAAU,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;IAC9C,EAAE,CAAC,aAAa,CAAC,6BAAW,EAAE,IAAI,CAAC,SAAS,CAAC,EAAE,OAAO,EAAE,EAAE,EAAE,EAAE,IAAI,EAAE,CAAC,CAAC,EAAE,MAAM,CAAC,CAAC;IAChF,OAAO,CAAC,GAAG,CAAC,sCAAsC,6BAAW,EAAE,CAAC,CAAC;AACnE,CAAC,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* global_teardown.ts
|
|
3
|
+
*
|
|
4
|
+
* Jest globalTeardown — runs once after all test suites complete.
|
|
5
|
+
* Reads the accumulated workflow-status.json and:
|
|
6
|
+
* 1. Prints the cross-workflow table to the console.
|
|
7
|
+
* 2. Appends it to GITHUB_STEP_SUMMARY (when running in CI).
|
|
8
|
+
*/
|
|
9
|
+
export {};
|
|
10
|
+
//# sourceMappingURL=global_teardown.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"global_teardown.d.ts","sourceRoot":"","sources":["../src/global_teardown.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG"}
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* global_teardown.ts
|
|
4
|
+
*
|
|
5
|
+
* Jest globalTeardown — runs once after all test suites complete.
|
|
6
|
+
* Reads the accumulated workflow-status.json and:
|
|
7
|
+
* 1. Prints the cross-workflow table to the console.
|
|
8
|
+
* 2. Appends it to GITHUB_STEP_SUMMARY (when running in CI).
|
|
9
|
+
*/
|
|
10
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
11
|
+
if (k2 === undefined) k2 = k;
|
|
12
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
13
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
14
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
15
|
+
}
|
|
16
|
+
Object.defineProperty(o, k2, desc);
|
|
17
|
+
}) : (function(o, m, k, k2) {
|
|
18
|
+
if (k2 === undefined) k2 = k;
|
|
19
|
+
o[k2] = m[k];
|
|
20
|
+
}));
|
|
21
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
22
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
23
|
+
}) : function(o, v) {
|
|
24
|
+
o["default"] = v;
|
|
25
|
+
});
|
|
26
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
27
|
+
var ownKeys = function(o) {
|
|
28
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
29
|
+
var ar = [];
|
|
30
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
31
|
+
return ar;
|
|
32
|
+
};
|
|
33
|
+
return ownKeys(o);
|
|
34
|
+
};
|
|
35
|
+
return function (mod) {
|
|
36
|
+
if (mod && mod.__esModule) return mod;
|
|
37
|
+
var result = {};
|
|
38
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
39
|
+
__setModuleDefault(result, mod);
|
|
40
|
+
return result;
|
|
41
|
+
};
|
|
42
|
+
})();
|
|
43
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
44
|
+
const fs = __importStar(require("fs"));
|
|
45
|
+
const workflow_status_1 = require("./workflow_status");
|
|
46
|
+
const check_run_1 = require("./check_run");
|
|
47
|
+
module.exports = async function globalTeardown() {
|
|
48
|
+
console.log('\n' + '='.repeat(80));
|
|
49
|
+
console.log('🗂️ CROSS-WORKFLOW SUMMARY');
|
|
50
|
+
console.log('='.repeat(80));
|
|
51
|
+
const data = (0, workflow_status_1.readWorkflowStatus)();
|
|
52
|
+
if (data.entries.length === 0) {
|
|
53
|
+
console.log('⚠️ No workflow results recorded — did any test call registerWorkflowResult()?');
|
|
54
|
+
console.log('='.repeat(80) + '\n');
|
|
55
|
+
return;
|
|
56
|
+
}
|
|
57
|
+
const markdown = (0, workflow_status_1.generateCrossWorkflowMarkdown)(data);
|
|
58
|
+
// ── Console output ────────────────────────────────────────────────────
|
|
59
|
+
console.log(markdown);
|
|
60
|
+
console.log('='.repeat(80) + '\n');
|
|
61
|
+
// ── GitHub Actions step summary ───────────────────────────────────────
|
|
62
|
+
const summaryFile = process.env.GITHUB_STEP_SUMMARY;
|
|
63
|
+
if (summaryFile) {
|
|
64
|
+
try {
|
|
65
|
+
fs.appendFileSync(summaryFile, markdown, 'utf8');
|
|
66
|
+
console.log('✅ Cross-workflow summary written to GITHUB_STEP_SUMMARY');
|
|
67
|
+
}
|
|
68
|
+
catch (err) {
|
|
69
|
+
console.warn(`⚠️ Could not write to GITHUB_STEP_SUMMARY: ${err}`);
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
// ── Keep the file around for debugging; optionally remove it ─────────
|
|
73
|
+
console.log(`📄 Detailed results: ${workflow_status_1.STATUS_FILE}`);
|
|
74
|
+
// ── GitHub Check Runs (one per suite) ────────────────────────────────
|
|
75
|
+
await (0, check_run_1.createCheckRuns)(data);
|
|
76
|
+
};
|
|
77
|
+
//# sourceMappingURL=global_teardown.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"global_teardown.js","sourceRoot":"","sources":["../src/global_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,EAAE,CAAC,CAAC;QACrE,CAAC;IACH,CAAC;IAED,wEAAwE;IACxE,OAAO,CAAC,GAAG,CAAC,wBAAwB,6BAAW,EAAE,CAAC,CAAC;IAEnD,wEAAwE;IACxE,MAAM,IAAA,2BAAe,EAAC,IAAI,CAAC,CAAC;AAC9B,CAAC,CAAC"}
|
package/dist/index.d.ts
CHANGED
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAC;AAC7B,cAAc,cAAc,CAAC;AAC7B,cAAc,YAAY,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAC;AAC7B,cAAc,cAAc,CAAC;AAC7B,cAAc,YAAY,CAAC;AAC3B,cAAc,qBAAqB,CAAC;AACpC,cAAc,mBAAmB,CAAC;AAClC,cAAc,aAAa,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -17,4 +17,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
17
17
|
__exportStar(require("./github-api"), exports);
|
|
18
18
|
__exportStar(require("./assertions"), exports);
|
|
19
19
|
__exportStar(require("./reporter"), exports);
|
|
20
|
+
__exportStar(require("./reusable_reporter"), exports);
|
|
21
|
+
__exportStar(require("./workflow_status"), exports);
|
|
22
|
+
__exportStar(require("./check_run"), exports);
|
|
20
23
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,+CAA6B;AAC7B,+CAA6B;AAC7B,6CAA2B"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,+CAA6B;AAC7B,+CAA6B;AAC7B,6CAA2B;AAC3B,sDAAoC;AACpC,oDAAkC;AAClC,8CAA4B"}
|
package/dist/reporter.d.ts
CHANGED
|
@@ -30,6 +30,23 @@ export declare class WorkflowTestReporter {
|
|
|
30
30
|
setRunId(runId: string | number): void;
|
|
31
31
|
loadAllJobsAndSteps(api: any): Promise<void>;
|
|
32
32
|
addJob(jobName: string): void;
|
|
33
|
+
/**
|
|
34
|
+
* Return an aggregated job count snapshot.
|
|
35
|
+
* Used by `registerWorkflowResult` to populate the cross-workflow status file
|
|
36
|
+
* without exposing the raw jobs map.
|
|
37
|
+
*/
|
|
38
|
+
getJobSummary(): {
|
|
39
|
+
total: number;
|
|
40
|
+
passed: number;
|
|
41
|
+
failed: number;
|
|
42
|
+
skipped: number;
|
|
43
|
+
};
|
|
44
|
+
/** Return per-job name + conclusion for cross-workflow diagnostic reporting. */
|
|
45
|
+
getJobDetails(): {
|
|
46
|
+
name: string;
|
|
47
|
+
conclusion: string | null;
|
|
48
|
+
}[];
|
|
49
|
+
getRunId(): string | undefined;
|
|
33
50
|
recordJobTest(jobName: string, passed: boolean, expected?: string, actual?: string): void;
|
|
34
51
|
recordStepTest(jobName: string, stepName: string, passed: boolean, expected?: string, actual?: string): void;
|
|
35
52
|
addArtifact(artifactName: string): void;
|
|
@@ -37,6 +54,17 @@ export declare class WorkflowTestReporter {
|
|
|
37
54
|
generateMarkdown(): string;
|
|
38
55
|
writeToGithubSummary(): void;
|
|
39
56
|
printReport(): void;
|
|
57
|
+
/**
|
|
58
|
+
* Group this.jobs by their reusable-workflow name and compute pass/fail/skipped counts.
|
|
59
|
+
*
|
|
60
|
+
* Grouping rule:
|
|
61
|
+
* - Job name contains " / " → first segment is the caller job name.
|
|
62
|
+
* Strip a leading "call-" prefix to get the reusable-wf group
|
|
63
|
+
* (e.g. "call-ci-scan / sonarqube / scan" → group "ci-scan",
|
|
64
|
+
* display name "sonarqube / scan").
|
|
65
|
+
* - No " / " in name → direct caller job, group "(caller)".
|
|
66
|
+
*/
|
|
67
|
+
private buildWorkflowRollup;
|
|
40
68
|
}
|
|
41
69
|
export declare function getReporter(workflowName?: string): WorkflowTestReporter;
|
|
42
70
|
export declare function resetReporter(): void;
|
package/dist/reporter.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"reporter.d.ts","sourceRoot":"","sources":["../src/reporter.ts"],"names":[],"mappings":"AAEA,MAAM,WAAW,UAAU;IACzB,MAAM,EAAE,OAAO,CAAC;IAChB,MAAM,EAAE,MAAM,CAAC;IACf,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,WAAW,SAAS;IACxB,MAAM,EAAE,OAAO,CAAC;IAChB,MAAM,EAAE,MAAM,CAAC;IACf,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,KAAK,EAAE;QAAE,CAAC,QAAQ,EAAE,MAAM,GAAG,UAAU,CAAA;KAAE,CAAC;CAC3C;AAED,MAAM,WAAW,cAAc;IAC7B,MAAM,EAAE,OAAO,CAAC;IAChB,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,EAAE,CAAC;CAClB;AAED,qBAAa,oBAAoB;IAC/B,OAAO,CAAC,YAAY,CAAS;IAC7B,OAAO,CAAC,IAAI,CAAwC;IACpD,OAAO,CAAC,SAAS,CAAkD;IACnE,OAAO,CAAC,KAAK,CAAC,CAAS;IACvB,OAAO,CAAC,aAAa,CAAS;gBAElB,YAAY,EAAE,MAAM;IAIhC,QAAQ,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI;IAIhC,mBAAmB,CAAC,GAAG,EAAE,GAAG,GAAG,OAAO,CAAC,IAAI,CAAC;IA4ClD,MAAM,C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