Skip to content

Commit 71a2c90

Browse files
Add workflow file
1 parent 3f6159b commit 71a2c90

File tree

1 file changed

+123
-0
lines changed

1 file changed

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

0 commit comments

Comments
 (0)