Skip to content

Commit 2e4493e

Browse files
authored
Merge pull request #15 from kamal-kaur04/master
Add sanity workflow ~ SDK
2 parents c5c8930 + d29385f commit 2e4493e

File tree

1 file changed

+99
-0
lines changed

1 file changed

+99
-0
lines changed

.github/workflows/sanity-workflow.yml

Lines changed: 99 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,99 @@
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: Python 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+
python: ['3.7', '3.10', '3.11']
21+
os: [ macos-latest, windows-latest, ubuntu-latest ]
22+
name: Python Appium Repo ${{ matrix.python }} - ${{ 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: Python Appium Repo ${{ matrix.python }} - ${{ 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 python
51+
uses: actions/setup-python@v4
52+
with:
53+
python-version: ${{ matrix.python }}
54+
55+
- name: Install dependencies
56+
run: python -m pip install -r requirements.txt
57+
58+
- name: run tests in parallel on android
59+
run: |
60+
cd android
61+
browserstack-sdk python browserstack_sample.py
62+
63+
- name: run local tests in parallel on android
64+
run: |
65+
cd android
66+
browserstack-sdk python browserstack_sample_local.py --browserstack.app "./LocalSample.apk"
67+
68+
- name: run tests in parallel on ios
69+
run: |
70+
cd ios
71+
browserstack-sdk python browserstack_sample.py
72+
73+
- name: run local tests in parallel on ios
74+
run: |
75+
cd ios
76+
browserstack-sdk python browserstack_sample_local.py --browserstack.app "./LocalSample.ipa"
77+
78+
- if: always()
79+
uses: actions/github-script@98814c53be79b1d30f795b907e553d8679345975
80+
id: status-check-completed
81+
env:
82+
conclusion: ${{ job.status }}
83+
job_name: Python Appium Repo ${{ matrix.python }} - ${{ matrix.os }} Sample
84+
commit_sha: ${{ github.event.inputs.commit_sha }}
85+
with:
86+
github-token: ${{ github.token }}
87+
script: |
88+
const result = await github.rest.checks.create({
89+
owner: context.repo.owner,
90+
repo: context.repo.repo,
91+
name: process.env.job_name,
92+
head_sha: process.env.commit_sha,
93+
status: 'completed',
94+
conclusion: process.env.conclusion
95+
}).catch((err) => ({status: err.status, response: err.response}));
96+
console.log(`The status-check response : ${result.status} Response : ${JSON.stringify(result.response)}`)
97+
if (result.status !== 201) {
98+
console.log('Failed to create check run')
99+
}

0 commit comments

Comments
 (0)