Skip to content

Commit f2802c1

Browse files
kamal-kaur04francisf
authored andcommitted
add: github actions to run tests
1 parent d8cb6d0 commit f2802c1

File tree

3 files changed

+65
-0
lines changed

3 files changed

+65
-0
lines changed

.github/CODEOWNERS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
.github/workflows/*.yml @browserstack/asi-devs

.github/pull_request_template.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
#### How to run tests?
2+
- Before running tests please take master merge in the PR
3+
- Comment RUN_TESTS to run maven tests
4+
5+
Note: Only BrowserStack Team can trigger the tests.
Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
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: TestNG SDK Test workflow for Maven on comment RUN_TESTS
5+
6+
on:
7+
issue_comment:
8+
branches: [ "master" ]
9+
types: [ created ]
10+
11+
jobs:
12+
comment-run:
13+
if: contains(github.event.comment.body, 'RUN_TESTS') && github.event.issue.pull_request
14+
runs-on: ${{ matrix.os }}
15+
continue-on-error: true
16+
strategy:
17+
max-parallel: 1
18+
matrix:
19+
java: [ '8', '11', '17' ]
20+
os: [ 'macos-latest', 'windows-latest', 'ubuntu-latest' ]
21+
name: TestNG Repo ${{ matrix.Java }} - ${{ matrix.os }} Sample
22+
env:
23+
BROWSERSTACK_USERNAME: ${{ secrets.BROWSERSTACK_USERNAME }}
24+
BROWSERSTACK_ACCESS_KEY: ${{ secrets.BROWSERSTACK_ACCESS_KEY }}
25+
26+
steps:
27+
- uses: actions/checkout@v3
28+
- uses: actions/github-script@v6
29+
id: check-membership
30+
with:
31+
script: |
32+
const creator = context.payload.sender.login
33+
const result = await github.rest.teams.getMembershipForUserInOrg({
34+
org: context.repo.owner,
35+
team_slug: 'asi-devs',
36+
username: creator
37+
})
38+
console.log(`The comment creator ${creator} membership - ${result}`)
39+
if (response.state === "active") {
40+
return "true"
41+
}
42+
core.setFailed('User is not part of the owner team!')
43+
- name: Set up Java
44+
uses: actions/setup-java@v3
45+
with:
46+
distribution: 'temurin'
47+
java-version: ${{ matrix.java }}
48+
- name: Run mvn test
49+
run: |
50+
mvn compile
51+
mvn test
52+
- name: Run mvn profile sample-local-test
53+
run: |
54+
mvn compile
55+
mvn test -P sample-local-test
56+
- name: Run mvn profile sample-test
57+
run: |
58+
mvn compile
59+
mvn test -P sample-test

0 commit comments

Comments
 (0)