-
Notifications
You must be signed in to change notification settings - Fork 24
101 lines (92 loc) · 3.71 KB
/
reviewing_changes.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
# This job is to test different npm profiles in main branch against Pull Requests raised
# This workflow targets jest-js
name: NodeJS SDK Test workflow on workflow_dispatch
on:
workflow_dispatch:
inputs:
commit_sha:
description: 'The full commit id to build'
required: true
package_url:
description: 'Staging package url'
required: false
jobs:
comment-run:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
max-parallel: 3
matrix:
node: ['14', '16', '18', '20']
os: [ macos-latest, windows-latest, ubuntu-latest ]
name: Jest-js Repo ${{ matrix.node }} - ${{ matrix.os }} Sample
env:
BROWSERSTACK_USERNAME: ${{ secrets.BROWSERSTACK_USERNAME }}
BROWSERSTACK_ACCESS_KEY: ${{ secrets.BROWSERSTACK_ACCESS_KEY }}
PACKAGE_URL: ${{ github.event.inputs.package_url }}
steps:
- uses: actions/checkout@v3
with:
ref: ${{ github.event.inputs.commit_sha }}
- uses: actions/github-script@98814c53be79b1d30f795b907e553d8679345975
id: status-check-in-progress
env:
job_name: Jest-js Repo ${{ matrix.node }} - ${{ matrix.os }} Sample
commit_sha: ${{ github.event.inputs.commit_sha }}
with:
github-token: ${{ github.token }}
script: |
const result = await github.rest.checks.create({
owner: context.repo.owner,
repo: context.repo.repo,
name: process.env.job_name,
head_sha: process.env.commit_sha,
status: 'in_progress'
}).catch((err) => ({status: err.status, response: err.response}));
console.log(`The status-check response : ${result.status} Response : ${JSON.stringify(result.response)}`)
if (result.status !== 201) {
console.log('Failed to create check run')
}
- name: Setup node
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node }}
- name: Setup staging npm package
if: ${{ github.event.inputs.package_url != '' }}
run: |
echo 'Publishing tar.gz to local registry'
curl -o staging_package.tgz "$PACKAGE_URL"
npm install [email protected] -g
verdaccio &
npm config set registry http://localhost:4873
npm install -g npm-cli-adduser && npm-cli-adduser -u dummy -p dummy -e [email protected] -r http://localhost:4873
npm publish staging_package.tgz --registry http://localhost:4873/
shell: bash
- name: Install dependencies
run: npm install
- name: Run sample tests
run: npm run sample-test
- name: Run local tests
run: npm run sample-local-test
- if: always()
uses: actions/github-script@98814c53be79b1d30f795b907e553d8679345975
id: status-check-completed
env:
conclusion: ${{ job.status }}
job_name: Jest-js Repo ${{ matrix.node }} - ${{ matrix.os }} Sample
commit_sha: ${{ github.event.inputs.commit_sha }}
with:
github-token: ${{ github.token }}
script: |
const result = await github.rest.checks.create({
owner: context.repo.owner,
repo: context.repo.repo,
name: process.env.job_name,
head_sha: process.env.commit_sha,
status: 'completed',
conclusion: process.env.conclusion
}).catch((err) => ({status: err.status, response: err.response}));
console.log(`The status-check response : ${result.status} Response : ${JSON.stringify(result.response)}`)
if (result.status !== 201) {
console.log('Failed to create check run')
}