diff --git a/.github/workflows/sdk-sample-test.yml b/.github/workflows/sdk-sample-test.yml new file mode 100644 index 0000000..7a6e273 --- /dev/null +++ b/.github/workflows/sdk-sample-test.yml @@ -0,0 +1,69 @@ +# Runs the BrowserStack SDK sample against a given commit and reports a status check. +# Trigger: Actions tab -> "Vanilla Python SDK sample test" -> Run workflow -> paste the PR's full commit SHA. +# Requires repo secrets: BROWSERSTACK_USERNAME, BROWSERSTACK_ACCESS_KEY. +name: Vanilla Python SDK sample test + +on: + workflow_dispatch: + inputs: + commit_sha: + description: 'The full commit id to build' + required: true + +jobs: + sdk-sample: + runs-on: ${{ matrix.os }} + strategy: + fail-fast: false + max-parallel: 3 + matrix: + os: [ubuntu-latest] + python: ['3.10', '3.11', '3.12'] + name: vanilla-python Python ${{ matrix.python }} sample + env: + BROWSERSTACK_USERNAME: ${{ secrets.BROWSERSTACK_USERNAME }} + BROWSERSTACK_ACCESS_KEY: ${{ secrets.BROWSERSTACK_ACCESS_KEY }} + defaults: + run: + working-directory: . + steps: + - uses: actions/checkout@v4 + with: + ref: ${{ github.event.inputs.commit_sha }} + - name: Mark status check in_progress + uses: actions/github-script@v7 + env: + job_name: vanilla-python Python ${{ matrix.python }} sample + commit_sha: ${{ github.event.inputs.commit_sha }} + with: + github-token: ${{ github.token }} + script: | + 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(e => console.log('check create failed:', e.status)); + - uses: actions/setup-python@v5 + with: + python-version: ${{ matrix.python }} + - name: Install + run: | + pip install -r requirements.txt + - name: Run sample test + run: | + browserstack-sdk python bstack_sample.py + - name: Mark status check completed + if: always() + uses: actions/github-script@v7 + env: + conclusion: ${{ job.status }} + job_name: vanilla-python Python ${{ matrix.python }} sample + commit_sha: ${{ github.event.inputs.commit_sha }} + with: + github-token: ${{ github.token }} + script: | + 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(e => console.log('check create failed:', e.status)); diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..d3eba2a --- /dev/null +++ b/.gitignore @@ -0,0 +1,5 @@ +__pycache__ +.venv +env +local.log +log/ diff --git a/README.md b/README.md index ec650b5..736052f 100644 --- a/README.md +++ b/README.md @@ -1,2 +1 @@ -# vanilla-python-browserstack -We require the following new public repositories under the browserstack GitHub organization to host customer-facing sample projects for the BrowserStack SDK. +# Vanilla Python with BrowserStack SDK diff --git a/browserstack.yml b/browserstack.yml new file mode 100644 index 0000000..589e25c --- /dev/null +++ b/browserstack.yml @@ -0,0 +1,26 @@ +userName: YOUR_USERNAME +accessKey: YOUR_ACCESS_KEY +projectName: BrowserStack Samples +buildName: browserstack build +buildIdentifier: '#${BUILD_NUMBER}' +# Vanilla Python (python-generic) — no test framework; run via `browserstack-sdk python