Skip to content

Commit e593679

Browse files
Merge pull request #6 from kamal-kaur04/main
Sanity Workflow SDK ~ GitHub Actions
2 parents bd46315 + 9975a6b commit e593679

File tree

1 file changed

+85
-0
lines changed

1 file changed

+85
-0
lines changed

.github/workflows/sanity-workflow.yml

Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
# This job is to test different maven profiles in sdk branch against full commit-id provided
2+
# This workflow targets Playwright execution
3+
4+
name: NodeJS 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+
node: ['14', '16', '18']
21+
os: [ macos-latest, windows-latest, ubuntu-latest ]
22+
name: NodeJS Playwright Repo ${{ matrix.node }} - ${{ 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: NodeJS Playwright Repo ${{ matrix.node }} - ${{ 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 node
51+
uses: actions/setup-node@v3
52+
with:
53+
node-version: ${{ matrix.node }}
54+
55+
- name: Install dependencies
56+
run: npm install
57+
58+
- name: Run sample tests
59+
run: npm run sample-test
60+
61+
- name: Run local tests
62+
run: npm run sample-local-test
63+
64+
- if: always()
65+
uses: actions/github-script@98814c53be79b1d30f795b907e553d8679345975
66+
id: status-check-completed
67+
env:
68+
conclusion: ${{ job.status }}
69+
job_name: NodeJS Playwright Repo ${{ matrix.node }} - ${{ matrix.os }} Sample
70+
commit_sha: ${{ github.event.inputs.commit_sha }}
71+
with:
72+
github-token: ${{ github.token }}
73+
script: |
74+
const result = await github.rest.checks.create({
75+
owner: context.repo.owner,
76+
repo: context.repo.repo,
77+
name: process.env.job_name,
78+
head_sha: process.env.commit_sha,
79+
status: 'completed',
80+
conclusion: process.env.conclusion
81+
}).catch((err) => ({status: err.status, response: err.response}));
82+
console.log(`The status-check response : ${result.status} Response : ${JSON.stringify(result.response)}`)
83+
if (result.status !== 201) {
84+
console.log('Failed to create check run')
85+
}

0 commit comments

Comments
 (0)