|
| 1 | +# This job is to test different profiles in sdk branch against full commit id |
| 2 | +# This workflow targets nunit |
| 3 | + |
| 4 | +name: C-sharp 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 | + dotnet: ['7.0.x', '6.0.x', '5.0.x'] |
| 21 | + os: [ windows-latest ] |
| 22 | + name: NUnit Appium Repo ${{ matrix.dotnet }} - ${{ 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: NUnit Appium Repo ${{ matrix.dotnet }} - ${{ 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 dotnet |
| 51 | + uses: actions/setup-dotnet@v3 |
| 52 | + with: |
| 53 | + dotnet-version: ${{ matrix.dotnet }} |
| 54 | + |
| 55 | + - name: Install dependencies |
| 56 | + run: dotnet build |
| 57 | + |
| 58 | + - name: Run sample android tests |
| 59 | + run: | |
| 60 | + cd android |
| 61 | + dotnet test --filter "Category=sample-test" |
| 62 | +
|
| 63 | + - name: Run local android tests |
| 64 | + run: | |
| 65 | + cd android |
| 66 | + dotnet test --filter "Category=sample-local-test" |
| 67 | + env: |
| 68 | + BROWSERSTACK_APP: ./LocalSample.apk |
| 69 | + |
| 70 | + - name: Run sample ios tests |
| 71 | + run: | |
| 72 | + cd ios |
| 73 | + dotnet test --filter "Category=sample-test" |
| 74 | +
|
| 75 | + - name: Run local ios tests |
| 76 | + run: | |
| 77 | + cd ios |
| 78 | + dotnet test --filter "Category=sample-local-test" |
| 79 | + env: |
| 80 | + BROWSERSTACK_APP: ./LocalSample.ipa |
| 81 | + |
| 82 | + - if: always() |
| 83 | + uses: actions/github-script@98814c53be79b1d30f795b907e553d8679345975 |
| 84 | + id: status-check-completed |
| 85 | + env: |
| 86 | + conclusion: ${{ job.status }} |
| 87 | + job_name: NUnit Appium Repo ${{ matrix.dotnet }} - ${{ matrix.os }} Sample |
| 88 | + commit_sha: ${{ github.event.inputs.commit_sha }} |
| 89 | + with: |
| 90 | + github-token: ${{ github.token }} |
| 91 | + script: | |
| 92 | + const result = await github.rest.checks.create({ |
| 93 | + owner: context.repo.owner, |
| 94 | + repo: context.repo.repo, |
| 95 | + name: process.env.job_name, |
| 96 | + head_sha: process.env.commit_sha, |
| 97 | + status: 'completed', |
| 98 | + conclusion: process.env.conclusion |
| 99 | + }).catch((err) => ({status: err.status, response: err.response})); |
| 100 | + console.log(`The status-check response : ${result.status} Response : ${JSON.stringify(result.response)}`) |
| 101 | + if (result.status !== 201) { |
| 102 | + console.log('Failed to create check run') |
| 103 | + } |
0 commit comments