Skip to content

Commit 5a9f70e

Browse files
Merge pull request #5 from kamal-kaur04/main
Add sanity workflow
2 parents 497aaec + d68abc2 commit 5a9f70e

File tree

1 file changed

+88
-0
lines changed

1 file changed

+88
-0
lines changed
Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
# This job is to test different maven profiles in sdk branch again Pull Request raised
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: Java Playwright 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: Java Playwright 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
56+
run: |
57+
mvn compile
58+
mvn test
59+
- name: Run mvn profile sample-local-test
60+
run: |
61+
mvn compile
62+
mvn test -P sample-local-test
63+
- name: Run mvn profile sample-test
64+
run: |
65+
mvn compile
66+
mvn test -P sample-test
67+
- if: always()
68+
uses: actions/github-script@98814c53be79b1d30f795b907e553d8679345975
69+
id: status-check-completed
70+
env:
71+
conclusion: ${{ job.status }}
72+
job_name: Java Playwright Repo ${{ matrix.Java }} - ${{ matrix.os }} Sample
73+
commit_sha: ${{ github.event.inputs.commit_sha }}
74+
with:
75+
github-token: ${{ github.token }}
76+
script: |
77+
const result = await github.rest.checks.create({
78+
owner: context.repo.owner,
79+
repo: context.repo.repo,
80+
name: process.env.job_name,
81+
head_sha: process.env.commit_sha,
82+
status: 'completed',
83+
conclusion: process.env.conclusion
84+
}).catch((err) => ({status: err.status, response: err.response}));
85+
console.log(`The status-check response : ${result.status} Response : ${JSON.stringify(result.response)}`)
86+
if (result.status !== 201) {
87+
console.log('Failed to create check run')
88+
}

0 commit comments

Comments
 (0)