Skip to content

Commit 9aefc01

Browse files
Add BrowserStack SDK sample-test GitHub Actions workflow (workflow_dispatch)
1 parent 3d3fab3 commit 9aefc01

1 file changed

Lines changed: 68 additions & 0 deletions

File tree

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
# Runs the BrowserStack SDK sample against a given commit and reports a status check.
2+
# Trigger: Actions tab -> "Vanilla Java SDK sample test" -> Run workflow -> paste the PR's full commit SHA.
3+
# Requires repo secrets: BROWSERSTACK_USERNAME, BROWSERSTACK_ACCESS_KEY.
4+
name: Vanilla Java SDK sample test
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+
sdk-sample:
15+
runs-on: ${{ matrix.os }}
16+
strategy:
17+
fail-fast: false
18+
max-parallel: 3
19+
matrix:
20+
os: [ubuntu-latest]
21+
java: ['11', '17']
22+
name: vanilla-java JDK ${{ matrix.java }} sample
23+
env:
24+
BROWSERSTACK_USERNAME: ${{ secrets.BROWSERSTACK_USERNAME }}
25+
BROWSERSTACK_ACCESS_KEY: ${{ secrets.BROWSERSTACK_ACCESS_KEY }}
26+
defaults:
27+
run:
28+
working-directory: .
29+
steps:
30+
- uses: actions/checkout@v4
31+
with:
32+
ref: ${{ github.event.inputs.commit_sha }}
33+
- name: Mark status check in_progress
34+
uses: actions/github-script@v7
35+
env:
36+
job_name: vanilla-java JDK ${{ matrix.java }} sample
37+
commit_sha: ${{ github.event.inputs.commit_sha }}
38+
with:
39+
github-token: ${{ github.token }}
40+
script: |
41+
await github.rest.checks.create({
42+
owner: context.repo.owner, repo: context.repo.repo,
43+
name: process.env.job_name, head_sha: process.env.commit_sha,
44+
status: 'in_progress'
45+
}).catch(e => console.log('check create failed:', e.status));
46+
- uses: actions/setup-java@v4
47+
with:
48+
distribution: 'temurin'
49+
java-version: ${{ matrix.java }}
50+
- name: Run sample test
51+
run: |
52+
mvn compile
53+
mvn compile exec:exec
54+
- name: Mark status check completed
55+
if: always()
56+
uses: actions/github-script@v7
57+
env:
58+
conclusion: ${{ job.status }}
59+
job_name: vanilla-java JDK ${{ matrix.java }} sample
60+
commit_sha: ${{ github.event.inputs.commit_sha }}
61+
with:
62+
github-token: ${{ github.token }}
63+
script: |
64+
await github.rest.checks.create({
65+
owner: context.repo.owner, repo: context.repo.repo,
66+
name: process.env.job_name, head_sha: process.env.commit_sha,
67+
status: 'completed', conclusion: process.env.conclusion
68+
}).catch(e => console.log('check create failed:', e.status));

0 commit comments

Comments
 (0)