Skip to content

Commit 4e9d84e

Browse files
committed
Use BrowserStack to run macOS CI tests
1 parent a9c3e37 commit 4e9d84e

4 files changed

Lines changed: 272 additions & 17 deletions

File tree

.github/workflows/build.yml

Lines changed: 89 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ jobs:
2020
cancel-in-progress: true
2121
outputs:
2222
canUseSauce: ${{ steps.check_sauce_access.outputs.result == 'true' }}
23+
canUseBrowserStack: ${{ steps.check_browserstack_access.outputs.result == 'true' }}
2324
tag: ${{ steps.extract_tag.outputs.result }}
2425
isMainBranch: ${{ github.ref == 'refs/heads/master' }}
2526
steps:
@@ -33,6 +34,16 @@ jobs:
3334
CI: true
3435
SAUCE_USERNAME: ${{ secrets.SAUCE_USERNAME }}
3536
SAUCE_ACCESS_KEY: ${{ secrets.SAUCE_ACCESS_KEY }}
37+
- name: check browserstack access
38+
id: check_browserstack_access
39+
run: |
40+
if ! [[ -z "$BROWSERSTACK_USERNAME" ]] && ! [[ -z "$BROWSERSTACK_ACCESS_KEY" ]]; then
41+
echo "result=true" >> $GITHUB_OUTPUT
42+
fi
43+
env:
44+
CI: true
45+
BROWSERSTACK_USERNAME: ${{ secrets.BROWSERSTACK_USERNAME }}
46+
BROWSERSTACK_ACCESS_KEY: ${{ secrets.BROWSERSTACK_ACCESS_KEY }}
3647
- name: extract tag
3748
id: extract_tag
3849
uses: actions/github-script@v8
@@ -418,16 +429,9 @@ jobs:
418429
max-parallel: 8
419430
matrix:
420431
include:
421-
- config: safari-macOS_13
422-
ua: safari
423-
os: macOS 13
424432
- config: firefox-win_10
425433
ua: firefox
426434
os: Windows 10
427-
- config: chrome-mac_13-79.0
428-
ua: chrome
429-
os: macOS 12
430-
uaVersion: '79.0'
431435

432436
steps:
433437
- uses: actions/checkout@v5
@@ -479,3 +483,81 @@ jobs:
479483
UA: ${{ matrix.ua }}
480484
UA_VERSION: ${{ matrix.uaVersion }}
481485
OS: ${{ matrix.os }}
486+
487+
test_functional_browserstack:
488+
needs: [config, test_unit]
489+
if: needs.config.outputs.canUseBrowserStack == 'true'
490+
runs-on: ubuntu-latest
491+
concurrency:
492+
group: 'build:test_functional_browserstack:${{ matrix.config }}:${{ github.ref }}'
493+
cancel-in-progress: true
494+
continue-on-error: true
495+
name: test_functional_browserstack (${{ matrix.config }})
496+
strategy:
497+
fail-fast: false
498+
max-parallel: 4
499+
matrix:
500+
include:
501+
- config: safari-macOS_15
502+
ua: safari
503+
os: macOS 15
504+
- config: chrome-macOS_14
505+
ua: chrome
506+
os: macOS 14
507+
508+
steps:
509+
- uses: actions/checkout@v5
510+
511+
- name: cache node_modules
512+
uses: actions/cache@v4
513+
env:
514+
cache-name: cache-node-modules
515+
with:
516+
path: ~/.npm
517+
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }}
518+
restore-keys: |
519+
${{ runner.os }}-build-${{ env.cache-name }}-
520+
${{ runner.os }}-build-
521+
${{ runner.os }}-
522+
523+
- name: use Node.js
524+
uses: actions/setup-node@v5
525+
with:
526+
node-version-file: '.node-version'
527+
528+
- name: download build
529+
uses: actions/download-artifact@v5
530+
with:
531+
name: build
532+
533+
- name: start BrowserStack Local
534+
uses: browserstack/github-actions/setup-local@master
535+
with:
536+
local-testing: start
537+
local-identifier: ${{ github.run_id }}-${{ matrix.config }}
538+
539+
- name: install
540+
run: |
541+
npm ci
542+
env:
543+
CI: true
544+
545+
- name: run functional tests
546+
run: |
547+
npm run test:func
548+
env:
549+
CI: true
550+
BROWSERSTACK: 1
551+
BROWSERSTACK_USERNAME: ${{ secrets.BROWSERSTACK_USERNAME }}
552+
BROWSERSTACK_ACCESS_KEY: ${{ secrets.BROWSERSTACK_ACCESS_KEY }}
553+
BROWSERSTACK_LOCAL_IDENTIFIER: ${{ github.run_id }}-${{ matrix.config }}
554+
BROWSERSTACK_BUILD_ID: ${{ github.run_id }}-${{ matrix.config }}
555+
UA: ${{ matrix.ua }}
556+
UA_VERSION: ${{ matrix.uaVersion }}
557+
OS: ${{ matrix.os }}
558+
559+
- name: stop BrowserStack Local
560+
if: always()
561+
uses: browserstack/github-actions/setup-local@master
562+
with:
563+
local-testing: stop

package-lock.json

Lines changed: 55 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@
6060
"test:func": "BABEL_ENV=development mocha --require @babel/register tests/functional/auto/setup.js --timeout 40000 --exit",
6161
"test:func:light": "BABEL_ENV=development HLSJS_LIGHT=1 mocha --require @babel/register tests/functional/auto/setup.js --timeout 40000 --exit",
6262
"test:func:sauce": "SAUCE=1 UA=safari OS='OS X 10.15' BABEL_ENV=development mocha --require @babel/register tests/functional/auto/setup.js --timeout 40000 --exit",
63+
"test:func:browserstack": "BROWSERSTACK=1 UA=safari OS='macOS 15' BABEL_ENV=development mocha --require @babel/register tests/functional/auto/setup.js --timeout 40000 --exit",
6364
"type-check": "tsc --noEmit",
6465
"type-check:watch": "npm run type-check -- --watch",
6566
"prepare": "husky"
@@ -92,6 +93,7 @@
9293
"@typescript-eslint/parser": "8.54.0",
9394
"babel-loader": "10.1.1",
9495
"babel-plugin-transform-remove-console": "6.9.4",
96+
"browserstack-local": "1.5.13",
9597
"chai": "6.2.2",
9698
"chart.js": "2.9.4",
9799
"chromedriver": "146.0.6",

0 commit comments

Comments
 (0)