|
| 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 workflow_dispatch |
| 5 | + |
| 6 | +on: |
| 7 | + workflow_dispatch: |
| 8 | + inputs: |
| 9 | + pull_request_number: |
| 10 | + description: 'The pull request number 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: TestNG 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: refs/pull/${{ github.event.inputs.pull_request_number }}/head |
| 31 | + - name: Fetch Commit SHA |
| 32 | + run: | |
| 33 | + git log -1 --format='%H' |
| 34 | + echo "commit_sha=$(git log -1 --format='%H')" >> $GITHUB_ENV |
| 35 | + echo "commit_sha=$(git log -1 --format='%H')" >> $env:GITHUB_ENV |
| 36 | + - uses: actions/github-script@98814c53be79b1d30f795b907e553d8679345975 |
| 37 | + id: status-check-in-progress |
| 38 | + env: |
| 39 | + job_name: TestNG Repo ${{ matrix.Java }} - ${{ matrix.os }} Sample |
| 40 | + with: |
| 41 | + github-token: ${{ github.token }} |
| 42 | + script: | |
| 43 | + const result = await github.rest.checks.create({ |
| 44 | + owner: context.repo.owner, |
| 45 | + repo: context.repo.repo, |
| 46 | + name: process.env.job_name, |
| 47 | + head_sha: process.env.commit_sha, |
| 48 | + status: 'in_progress' |
| 49 | + }).catch((err) => ({status: err.status, response: err.response})); |
| 50 | + console.log(`The status-check response : ${result.status} Response : ${JSON.stringify(result.response)}`) |
| 51 | + if (result.status !== 201) { |
| 52 | + console.log('Failed to create check run') |
| 53 | + } |
| 54 | + - name: Set up Java |
| 55 | + uses: actions/setup-java@v3 |
| 56 | + with: |
| 57 | + distribution: 'temurin' |
| 58 | + java-version: ${{ matrix.java }} |
| 59 | + - name: Run mvn test |
| 60 | + run: | |
| 61 | + mvn compile |
| 62 | + mvn test |
| 63 | + - name: Run mvn profile sample-local-test |
| 64 | + run: | |
| 65 | + mvn compile |
| 66 | + mvn test -P sample-local-test |
| 67 | + - name: Run mvn profile sample-test |
| 68 | + run: | |
| 69 | + mvn compile |
| 70 | + mvn test -P sample-test |
| 71 | + - if: always() |
| 72 | + uses: actions/github-script@98814c53be79b1d30f795b907e553d8679345975 |
| 73 | + id: status-check-completed |
| 74 | + env: |
| 75 | + conclusion: ${{ job.status }} |
| 76 | + job_name: TestNG Repo ${{ matrix.Java }} - ${{ matrix.os }} Sample |
| 77 | + with: |
| 78 | + github-token: ${{ github.token }} |
| 79 | + script: | |
| 80 | + const result = await github.rest.checks.create({ |
| 81 | + owner: context.repo.owner, |
| 82 | + repo: context.repo.repo, |
| 83 | + name: process.env.job_name, |
| 84 | + head_sha: process.env.commit_sha, |
| 85 | + status: 'completed', |
| 86 | + conclusion: process.env.conclusion |
| 87 | + }).catch((err) => ({status: err.status, response: err.response})); |
| 88 | + console.log(`The status-check response : ${result.status} Response : ${JSON.stringify(result.response)}`) |
| 89 | + if (result.status !== 201) { |
| 90 | + console.log('Failed to create check run') |
| 91 | + } |
0 commit comments