Skip to content

Commit 0de59be

Browse files
authored
Merge pull request #30 from kamal-kaur04/master
Add sanity workflow ~ SDK
2 parents 6f8d2ea + 0729895 commit 0de59be

File tree

1 file changed

+106
-0
lines changed

1 file changed

+106
-0
lines changed
+106
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,106 @@
1+
# This job is to test different maven profiles in sdk branch against full commit-id provided
2+
# This workflow targets Java with Maven execution
3+
4+
name: Java SDK Test workflow for Maven 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+
java: [ '8', '11', '17' ]
21+
os: [ 'macos-latest', 'windows-latest', 'ubuntu-latest' ]
22+
name: TestNG Appium Repo ${{ matrix.Java }} - ${{ 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: TestNG Appium Repo ${{ matrix.Java }} - ${{ 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: Set up Java
51+
uses: actions/setup-java@v3
52+
with:
53+
distribution: 'temurin'
54+
java-version: ${{ matrix.java }}
55+
- name: Run mvn test for testng android
56+
run: |
57+
cd android/testng-examples
58+
mvn compile
59+
mvn test
60+
- name: Run mvn profile sample-test for testng android
61+
run: |
62+
cd android/testng-examples
63+
mvn compile
64+
mvn test -P sample-test
65+
- name: Run mvn profile sample-local-test for testng android
66+
run: |
67+
cd android/testng-examples
68+
mvn compile
69+
mvn test -P sample-local-test -D"browserstack.app"="./LocalSample.apk"
70+
- name: Run mvn test for testng ios
71+
run: |
72+
cd ios/testng-examples
73+
mvn compile
74+
mvn test
75+
- name: Run mvn profile sample-test for testng ios
76+
run: |
77+
cd ios/testng-examples
78+
mvn compile
79+
mvn test -P sample-test
80+
- name: Run mvn profile sample-local-test for testng ios
81+
run: |
82+
cd ios/testng-examples
83+
mvn compile
84+
mvn test -P sample-local-test -D"browserstack.app"="./LocalSample.ipa"
85+
- if: always()
86+
uses: actions/github-script@98814c53be79b1d30f795b907e553d8679345975
87+
id: status-check-completed
88+
env:
89+
conclusion: ${{ job.status }}
90+
job_name: TestNG Appium Repo ${{ matrix.Java }} - ${{ matrix.os }} Sample
91+
commit_sha: ${{ github.event.inputs.commit_sha }}
92+
with:
93+
github-token: ${{ github.token }}
94+
script: |
95+
const result = await github.rest.checks.create({
96+
owner: context.repo.owner,
97+
repo: context.repo.repo,
98+
name: process.env.job_name,
99+
head_sha: process.env.commit_sha,
100+
status: 'completed',
101+
conclusion: process.env.conclusion
102+
}).catch((err) => ({status: err.status, response: err.response}));
103+
console.log(`The status-check response : ${result.status} Response : ${JSON.stringify(result.response)}`)
104+
if (result.status !== 201) {
105+
console.log('Failed to create check run')
106+
}

0 commit comments

Comments
 (0)