Skip to content

Commit e479920

Browse files
authored
Merge pull request #1 from kamal-kaur04/add-maven-workflow
add: maven workflow dispatch
2 parents 1e328a9 + beddc2b commit e479920

File tree

1 file changed

+120
-0
lines changed

1 file changed

+120
-0
lines changed
Lines changed: 120 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,120 @@
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: JUnit 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: JUnit 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 junit4 android
56+
run: |
57+
cd android/junit4-examples
58+
mvn compile
59+
mvn test
60+
mvn test -P sample-test
61+
- name: Run mvn test for junit5 android
62+
run: |
63+
cd android/junit5-examples
64+
mvn compile
65+
mvn test
66+
mvn test -P sample-test
67+
- name: Run mvn profile sample-local-test for junit4 android
68+
run: |
69+
cd android/junit4-examples
70+
mvn compile
71+
mvn test -P sample-local-test -Dbrowserstack.app="./LocalSample.apk"
72+
- name: Run mvn profile sample-local-test for junit5 android
73+
run: |
74+
cd android/junit5-examples
75+
mvn compile
76+
mvn test -P sample-local-test -Dbrowserstack.app="./LocalSample.apk"
77+
- name: Run mvn test for junit4 ios
78+
run: |
79+
cd ios/junit4-examples
80+
mvn compile
81+
mvn test
82+
mvn test -P sample-test
83+
- name: Run mvn test for junit5 ios
84+
run: |
85+
cd ios/junit5-examples
86+
mvn compile
87+
mvn test
88+
mvn test -P sample-test
89+
- name: Run mvn profile sample-local-test for junit4 ios
90+
run: |
91+
cd ios/junit4-examples
92+
mvn compile
93+
mvn test -P sample-local-test -Dbrowserstack.app="./LocalSample.ipa"
94+
- name: Run mvn profile sample-local-test for junit5 ios
95+
run: |
96+
cd ios/junit5-examples
97+
mvn compile
98+
mvn test -P sample-local-test -Dbrowserstack.app="./LocalSample.ipa"
99+
- if: always()
100+
uses: actions/github-script@98814c53be79b1d30f795b907e553d8679345975
101+
id: status-check-completed
102+
env:
103+
conclusion: ${{ job.status }}
104+
job_name: TestNG Appium Repo ${{ matrix.Java }} - ${{ matrix.os }} Sample
105+
commit_sha: ${{ github.event.inputs.commit_sha }}
106+
with:
107+
github-token: ${{ github.token }}
108+
script: |
109+
const result = await github.rest.checks.create({
110+
owner: context.repo.owner,
111+
repo: context.repo.repo,
112+
name: process.env.job_name,
113+
head_sha: process.env.commit_sha,
114+
status: 'completed',
115+
conclusion: process.env.conclusion
116+
}).catch((err) => ({status: err.status, response: err.response}));
117+
console.log(`The status-check response : ${result.status} Response : ${JSON.stringify(result.response)}`)
118+
if (result.status !== 201) {
119+
console.log('Failed to create check run')
120+
}

0 commit comments

Comments
 (0)