C-sharp Playwright SDK Test workflow on workflow_dispatch #12
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# This job is to test different profiles in sdk branch against full-commit id | |
# This workflow targets mstest | |
name: C-sharp Playwright SDK Test workflow on workflow_dispatch | |
on: | |
workflow_dispatch: | |
inputs: | |
commit_sha: | |
description: 'The full commit id to build' | |
required: true | |
jobs: | |
comment-run: | |
runs-on: ${{ matrix.os }} | |
strategy: | |
fail-fast: false | |
max-parallel: 3 | |
matrix: | |
dotnet: ['6.0.x', '5.0.x', '7.0.x'] | |
os: [ windows-latest ] | |
name: MSTest Repo ${{ matrix.dotnet }} - ${{ matrix.os }} Sample | |
env: | |
BROWSERSTACK_USERNAME: ${{ secrets.BROWSERSTACK_USERNAME }} | |
BROWSERSTACK_ACCESS_KEY: ${{ secrets.BROWSERSTACK_ACCESS_KEY }} | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
ref: ${{ github.event.inputs.commit_sha }} | |
- uses: actions/github-script@98814c53be79b1d30f795b907e553d8679345975 | |
id: status-check-in-progress | |
env: | |
job_name: MSTest Repo ${{ matrix.dotnet }} - ${{ matrix.os }} Sample | |
commit_sha: ${{ github.event.inputs.commit_sha }} | |
with: | |
github-token: ${{ github.token }} | |
script: | | |
const result = await github.rest.checks.create({ | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
name: process.env.job_name, | |
head_sha: process.env.commit_sha, | |
status: 'in_progress' | |
}).catch((err) => ({status: err.status, response: err.response})); | |
console.log(`The status-check response : ${result.status} Response : ${JSON.stringify(result.response)}`) | |
if (result.status !== 201) { | |
console.log('Failed to create check run') | |
} | |
- name: Setup dotnet | |
uses: actions/setup-dotnet@v3 | |
with: | |
dotnet-version: ${{ matrix.dotnet }} | |
- name: Install dependencies | |
run: dotnet build | |
- name: Run sample tests | |
run: dotnet test --filter TestCategory=sample-test | |
- name: Run local tests | |
run: dotnet test --filter TestCategory=sample-local-test | |
- if: always() | |
uses: actions/github-script@98814c53be79b1d30f795b907e553d8679345975 | |
id: status-check-completed | |
env: | |
conclusion: ${{ job.status }} | |
job_name: MSTest Repo ${{ matrix.dotnet }} - ${{ matrix.os }} Sample | |
commit_sha: ${{ github.event.inputs.commit_sha }} | |
with: | |
github-token: ${{ github.token }} | |
script: | | |
const result = await github.rest.checks.create({ | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
name: process.env.job_name, | |
head_sha: process.env.commit_sha, | |
status: 'completed', | |
conclusion: process.env.conclusion | |
}).catch((err) => ({status: err.status, response: err.response})); | |
console.log(`The status-check response : ${result.status} Response : ${JSON.stringify(result.response)}`) | |
if (result.status !== 201) { | |
console.log('Failed to create check run') | |
} |