gha-workflow-testing 1.0.0 → 1.0.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/package.json +3 -4
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
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "gha-workflow-testing",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.1",
|
|
4
4
|
"description": "TypeScript library for testing GitHub Actions workflows with detailed reporting",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -17,10 +17,9 @@
|
|
|
17
17
|
"workflow",
|
|
18
18
|
"testing",
|
|
19
19
|
"ci-cd",
|
|
20
|
-
"typescript"
|
|
21
|
-
"dops"
|
|
20
|
+
"typescript"
|
|
22
21
|
],
|
|
23
|
-
"author": "
|
|
22
|
+
"author": "Rohit Patil",
|
|
24
23
|
"license": "MIT",
|
|
25
24
|
"files": [
|
|
26
25
|
"dist",
|