2021-11-30 23:02:57 +00:00
|
|
|
name: CI
|
|
|
|
|
2023-11-13 17:18:20 +00:00
|
|
|
on:
|
|
|
|
pull_request:
|
|
|
|
push:
|
|
|
|
branches-ignore: "dependabot/**"
|
2021-11-30 23:02:57 +00:00
|
|
|
|
2022-12-01 13:23:17 +00:00
|
|
|
permissions:
|
|
|
|
contents: read # to fetch code (actions/checkout)
|
|
|
|
|
2021-11-30 23:02:57 +00:00
|
|
|
jobs:
|
|
|
|
build:
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
strategy:
|
|
|
|
fail-fast: false
|
|
|
|
matrix:
|
|
|
|
# Node.js 10 is required by jQuery infra
|
2022-03-14 16:58:41 +00:00
|
|
|
# Do not remove 16.x until jsdom tests are re-enabled on newer Node.js versions.
|
2023-05-22 14:21:35 +00:00
|
|
|
NODE_VERSION: [10.x, 16.x, 18.x, 20.x]
|
2021-11-30 23:02:57 +00:00
|
|
|
NPM_SCRIPT: ["test:browserless"]
|
|
|
|
include:
|
2023-01-23 22:49:44 +00:00
|
|
|
- NAME: "Browser tests: full build, Chrome, Firefox & WebKit"
|
|
|
|
NODE_VERSION: "18.x"
|
2021-11-30 23:02:57 +00:00
|
|
|
NPM_SCRIPT: "test:browser"
|
2023-01-23 22:49:44 +00:00
|
|
|
BROWSERS: "ChromeHeadless,FirefoxHeadless,WebkitHeadless"
|
|
|
|
- NAME: "Browser tests: slim build, Chrome"
|
|
|
|
NODE_VERSION: "18.x"
|
2021-11-30 23:02:57 +00:00
|
|
|
NPM_SCRIPT: "test:slim"
|
|
|
|
BROWSERS: "ChromeHeadless"
|
2023-01-23 22:49:44 +00:00
|
|
|
- NAME: "Browser tests: no-deprecated build, Chrome"
|
|
|
|
NODE_VERSION: "18.x"
|
2021-11-30 23:02:57 +00:00
|
|
|
NPM_SCRIPT: "test:no-deprecated"
|
|
|
|
BROWSERS: "ChromeHeadless"
|
2023-01-23 22:49:44 +00:00
|
|
|
- NAME: "Browser tests: selector-native build, Chrome"
|
|
|
|
NODE_VERSION: "18.x"
|
2022-12-14 00:41:31 +00:00
|
|
|
NPM_SCRIPT: "test:selector-native"
|
2021-11-30 23:02:57 +00:00
|
|
|
BROWSERS: "ChromeHeadless"
|
|
|
|
- NAME: "Browser tests: AMD build, Chrome stable"
|
2023-01-23 22:49:44 +00:00
|
|
|
NODE_VERSION: "18.x"
|
2021-11-30 23:02:57 +00:00
|
|
|
NPM_SCRIPT: "test:amd"
|
|
|
|
BROWSERS: "ChromeHeadless"
|
|
|
|
- NAME: "Browser tests: full build, Firefox ESR"
|
2023-01-23 22:49:44 +00:00
|
|
|
NODE_VERSION: "18.x"
|
2021-11-30 23:02:57 +00:00
|
|
|
NPM_SCRIPT: "test:browser"
|
|
|
|
BROWSERS: "FirefoxHeadless"
|
2023-09-20 22:18:42 +00:00
|
|
|
|
2021-11-30 23:02:57 +00:00
|
|
|
steps:
|
2023-09-20 22:18:42 +00:00
|
|
|
- name: Checkout
|
2023-11-13 17:44:30 +00:00
|
|
|
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
|
2023-09-20 22:18:42 +00:00
|
|
|
|
|
|
|
- name: Cache
|
2024-02-11 00:45:15 +00:00
|
|
|
uses: actions/cache@13aacd865c20de90d75de3b17ebe84f7a17d57d2 # v4.0.0
|
2023-09-20 22:18:42 +00:00
|
|
|
with:
|
|
|
|
path: ~/.npm
|
|
|
|
key: ${{ runner.os }}-node-${{ matrix.NODE_VERSION }}-npm-lock-${{ hashFiles('**/package-lock.json') }}
|
|
|
|
restore-keys: |
|
|
|
|
${{ runner.os }}-node-${{ matrix.NODE_VERSION }}-npm-lock-
|
|
|
|
|
|
|
|
- name: Use Node.js ${{ matrix.NODE_VERSION }}
|
2023-11-13 17:44:30 +00:00
|
|
|
uses: actions/setup-node@8f152de45cc393bb48ce5d89d36b731f54556e65 # v4.0.0
|
2023-09-20 22:18:42 +00:00
|
|
|
with:
|
|
|
|
node-version: ${{ matrix.NODE_VERSION }}
|
2021-11-30 23:02:57 +00:00
|
|
|
|
2023-09-20 22:18:42 +00:00
|
|
|
- name: Install firefox ESR
|
|
|
|
run: |
|
|
|
|
export FIREFOX_SOURCE_URL='https://download.mozilla.org/?product=firefox-esr-latest&lang=en-US&os=linux64'
|
|
|
|
wget --no-verbose $FIREFOX_SOURCE_URL -O - | tar -jx -C ${HOME}
|
|
|
|
if: contains(matrix.NAME, 'Firefox ESR')
|
2021-11-30 23:02:57 +00:00
|
|
|
|
2023-09-20 22:18:42 +00:00
|
|
|
- name: Install dependencies
|
|
|
|
run: npm install
|
2021-11-30 23:02:57 +00:00
|
|
|
|
2023-09-20 22:18:42 +00:00
|
|
|
- name: Install Playwright dependencies
|
|
|
|
run: npx playwright-webkit install-deps
|
|
|
|
if: matrix.NPM_SCRIPT == 'test:browser' && contains(matrix.BROWSERS, 'WebkitHeadless')
|
2021-11-30 23:02:57 +00:00
|
|
|
|
2023-09-20 22:18:42 +00:00
|
|
|
- name: Lint code
|
|
|
|
run: npm run build && npm run lint
|
|
|
|
if: matrix.NODE_VERSION == '18.x'
|
2022-01-04 15:27:42 +00:00
|
|
|
|
2023-09-20 22:18:42 +00:00
|
|
|
- name: Run tests
|
|
|
|
env:
|
|
|
|
BROWSERS: ${{ matrix.BROWSERS }}
|
|
|
|
run: |
|
|
|
|
export PATH=${HOME}/firefox:$PATH
|
|
|
|
npm run ${{ matrix.NPM_SCRIPT }}
|