Skip to content

Commit 0959437

Browse files
authored
Merge pull request #26 from kamal-kaur04/master
Add Sanity workflow SDK ~ GitHub Actions
2 parents 634fa0b + 9aa8485 commit 0959437

File tree

1 file changed

+104
-0
lines changed

1 file changed

+104
-0
lines changed

.github/workflows/sanity-workflow.yml

Lines changed: 104 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,104 @@
1+
# This job is to test different maven profiles in sdk branch against full commit-id provided
2+
# This workflow targets Appium execution
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+
13+
jobs:
14+
comment-run:
15+
runs-on: ${{ matrix.os }}
16+
strategy:
17+
fail-fast: false
18+
max-parallel: 3
19+
matrix:
20+
node: ['14', '16', '18']
21+
os: [ macos-latest, windows-latest, ubuntu-latest ]
22+
name: NodeJS Appium Repo ${{ matrix.node }} - ${{ matrix.os }} Sample
23+
env:
24+
BROWSERSTACK_USERNAME: ${{ secrets.BROWSERSTACK_USERNAME }}
25+
BROWSERSTACK_ACCESS_KEY: ${{ secrets.BROWSERSTACK_ACCESS_KEY }}
26+
27+
steps:
28+
- uses: actions/checkout@v3
29+
with:
30+
ref: ${{ github.event.inputs.commit_sha }}
31+
- uses: actions/github-script@98814c53be79b1d30f795b907e553d8679345975
32+
id: status-check-in-progress
33+
env:
34+
job_name: NodeJS Appium Repo ${{ matrix.node }} - ${{ matrix.os }} Sample
35+
commit_sha: ${{ github.event.inputs.commit_sha }}
36+
with:
37+
github-token: ${{ github.token }}
38+
script: |
39+
const result = await github.rest.checks.create({
40+
owner: context.repo.owner,
41+
repo: context.repo.repo,
42+
name: process.env.job_name,
43+
head_sha: process.env.commit_sha,
44+
status: 'in_progress'
45+
}).catch((err) => ({status: err.status, response: err.response}));
46+
console.log(`The status-check response : ${result.status} Response : ${JSON.stringify(result.response)}`)
47+
if (result.status !== 201) {
48+
console.log('Failed to create check run')
49+
}
50+
- name: Setup node
51+
uses: actions/setup-node@v3
52+
with:
53+
node-version: ${{ matrix.node }}
54+
55+
- name: Run sample android tests
56+
run: |
57+
cd android
58+
npm install
59+
npm run sample-test
60+
61+
- name: Run local android tests
62+
run: |
63+
cd android
64+
npm install
65+
npm run sample-local-test
66+
env:
67+
BROWSERSTACK_APP: ./LocalSample.apk
68+
69+
- name: Run sample ios tests
70+
run: |
71+
cd ios
72+
npm install
73+
npm run sample-test
74+
75+
- name: Run local ios tests
76+
run: |
77+
cd ios
78+
npm install
79+
npm run sample-local-test
80+
env:
81+
BROWSERSTACK_APP: ./LocalSample.ipa
82+
83+
- if: always()
84+
uses: actions/github-script@98814c53be79b1d30f795b907e553d8679345975
85+
id: status-check-completed
86+
env:
87+
conclusion: ${{ job.status }}
88+
job_name: NodeJS Appium Repo ${{ matrix.node }} - ${{ matrix.os }} Sample
89+
commit_sha: ${{ github.event.inputs.commit_sha }}
90+
with:
91+
github-token: ${{ github.token }}
92+
script: |
93+
const result = await github.rest.checks.create({
94+
owner: context.repo.owner,
95+
repo: context.repo.repo,
96+
name: process.env.job_name,
97+
head_sha: process.env.commit_sha,
98+
status: 'completed',
99+
conclusion: process.env.conclusion
100+
}).catch((err) => ({status: err.status, response: err.response}));
101+
console.log(`The status-check response : ${result.status} Response : ${JSON.stringify(result.response)}`)
102+
if (result.status !== 201) {
103+
console.log('Failed to create check run')
104+
}

0 commit comments

Comments
 (0)