Python SDK Test workflow on workflow_dispatch #18
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# This job is to test different maven profiles in sdk branch against full commit-id provided | |
# This workflow targets Appium execution | |
name: Python SDK Test workflow on workflow_dispatch | |
on: | |
workflow_dispatch: | |
inputs: | |
commit_sha: | |
description: 'The full commit id to build' | |
required: true | |
jobs: | |
comment-run: | |
runs-on: ${{ matrix.os }} | |
strategy: | |
fail-fast: false | |
max-parallel: 3 | |
matrix: | |
python: ['3.7', '3.10', '3.11'] | |
os: [ macos-latest, windows-latest, ubuntu-latest ] | |
name: Python Appium Repo ${{ matrix.python }} - ${{ matrix.os }} Sample | |
env: | |
BROWSERSTACK_USERNAME: ${{ secrets.BROWSERSTACK_USERNAME }} | |
BROWSERSTACK_ACCESS_KEY: ${{ secrets.BROWSERSTACK_ACCESS_KEY }} | |
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: Python Appium Repo ${{ matrix.python }} - ${{ 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 python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: ${{ matrix.python }} | |
- name: Install dependencies | |
run: python -m pip install -r requirements.txt | |
- name: run tests in parallel on android | |
run: | | |
cd android | |
browserstack-sdk python browserstack_sample.py | |
- name: run local tests in parallel on android | |
run: | | |
cd android | |
browserstack-sdk python browserstack_sample_local.py --browserstack.app "./LocalSample.apk" | |
- name: run tests in parallel on ios | |
run: | | |
cd ios | |
browserstack-sdk python browserstack_sample.py | |
- name: run local tests in parallel on ios | |
run: | | |
cd ios | |
browserstack-sdk python browserstack_sample_local.py --browserstack.app "./LocalSample.ipa" | |
- if: always() | |
uses: actions/github-script@98814c53be79b1d30f795b907e553d8679345975 | |
id: status-check-completed | |
env: | |
conclusion: ${{ job.status }} | |
job_name: Python Appium Repo ${{ matrix.python }} - ${{ 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') | |
} |