apify-test-tools 0.1.0 → 0.2.0
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/CHANGELOG.md +12 -0
- package/CONTRIBUTING.md +53 -0
- package/README.md +247 -17
- package/bin/git.ts +24 -5
- package/bin/main.ts +11 -1
- package/bin/types.ts +1 -0
- package/bin/utils.ts +15 -8
- package/dist/bin/git.d.ts +2 -0
- package/dist/bin/git.d.ts.map +1 -1
- package/dist/bin/git.js +22 -5
- package/dist/bin/git.js.map +1 -1
- package/dist/bin/main.js +9 -1
- package/dist/bin/main.js.map +1 -1
- package/dist/bin/types.d.ts +1 -0
- package/dist/bin/types.d.ts.map +1 -1
- package/dist/bin/utils.d.ts +3 -0
- package/dist/bin/utils.d.ts.map +1 -1
- package/dist/bin/utils.js +13 -8
- package/dist/bin/utils.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/lib/lib.d.ts +23 -1
- package/dist/lib/lib.d.ts.map +1 -1
- package/dist/lib/lib.js +110 -4
- package/dist/lib/lib.js.map +1 -1
- package/dist/lib/utils.d.ts +1 -0
- package/dist/lib/utils.d.ts.map +1 -1
- package/dist/lib/utils.js +3 -0
- package/dist/lib/utils.js.map +1 -1
- package/dist/test/unit/custom-matchers.test.js +23 -1
- package/dist/test/unit/custom-matchers.test.js.map +1 -1
- package/dist/test/unit/parse-commit.test.d.ts +2 -0
- package/dist/test/unit/parse-commit.test.d.ts.map +1 -0
- package/dist/test/unit/parse-commit.test.js +57 -0
- package/dist/test/unit/parse-commit.test.js.map +1 -0
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/index.ts +1 -1
- package/lib/lib.ts +137 -5
- package/lib/utils.ts +6 -1
- package/package.json +1 -1
- package/test/unit/custom-matchers.test.ts +25 -1
- package/test/unit/parse-commit.test.ts +73 -0
package/CHANGELOG.md
ADDED
package/CONTRIBUTING.md
ADDED
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
# Contributing
|
|
2
|
+
|
|
3
|
+
The package consists of two parts:
|
|
4
|
+
- cli located in `bin/`
|
|
5
|
+
- test library located in `lib`
|
|
6
|
+
|
|
7
|
+
## CLI
|
|
8
|
+
|
|
9
|
+
- `bin/build.ts` actor building
|
|
10
|
+
- `bin/git.ts` git wrappers for getting relevant git commits and changed files
|
|
11
|
+
- `bin/github.ts` github push event parsing
|
|
12
|
+
- `bin/main.ts` entrypoing
|
|
13
|
+
- `bin/slack.ts` sending notifications to slack
|
|
14
|
+
- `bin/test-report.ts` processing vitest's test reports
|
|
15
|
+
|
|
16
|
+
## Test library
|
|
17
|
+
|
|
18
|
+
- `lib/extend-expect.ts` - custom matchers
|
|
19
|
+
- `run-test-result.ts` - `RunTestResult` class that's the output of `run` function
|
|
20
|
+
- wrapper around run endpoints: `logLog`, `getStatistics`, `getDataset`, etc
|
|
21
|
+
|
|
22
|
+
### Development setup
|
|
23
|
+
|
|
24
|
+
1. Clone and build `apify-test-tools` repo:
|
|
25
|
+
```sh
|
|
26
|
+
git clone git@github.com:apify-projects/apify-test-tools.git
|
|
27
|
+
cd apify-test-tools
|
|
28
|
+
npm i
|
|
29
|
+
npm run build
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
For testing purposes, we use `testing-repo-for-github-actions` repo so that we don't mess with the production repos:
|
|
33
|
+
```sh
|
|
34
|
+
git clone git@github.com:apify-store/testing-repo-for-github-actions.git
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
#### Working on the CLI
|
|
38
|
+
|
|
39
|
+
To work on the library, you just need to define `GITHUB_WORKSPACE` to tell the cli where you repo is located:
|
|
40
|
+
```sh
|
|
41
|
+
export GITHUB_WORKSPACE=../path/to/testing-repo-for-github-actions # path to the repo
|
|
42
|
+
npx tsx bin/main.ts --help
|
|
43
|
+
npx tsx bin/main.ts get-commits --target-branch master --source-branch feat/testing-feature-branch
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
#### Working on the library
|
|
47
|
+
|
|
48
|
+
You need to istall the local version of `apify-test-tools` in your cloned `testing-repo-for-github-actions`:
|
|
49
|
+
```sh
|
|
50
|
+
npm i -D ../path/to/apify-test-tools
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
You need to run `npm run build` inside `apify-test-tools` repo everytime you want to test your changes in `testing-repo-for-github-actions`.
|
package/README.md
CHANGED
|
@@ -1,23 +1,253 @@
|
|
|
1
|
-
|
|
1
|
+
# Apify Test Tools
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
2. The GitHub actions server binary (which we don't control) is then triggered by GitHub action and that subsequently calls `main.ts` (via calling it from `.github/workflows/apify.yaml` and `gha:start:build` command). This runs rest of the code in the files.
|
|
3
|
+
[Contributing link](CONTRIBUTING.md)
|
|
5
4
|
|
|
6
|
-
##
|
|
7
|
-
1. Choose if you want to emulate PR or push to master workflow.
|
|
8
|
-
2. Copy appropriate example from `./example-github-events` to `INPUT.json`
|
|
9
|
-
3. To mimic actual PR or push you care about, you should update the input
|
|
10
|
-
- PR: Update `pull_request.head.ref` (source branch of the PR), `repository.full_name`, `pull_request.base.sha`, `pull_request.head.sha`
|
|
11
|
-
- push: Update `ref`, `repository.full_name`
|
|
12
|
-
4. Start the Actor with `TESTER_APIFY_TOKEN=<TOKEN> APIFY_TOKEN_${username}=<TOKEN> apify run -p` (possibly other apify users as well)
|
|
5
|
+
## Getting Started
|
|
13
6
|
|
|
14
|
-
|
|
15
|
-
|
|
7
|
+
1. Install the package `npm i -D apify-test-tools`
|
|
8
|
+
- because it uses [annotate](https://vitest.dev/guide/test-context.html#annotate), `vitest` version to be at least `3.2.0`
|
|
9
|
+
- make sure that `target` and `module` in your `tsconfig.json`'s `compilerOptions` are set to `ES2022`
|
|
10
|
+
2. create test directories: `mkdir -p test/platform/core`
|
|
11
|
+
- core (hourly) tests should go to `test/platform/core`
|
|
12
|
+
- daily tests should go to `test/platform`
|
|
13
|
+
3. setup github worklows TODO
|
|
16
14
|
|
|
17
|
-
|
|
18
|
-
|
|
15
|
+
File structure:
|
|
16
|
+
```
|
|
17
|
+
google-maps
|
|
18
|
+
├── actors
|
|
19
|
+
└── src
|
|
20
|
+
└── test
|
|
21
|
+
├── unit
|
|
22
|
+
└── platform
|
|
23
|
+
├── core <- Core tests need to be inside core directory
|
|
24
|
+
│ └── core.test.ts
|
|
25
|
+
├── some.test.ts <- Other tests can be defined anywhere inside platform directory
|
|
26
|
+
└── some-other.test.ts
|
|
27
|
+
```
|
|
19
28
|
|
|
20
|
-
|
|
29
|
+
## Github worklows
|
|
21
30
|
|
|
22
|
-
|
|
23
|
-
|
|
31
|
+
There should be 4 GH workflow files in `.github/workflows`.
|
|
32
|
+
|
|
33
|
+
### `platform-tests-core.yaml`
|
|
34
|
+
|
|
35
|
+
```yaml
|
|
36
|
+
name: Platform tests - Core
|
|
37
|
+
|
|
38
|
+
on:
|
|
39
|
+
schedule:
|
|
40
|
+
# Runs at the start of every hour
|
|
41
|
+
- cron: '0 * * * *'
|
|
42
|
+
workflow_dispatch:
|
|
43
|
+
|
|
44
|
+
jobs:
|
|
45
|
+
platformTestsCore:
|
|
46
|
+
uses: apify-store/github-actions-source/.github/workflows/platform-tests.yaml@new_master
|
|
47
|
+
with:
|
|
48
|
+
subtest: core
|
|
49
|
+
secrets: inherit
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
### `platform-tests-daily.yaml`
|
|
53
|
+
|
|
54
|
+
```yaml
|
|
55
|
+
name: Platform tests - Daily
|
|
56
|
+
|
|
57
|
+
on:
|
|
58
|
+
schedule:
|
|
59
|
+
# Runs at 00:00 UTC every day
|
|
60
|
+
- cron: '0 0 * * *'
|
|
61
|
+
workflow_dispatch:
|
|
62
|
+
|
|
63
|
+
jobs:
|
|
64
|
+
platformTestsDaily:
|
|
65
|
+
uses: apify-store/github-actions-source/.github/workflows/platform-tests.yaml@new_master
|
|
66
|
+
secrets: inherit
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
### `pr-build-devel-test.yaml`
|
|
70
|
+
|
|
71
|
+
```yaml
|
|
72
|
+
name: PR Test
|
|
73
|
+
|
|
74
|
+
on:
|
|
75
|
+
pull_request:
|
|
76
|
+
branches: [ master ]
|
|
77
|
+
|
|
78
|
+
jobs:
|
|
79
|
+
buildDevelAndTest:
|
|
80
|
+
uses: apify-store/github-actions-source/.github/workflows/pr-build-test.yaml@new_master
|
|
81
|
+
secrets: inherit
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
### `release-latest.yaml`
|
|
85
|
+
|
|
86
|
+
```yaml
|
|
87
|
+
name: Release latest
|
|
88
|
+
|
|
89
|
+
on:
|
|
90
|
+
push:
|
|
91
|
+
branches: [ master ]
|
|
92
|
+
|
|
93
|
+
jobs:
|
|
94
|
+
buildLatest:
|
|
95
|
+
uses: apify-store/github-actions-source/.github/workflows/push-build-latest.yaml@new_master
|
|
96
|
+
secrets: inherit
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
## Differences in writing tests
|
|
100
|
+
|
|
101
|
+
---
|
|
102
|
+
|
|
103
|
+
### Test structure
|
|
104
|
+
|
|
105
|
+
To run the tests concurrently, we had to start the run outside of `it` and then call `await` inside. This is now no longer needed and everything can be inside `it` aka `testActor`.
|
|
106
|
+
|
|
107
|
+
Before:
|
|
108
|
+
```ts
|
|
109
|
+
({ it, xit, run, expect, expectAsync, input, describe }: TestSpecInputs) => {
|
|
110
|
+
describe('test', () => {
|
|
111
|
+
{
|
|
112
|
+
const runPromise = run({ actorId, input })
|
|
113
|
+
it('actor test 1', async () => {
|
|
114
|
+
const runResult = await runPromise;
|
|
115
|
+
|
|
116
|
+
// your checks
|
|
117
|
+
});
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
{
|
|
121
|
+
const runPromise = run({ actorId, input })
|
|
122
|
+
it('actor test 2', async () => {
|
|
123
|
+
const runResult = await runPromise;
|
|
124
|
+
|
|
125
|
+
// your checks
|
|
126
|
+
});
|
|
127
|
+
}
|
|
128
|
+
});
|
|
129
|
+
})
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
After:
|
|
133
|
+
```ts
|
|
134
|
+
import { describe, testActor } from 'apify-test-tools';
|
|
135
|
+
|
|
136
|
+
describe('test', () => {
|
|
137
|
+
testActor(actorId, 'actor test 1', async ({ expect, run }) => {
|
|
138
|
+
const runResult = await run({ input })
|
|
139
|
+
|
|
140
|
+
// your checks
|
|
141
|
+
)};
|
|
142
|
+
|
|
143
|
+
testActor(actorId, 'actor test 2', async ({ expect, run }) => {
|
|
144
|
+
const runResult = await run({ input })
|
|
145
|
+
|
|
146
|
+
// your checks
|
|
147
|
+
)};
|
|
148
|
+
})
|
|
149
|
+
```
|
|
150
|
+
|
|
151
|
+
`testActor` extends `expect` with couple of custom matchers (e.g. `toFinishWith`) and provides `run` function call the correct actor, based on it’s first parameter
|
|
152
|
+
|
|
153
|
+
---
|
|
154
|
+
|
|
155
|
+
### Validating basic run attributes
|
|
156
|
+
|
|
157
|
+
Before:
|
|
158
|
+
```ts
|
|
159
|
+
await expectAsync(runResult).toHaveStatus('SUCCEEDED');
|
|
160
|
+
|
|
161
|
+
await expectAsync(runResult).withLog((log) => {
|
|
162
|
+
expect(log).not.toContain('ReferenceError');
|
|
163
|
+
expect(log).not.toContain('TypeError');
|
|
164
|
+
});
|
|
165
|
+
|
|
166
|
+
await expectAsync(runResult).withStatistics((stats) => {
|
|
167
|
+
expect(stats.requestsRetries)
|
|
168
|
+
.withContext(runResult.format('Request retries'))
|
|
169
|
+
.toBeLessThan(3);
|
|
170
|
+
expect(stats.crawlerRuntimeMillis)
|
|
171
|
+
.withContext(runResult.format('Run time'))
|
|
172
|
+
.toBeWithinRange(600, 600_000)
|
|
173
|
+
})
|
|
174
|
+
|
|
175
|
+
await expectAsync(runResult).withDataset(({ dataset }) => {
|
|
176
|
+
expect(dataset.items?.length)
|
|
177
|
+
.withContext(runResult.format('Dataset cleanItemCount'))
|
|
178
|
+
.toBe(100);
|
|
179
|
+
})
|
|
180
|
+
```
|
|
181
|
+
|
|
182
|
+
After:
|
|
183
|
+
```ts
|
|
184
|
+
await expect(runResult).toFinishWith({
|
|
185
|
+
datasetItemCount: 100,
|
|
186
|
+
})
|
|
187
|
+
```
|
|
188
|
+
|
|
189
|
+
You can also specify a range:
|
|
190
|
+
|
|
191
|
+
```ts
|
|
192
|
+
await expect(runResult).toFinishWith({
|
|
193
|
+
datasetItemCount: { min: 80, max: 120 },
|
|
194
|
+
})
|
|
195
|
+
```
|
|
196
|
+
|
|
197
|
+
Here is full example of what you can validate with `toFinishWith`
|
|
198
|
+
|
|
199
|
+
```ts
|
|
200
|
+
await expect(runResult).toFinishWith({
|
|
201
|
+
// These are default
|
|
202
|
+
status: 'SUCCEEDED',
|
|
203
|
+
duration: {
|
|
204
|
+
min: 600, // 0.6 sec
|
|
205
|
+
max: 600_000, // 10 min
|
|
206
|
+
},
|
|
207
|
+
failedRequests: 0,
|
|
208
|
+
requestsRetries: { max: 3 },
|
|
209
|
+
forbiddenLogs: [
|
|
210
|
+
'ReferenceError',
|
|
211
|
+
'TypeError',
|
|
212
|
+
],
|
|
213
|
+
|
|
214
|
+
// only datasetItemCount is required
|
|
215
|
+
datasetItemCount: { min: 80, max: 120 },
|
|
216
|
+
|
|
217
|
+
// optional
|
|
218
|
+
chargedEventCounts: {
|
|
219
|
+
'actor-start': 1,
|
|
220
|
+
'place-scraped': 9,
|
|
221
|
+
},
|
|
222
|
+
})
|
|
223
|
+
```
|
|
224
|
+
|
|
225
|
+
---
|
|
226
|
+
|
|
227
|
+
### Custom validations
|
|
228
|
+
|
|
229
|
+
Before:
|
|
230
|
+
```ts
|
|
231
|
+
expect(place.title)
|
|
232
|
+
.withContext(runResult.format(`London Eye's title`))
|
|
233
|
+
.toEqual('lastminute.com London Eye')
|
|
234
|
+
```
|
|
235
|
+
|
|
236
|
+
After:
|
|
237
|
+
```ts
|
|
238
|
+
expect(place.title, `London Eye's title`).toEqual('lastminute.com London Eye')
|
|
239
|
+
```
|
|
240
|
+
|
|
241
|
+
---
|
|
242
|
+
|
|
243
|
+
### Custom validation functions
|
|
244
|
+
|
|
245
|
+
You can now create your own functions wrapping a common validation logic in e.g. `test/platform/utils.ts` and import it in test files.
|
|
246
|
+
|
|
247
|
+
```ts
|
|
248
|
+
import { ExpectStatic } from 'apify-test-tools'
|
|
249
|
+
|
|
250
|
+
export const validateItem = (expect: ExpectStatic, item: any) {
|
|
251
|
+
expect(item.title, 'Item title').toBeString();
|
|
252
|
+
}
|
|
253
|
+
```
|
package/bin/git.ts
CHANGED
|
@@ -1,11 +1,14 @@
|
|
|
1
1
|
import { Commit, Config } from './types';
|
|
2
2
|
import { spawnCommandInGhWorkspace } from './utils.js';
|
|
3
3
|
|
|
4
|
-
const
|
|
4
|
+
export const GIT_FORMAT_SEPARATOR = '»¦«';
|
|
5
|
+
const GIT_LOG_FORMAT = ['%H', '%aN<%aE>', '%aD', '%s'].join(GIT_FORMAT_SEPARATOR);
|
|
6
|
+
|
|
5
7
|
|
|
6
8
|
export const getBranchLastCommit = (branch: string): Commit => {
|
|
7
|
-
const
|
|
8
|
-
|
|
9
|
+
const commitString = spawnCommandInGhWorkspace(`git log -1 --pretty=format:'${GIT_LOG_FORMAT}' ${branch}`);
|
|
10
|
+
const commit = parseCommit(commitString);
|
|
11
|
+
return commit;
|
|
9
12
|
};
|
|
10
13
|
|
|
11
14
|
export const getChangedFiles = (commits: Commit[]) => {
|
|
@@ -37,7 +40,7 @@ export const getCommits = ({
|
|
|
37
40
|
const base = getBaseCommit(sourceBranchCommit, targetBranchCommit);
|
|
38
41
|
const commitsStrings = spawnCommandInGhWorkspace(`git log --pretty=format:'${GIT_LOG_FORMAT}' ${base.sha}..${sourceBranchCommit.sha}`)
|
|
39
42
|
.split('\n');
|
|
40
|
-
const commits =
|
|
43
|
+
const commits = commitsStrings.map((commitString) => parseCommit(commitString)) as Commit[];
|
|
41
44
|
commits.reverse();
|
|
42
45
|
const baseCommitIndex = baseCommit
|
|
43
46
|
? commits.findIndex(({ sha }) => sha === baseCommit.sha)
|
|
@@ -52,5 +55,21 @@ export const getBaseCommit = (target: Commit, source: Commit): Commit => {
|
|
|
52
55
|
};
|
|
53
56
|
|
|
54
57
|
export const getCommitInfo = (commitSha: string): Commit => {
|
|
55
|
-
|
|
58
|
+
const commitString = spawnCommandInGhWorkspace(`git log -1 --pretty=format:'${GIT_LOG_FORMAT}' ${commitSha}`);
|
|
59
|
+
const commit = parseCommit(commitString);
|
|
60
|
+
return commit;
|
|
56
61
|
};
|
|
62
|
+
|
|
63
|
+
export const parseCommit = (commitString: string): Commit => {
|
|
64
|
+
const splits = commitString.split(GIT_FORMAT_SEPARATOR);
|
|
65
|
+
if (splits.length !== 4) {
|
|
66
|
+
throw new Error(`Failed to parse commit string: ${commitString}`);
|
|
67
|
+
}
|
|
68
|
+
const [sha, author, date, message] = splits;
|
|
69
|
+
return {
|
|
70
|
+
sha,
|
|
71
|
+
author,
|
|
72
|
+
date,
|
|
73
|
+
message,
|
|
74
|
+
};
|
|
75
|
+
}
|
package/bin/main.ts
CHANGED
|
@@ -8,6 +8,7 @@ import {
|
|
|
8
8
|
getRepoActors,
|
|
9
9
|
getChangedActors,
|
|
10
10
|
spawnCommandInGhWorkspace,
|
|
11
|
+
setCwd,
|
|
11
12
|
} from './utils.js';
|
|
12
13
|
import { runBuilds } from './build.js';
|
|
13
14
|
import { getChangedFiles, getCommits } from './git.js';
|
|
@@ -15,6 +16,11 @@ import { getPushData } from './github.js';
|
|
|
15
16
|
import { notifyToSlack } from './slack.js';
|
|
16
17
|
import { reportTestRestuls } from './test-report.js';
|
|
17
18
|
|
|
19
|
+
/**
|
|
20
|
+
* Middlewares to be run before every command execution
|
|
21
|
+
*/
|
|
22
|
+
const middlewares = [setCwd];
|
|
23
|
+
|
|
18
24
|
const buildOptions = (y: yargs.Argv) => {
|
|
19
25
|
return y
|
|
20
26
|
.option('target-branch', {
|
|
@@ -27,7 +33,7 @@ const buildOptions = (y: yargs.Argv) => {
|
|
|
27
33
|
})
|
|
28
34
|
.option('base-commit', {
|
|
29
35
|
type: 'string',
|
|
30
|
-
})
|
|
36
|
+
})
|
|
31
37
|
};
|
|
32
38
|
|
|
33
39
|
await yargs()
|
|
@@ -36,6 +42,10 @@ await yargs()
|
|
|
36
42
|
type: 'boolean',
|
|
37
43
|
default: false,
|
|
38
44
|
})
|
|
45
|
+
.option('workspace', {
|
|
46
|
+
type: 'string',
|
|
47
|
+
})
|
|
48
|
+
.middleware(middlewares)
|
|
39
49
|
.command('get-commits', '', buildOptions, (args) => {
|
|
40
50
|
const commits = getCommits(args);
|
|
41
51
|
console.log(JSON.stringify(commits));
|
package/bin/types.ts
CHANGED
package/bin/utils.ts
CHANGED
|
@@ -2,23 +2,22 @@ import fs from 'node:fs/promises';
|
|
|
2
2
|
import { spawnSync } from 'node:child_process';
|
|
3
3
|
import type {
|
|
4
4
|
ActorConfig,
|
|
5
|
+
Commit,
|
|
5
6
|
GitHubEvent,
|
|
6
7
|
} from './types.js';
|
|
7
8
|
|
|
8
9
|
export const spawnCommandInGhWorkspace = (command: string, args: string[] = []) => {
|
|
9
10
|
console.error(command, args.join(' '));
|
|
10
|
-
const
|
|
11
|
-
const commandInGhWorkspace = `cd ${ghWorkspace}; ${command}`;
|
|
12
|
-
const commandResult = spawnSync(commandInGhWorkspace, args, { shell: true, maxBuffer: 100 * 1024 * 1024 });
|
|
11
|
+
const commandResult = spawnSync(command, args, { shell: true, maxBuffer: 100 * 1024 * 1024 });
|
|
13
12
|
|
|
14
13
|
if (commandResult.error) {
|
|
15
|
-
throw new Error(`[Command failed]: ${
|
|
14
|
+
throw new Error(`[Command failed]: ${command}\n${commandResult.error}`);
|
|
16
15
|
}
|
|
17
16
|
|
|
18
17
|
if (commandResult.stderr.toString().length > 0) {
|
|
19
18
|
// For some reason 'git' command prints stderr when checking out to detached HEAD state (we only use detached HEAD for testing though)
|
|
20
19
|
if (!commandResult.stderr.toString().includes(`You are in 'detached HEAD' state`)) {
|
|
21
|
-
throw new Error(`[Command printed stderr]: ${
|
|
20
|
+
throw new Error(`[Command printed stderr]: ${command}\n${commandResult.stderr.toString()}`);
|
|
22
21
|
}
|
|
23
22
|
}
|
|
24
23
|
|
|
@@ -47,17 +46,16 @@ export const getRunUrlKvsKey = (runnerName: string) => {
|
|
|
47
46
|
* This works locally if checkoutRepoLocally is called first
|
|
48
47
|
*/
|
|
49
48
|
export const getRepoActors = async (): Promise<ActorConfig[]> => {
|
|
50
|
-
const ghWorkspace = getEnvVar('GITHUB_WORKSPACE');
|
|
51
49
|
let actorDirs: string[];
|
|
52
50
|
try {
|
|
53
|
-
actorDirs = (await fs.readdir(
|
|
51
|
+
actorDirs = (await fs.readdir(`./actors`)).map((dir) => `actors/${dir}`);
|
|
54
52
|
} catch (err) {
|
|
55
53
|
console.warn(`No /actors directory found in repo`);
|
|
56
54
|
actorDirs = [];
|
|
57
55
|
}
|
|
58
56
|
let standaloneActorDirs: string[];
|
|
59
57
|
try {
|
|
60
|
-
standaloneActorDirs = (await fs.readdir(
|
|
58
|
+
standaloneActorDirs = (await fs.readdir(`./standalone-actors`)).map((dir) => `standalone-actors/${dir}`);
|
|
61
59
|
} catch (err) {
|
|
62
60
|
console.warn(`No /standalone-actors directory found in repo`);
|
|
63
61
|
standaloneActorDirs = [];
|
|
@@ -80,6 +78,15 @@ export const getRepoActors = async (): Promise<ActorConfig[]> => {
|
|
|
80
78
|
return actorConfigs;
|
|
81
79
|
};
|
|
82
80
|
|
|
81
|
+
export const setCwd = ({ workspace }: { workspace: string | undefined }) => {
|
|
82
|
+
if (workspace) {
|
|
83
|
+
process.chdir(workspace);
|
|
84
|
+
return;
|
|
85
|
+
}
|
|
86
|
+
const ghWorkspace = getEnvVar('GITHUB_WORKSPACE', process.cwd());
|
|
87
|
+
process.chdir(ghWorkspace);
|
|
88
|
+
}
|
|
89
|
+
|
|
83
90
|
export const getHeadCommitSha = (githubEvent: GitHubEvent) => {
|
|
84
91
|
return githubEvent.type === 'pull_request'
|
|
85
92
|
? githubEvent.pull_request.head.sha
|
package/dist/bin/git.d.ts
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import { Commit, Config } from './types';
|
|
2
|
+
export declare const GIT_FORMAT_SEPARATOR = "\u00BB\u00A6\u00AB";
|
|
2
3
|
export declare const getBranchLastCommit: (branch: string) => Commit;
|
|
3
4
|
export declare const getChangedFiles: (commits: Commit[]) => string[];
|
|
4
5
|
export declare const getCommits: ({ sourceBranch, targetBranch, baseCommit: baseCommitSha, }: Config) => Commit[];
|
|
5
6
|
export declare const getBaseCommit: (target: Commit, source: Commit) => Commit;
|
|
6
7
|
export declare const getCommitInfo: (commitSha: string) => Commit;
|
|
8
|
+
export declare const parseCommit: (commitString: string) => Commit;
|
|
7
9
|
//# sourceMappingURL=git.d.ts.map
|
package/dist/bin/git.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"git.d.ts","sourceRoot":"","sources":["../../bin/git.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"git.d.ts","sourceRoot":"","sources":["../../bin/git.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AAGzC,eAAO,MAAM,oBAAoB,uBAAQ,CAAC;AAI1C,eAAO,MAAM,mBAAmB,WAAY,MAAM,KAAG,MAIpD,CAAC;AAEF,eAAO,MAAM,eAAe,YAAa,MAAM,EAAE,aAKhD,CAAC;AAEF,eAAO,MAAM,UAAU,+DAIpB,MAAM,KAAG,MAAM,EAwBjB,CAAC;AAEF,eAAO,MAAM,aAAa,WAAY,MAAM,UAAU,MAAM,KAAG,MAI9D,CAAC;AAEF,eAAO,MAAM,aAAa,cAAe,MAAM,KAAG,MAIjD,CAAC;AAEF,eAAO,MAAM,WAAW,iBAAkB,MAAM,KAAG,MAYlD,CAAA"}
|
package/dist/bin/git.js
CHANGED
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import { spawnCommandInGhWorkspace } from './utils.js';
|
|
2
|
-
const
|
|
2
|
+
export const GIT_FORMAT_SEPARATOR = '»¦«';
|
|
3
|
+
const GIT_LOG_FORMAT = ['%H', '%aN<%aE>', '%aD', '%s'].join(GIT_FORMAT_SEPARATOR);
|
|
3
4
|
export const getBranchLastCommit = (branch) => {
|
|
4
|
-
const
|
|
5
|
-
|
|
5
|
+
const commitString = spawnCommandInGhWorkspace(`git log -1 --pretty=format:'${GIT_LOG_FORMAT}' ${branch}`);
|
|
6
|
+
const commit = parseCommit(commitString);
|
|
7
|
+
return commit;
|
|
6
8
|
};
|
|
7
9
|
export const getChangedFiles = (commits) => {
|
|
8
10
|
const changedFiles = commits.length === 1
|
|
@@ -29,7 +31,7 @@ export const getCommits = ({ sourceBranch, targetBranch, baseCommit: baseCommitS
|
|
|
29
31
|
const base = getBaseCommit(sourceBranchCommit, targetBranchCommit);
|
|
30
32
|
const commitsStrings = spawnCommandInGhWorkspace(`git log --pretty=format:'${GIT_LOG_FORMAT}' ${base.sha}..${sourceBranchCommit.sha}`)
|
|
31
33
|
.split('\n');
|
|
32
|
-
const commits =
|
|
34
|
+
const commits = commitsStrings.map((commitString) => parseCommit(commitString));
|
|
33
35
|
commits.reverse();
|
|
34
36
|
const baseCommitIndex = baseCommit
|
|
35
37
|
? commits.findIndex(({ sha }) => sha === baseCommit.sha)
|
|
@@ -42,6 +44,21 @@ export const getBaseCommit = (target, source) => {
|
|
|
42
44
|
return baseCommit;
|
|
43
45
|
};
|
|
44
46
|
export const getCommitInfo = (commitSha) => {
|
|
45
|
-
|
|
47
|
+
const commitString = spawnCommandInGhWorkspace(`git log -1 --pretty=format:'${GIT_LOG_FORMAT}' ${commitSha}`);
|
|
48
|
+
const commit = parseCommit(commitString);
|
|
49
|
+
return commit;
|
|
50
|
+
};
|
|
51
|
+
export const parseCommit = (commitString) => {
|
|
52
|
+
const splits = commitString.split(GIT_FORMAT_SEPARATOR);
|
|
53
|
+
if (splits.length !== 4) {
|
|
54
|
+
throw new Error(`Failed to parse commit string: ${commitString}`);
|
|
55
|
+
}
|
|
56
|
+
const [sha, author, date, message] = splits;
|
|
57
|
+
return {
|
|
58
|
+
sha,
|
|
59
|
+
author,
|
|
60
|
+
date,
|
|
61
|
+
message,
|
|
62
|
+
};
|
|
46
63
|
};
|
|
47
64
|
//# sourceMappingURL=git.js.map
|
package/dist/bin/git.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"git.js","sourceRoot":"","sources":["../../bin/git.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,yBAAyB,EAAE,MAAM,YAAY,CAAC;AAEvD,MAAM,cAAc,GAAG,
|
|
1
|
+
{"version":3,"file":"git.js","sourceRoot":"","sources":["../../bin/git.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,yBAAyB,EAAE,MAAM,YAAY,CAAC;AAEvD,MAAM,CAAC,MAAM,oBAAoB,GAAG,KAAK,CAAC;AAC1C,MAAM,cAAc,GAAG,CAAC,IAAI,EAAE,UAAU,EAAE,KAAK,EAAE,IAAI,CAAC,CAAC,IAAI,CAAC,oBAAoB,CAAC,CAAC;AAGlF,MAAM,CAAC,MAAM,mBAAmB,GAAG,CAAC,MAAc,EAAU,EAAE;IAC1D,MAAM,YAAY,GAAG,yBAAyB,CAAC,+BAA+B,cAAc,KAAK,MAAM,EAAE,CAAC,CAAC;IAC3G,MAAM,MAAM,GAAG,WAAW,CAAC,YAAY,CAAC,CAAC;IACzC,OAAO,MAAM,CAAC;AAClB,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,OAAiB,EAAE,EAAE;IACjD,MAAM,YAAY,GAAG,OAAO,CAAC,MAAM,KAAK,CAAC;QACrC,CAAC,CAAC,yBAAyB,CAAC,2CAA2C,OAAO,CAAC,CAAC,CAAC,CAAC,GAAG,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3
|
import yargs from 'yargs';
|
|
4
4
|
import { hideBin } from 'yargs/helpers';
|
|
5
|
-
import { getRepoActors, getChangedActors, spawnCommandInGhWorkspace, } from './utils.js';
|
|
5
|
+
import { getRepoActors, getChangedActors, spawnCommandInGhWorkspace, setCwd, } from './utils.js';
|
|
6
6
|
import { runBuilds } from './build.js';
|
|
7
7
|
import { getChangedFiles, getCommits } from './git.js';
|
|
8
8
|
import { getPushData } from './github.js';
|
|
9
9
|
import { notifyToSlack } from './slack.js';
|
|
10
10
|
import { reportTestRestuls } from './test-report.js';
|
|
11
|
+
/**
|
|
12
|
+
* Middlewares to be run before every command execution
|
|
13
|
+
*/
|
|
14
|
+
const middlewares = [setCwd];
|
|
11
15
|
const buildOptions = (y) => {
|
|
12
16
|
return y
|
|
13
17
|
.option('target-branch', {
|
|
@@ -28,6 +32,10 @@ await yargs()
|
|
|
28
32
|
type: 'boolean',
|
|
29
33
|
default: false,
|
|
30
34
|
})
|
|
35
|
+
.option('workspace', {
|
|
36
|
+
type: 'string',
|
|
37
|
+
})
|
|
38
|
+
.middleware(middlewares)
|
|
31
39
|
.command('get-commits', '', buildOptions, (args) => {
|
|
32
40
|
const commits = getCommits(args);
|
|
33
41
|
console.log(JSON.stringify(commits));
|
package/dist/bin/main.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"main.js","sourceRoot":"","sources":["../../bin/main.ts"],"names":[],"mappings":";AAEA,OAAO,OAAO,MAAM,SAAS,CAAC;AAC9B,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AAExC,OAAO,EACH,aAAa,EACb,gBAAgB,EAChB,yBAAyB,
|
|
1
|
+
{"version":3,"file":"main.js","sourceRoot":"","sources":["../../bin/main.ts"],"names":[],"mappings":";AAEA,OAAO,OAAO,MAAM,SAAS,CAAC;AAC9B,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,OAAO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ACZ,OAAO;QACP,SAAS;QACT,UAAU;QACV,MAAM;KACT,CAAC,CAAC;AACP,CAAC,CAAC;KACL,cAAc,EAAE;KAChB,aAAa,CAAC,CAAC,EAAE,qBAAqB,CAAC;KACvC,KAAK,CAAC,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC"}
|
package/dist/bin/types.d.ts
CHANGED
package/dist/bin/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../bin/types.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,MAAM;IACnB,YAAY,EAAE,MAAM,CAAA;IACpB,YAAY,EAAE,MAAM,CAAA;IACpB,UAAU,CAAC,EAAE,MAAM,CAAA;
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../bin/types.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,MAAM;IACnB,YAAY,EAAE,MAAM,CAAA;IACpB,YAAY,EAAE,MAAM,CAAA;IACpB,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,SAAS,CAAC,EAAE,MAAM,CAAA;CACrB;AAED,MAAM,MAAM,MAAM,GAAG;IACjB,GAAG,EAAE,MAAM,CAAA;IACX,MAAM,EAAE,MAAM,CAAA;IACd,IAAI,EAAE,MAAM,CAAA;IACZ,OAAO,EAAE,MAAM,CAAA;CAClB,CAAA;AAGD,MAAM,WAAW,gBAAgB;IAC7B,KAAK,EAAE,MAAM,EAAE,CAAA;IACf,OAAO,EAAE,MAAM,EAAE,CAAA;IACjB,QAAQ,EAAE,MAAM,EAAE,CAAC;IACnB,MAAM,EAAE;QACJ,IAAI,EAAE,MAAM,CAAA;KACf,CAAC;IACF,OAAO,EAAE,MAAM,CAAC;IAChB,EAAE,EAAE,MAAM,CAAC;CACd;AAED,MAAM,WAAW,UAAU;IACvB,SAAS,EAAE,MAAM,CAAA;IACjB,IAAI,EAAE,MAAM,CAAA;IACZ,OAAO,EAAE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AAA;QACb,QAAQ,EAAE,MAAM,CAAA;KACnB,CAAA;IACD,KAAK,EAAE,MAAM,EAAE,CAAA;IACf,OAAO,EAAE,MAAM,EAAE,CAAA;IACjB,QAAQ,EAAE,MAAM,EAAE,CAAA;CACrB;AAED,MAAM,WAAW,SAAS;IACtB,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,EAAE,MAAM,CAAC;IAElB,WAAW,EAAE,MAAM,CAAC;CACvB;AAED,MAAM,WAAW,WAAW;IACxB,SAAS,EAAE,MAAM,CAAC;IAClB,MAAM,EAAE,MAAM,CAAC;IACf,YAAY,EAAE,OAAO,CAAA;CACxB"}
|
package/dist/bin/utils.d.ts
CHANGED
|
@@ -8,6 +8,9 @@ export declare const getRunUrlKvsKey: (runnerName: string) => string;
|
|
|
8
8
|
* This works locally if checkoutRepoLocally is called first
|
|
9
9
|
*/
|
|
10
10
|
export declare const getRepoActors: () => Promise<ActorConfig[]>;
|
|
11
|
+
export declare const setCwd: ({ workspace }: {
|
|
12
|
+
workspace: string | undefined;
|
|
13
|
+
}) => void;
|
|
11
14
|
export declare const getHeadCommitSha: (githubEvent: GitHubEvent) => string;
|
|
12
15
|
export interface GetChangedActorsResult {
|
|
13
16
|
actorsChanged: ActorConfig[];
|