Skip to content

fix(mock-doc): adjust matchMedia mock return #475

fix(mock-doc): adjust matchMedia mock return

fix(mock-doc): adjust matchMedia mock return #475

name: BrowserStack Tests
on:
merge_group:
pull_request_target:
branches:
- 'main'
- 'v3.*-feature'
- 'rindo/v4-dev'
push:
branches:
- 'main'
- 'rindo/v4-dev'
env:
BROWSERSTACK_ACCESS_KEY: ${{ secrets.BROWSER_STACK_ACCESS_KEY }}
BROWSERSTACK_USERNAME: ${{ secrets.BROWSER_STACK_USERNAME }}
permissions: read-all
# this workflow splits running Browserstack tests into two jobs:
# - one to build rindo for Browserstack
# - one to build the test applications & invoke Browserstack
#
# doing so allows us to balance a few different considerations when running against Browserstack:
# 1. Rerunning Failed Jobs
# Creating a separate job for running Browserstack on its own allows us to 'rerun failed jobs' in the GitHub UI,
# only for the Browserstack tests themselves.
# This allows for a quicker feedback loop in the event of flaky jobs
# 2. Secret Security
# In order to authenticate against Browserstack, an access key and username are required
# In order to minimize their access/usage elsewhere, we contain them to the workflow that is this file
#
# These items do come at a cost of some repeated steps in the jobs below (checking out code, installing dependencies,
# etc.)
jobs:
build_core:
name: Build for Browserstack
uses: ./.github/workflows/build.yml
run_browserstack:
name: Run Browserstack
runs-on: ubuntu-20.04
needs: [build_core]
# The concurrency field allows us to block multiple invocations of this job across multiple workflow runs.
# Rindo is only able to run 5 parallel tests in Browserstack, which is exceeded when more than one run of this
# workflow occurs - e.g. more than one pull request is submitted in proximity, a pull request and a merge to a
# branch that runs this workflow, etc.
#
# At this time, Karma is unable to properly wait for the queued Browserstack tests to finish. Instead, use the
# GitHub Actions 'concurrency' field as means to block the job until no other tests are running.
concurrency: run_browserstack_queue
steps:
- uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3
with:
ref: ${{ github.event_name == 'pull_request_target' && format('refs/pull/{0}/merge', github.event.number) || '' }}
persist-credentials: false
- name: Use Node 16
uses: actions/setup-node@64ed1c7eab4cce3362f8c340dee64e5eaeef8f7c # v3.6.0
with:
node-version: 16
cache: 'npm'
- name: Install dependencies
run: npm ci
- name: Download Build Archive
uses: ./.github/workflows/actions/download-archive
with:
name: rindo-core
path: .
filename: rindo-core-build.zip
- name: BrowserStack Env Setup
uses: 'browserstack/github-actions/setup-env@master'
with:
username: ${{ env.BROWSERSTACK_USERNAME }}
access-key: ${{ env.BROWSERSTACK_ACCESS_KEY }}
project-name: 'rindo_core'
- name: Start BrowserStack
uses: browserstack/github-actions/setup-local@master
with:
# local-testing must be one of two values: 'start' or 'stop' to start/stop Browserstack
local-testing: start
# generates a random identifier for the Browserstack connection.
# otherwise, an identifier collision could cause connections to fail.
local-identifier: random
- name: Stop BrowserStack
uses: browserstack/github-actions/setup-local@master
with:
# local-testing must be one of two values: 'start' or 'stop' to start/stop Browserstack
local-testing: stop
- name: Check Git Context
uses: ./.github/workflows/actions/check-git-context