jquery/.github/workflows/node.js.yml

90 lines
3.0 KiB
YAML
Raw Normal View History

name: CI
on: [push, pull_request]
permissions:
contents: read # to fetch code (actions/checkout)
jobs:
build:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
# Node.js 10 is required by jQuery infra
# Do not remove 16.x until jsdom tests are re-enabled on newer Node.js versions.
NODE_VERSION: [10.x, 16.x, 18.x, 20.x]
NPM_SCRIPT: ["test:browserless"]
include:
- NAME: "Browser tests: full build, Chrome, Firefox & WebKit"
NODE_VERSION: "18.x"
NPM_SCRIPT: "test:browser"
BROWSERS: "ChromeHeadless,FirefoxHeadless,WebkitHeadless"
- NAME: "Browser tests: slim build, Chrome"
NODE_VERSION: "18.x"
NPM_SCRIPT: "test:slim"
BROWSERS: "ChromeHeadless"
- NAME: "Browser tests: no-deprecated build, Chrome"
NODE_VERSION: "18.x"
NPM_SCRIPT: "test:no-deprecated"
BROWSERS: "ChromeHeadless"
- NAME: "Browser tests: selector-native build, Chrome"
NODE_VERSION: "18.x"
NPM_SCRIPT: "test:selector-native"
BROWSERS: "ChromeHeadless"
- NAME: "Browser tests: ES modules build, Chrome"
NODE_VERSION: "18.x"
NPM_SCRIPT: "test:esmodules"
BROWSERS: "ChromeHeadless"
- NAME: "Browser tests: full build, Firefox ESR"
NODE_VERSION: "18.x"
NPM_SCRIPT: "test:browser"
BROWSERS: "FirefoxHeadless"
steps:
- name: Checkout
Build: Bump actions/checkout, actions/setup-node & github/codeql-action 1: Bump actions/checkout from 3.5.3 to 3.6.0 Bumps [actions/checkout](https://github.com/actions/checkout) from 3.5.3 to 3.6.0. - [Release notes](https://github.com/actions/checkout/releases) - [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md) - [Commits](https://github.com/actions/checkout/compare/c85c95e3d7251135ab7dc9ce3241c5835cc595a9...f43a0e5ff2bd294095638e18286ca9a3d1956744) --- updated-dependencies: - dependency-name: actions/checkout dependency-type: direct:production update-type: version-update:semver-minor ... 2: Bump actions/setup-node from 3.6.0 to 3.8.1 Bumps [actions/setup-node](https://github.com/actions/setup-node) from 3.6.0 to 3.8.1. - [Release notes](https://github.com/actions/setup-node/releases) - [Commits](https://github.com/actions/setup-node/compare/64ed1c7eab4cce3362f8c340dee64e5eaeef8f7c...5e21ff4d9bc1a8cf6de233a3057d20ec6b3fb69d) --- updated-dependencies: - dependency-name: actions/setup-node dependency-type: direct:production update-type: version-update:semver-minor ... 3: Bump github/codeql-action from 2.20.1 to 2.21.5 Bumps [github/codeql-action](https://github.com/github/codeql-action) from 2.20.1 to 2.21.5. - [Release notes](https://github.com/github/codeql-action/releases) - [Changelog](https://github.com/github/codeql-action/blob/main/CHANGELOG.md) - [Commits](https://github.com/github/codeql-action/compare/f6e388ebf0efc915c6c5b165b019ee61a6746a38...00e563ead9f72a8461b24876bee2d0c2e8bd2ee8) --- updated-dependencies: - dependency-name: github/codeql-action dependency-type: direct:production update-type: version-update:semver-minor ... Closes gh-5311 Closes gh-5312 Closes gh-5313 Signed-off-by: dependabot[bot] <support@github.com>
2023-09-01 00:37:59 +00:00
uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # v3.6.0
- name: Cache
uses: actions/cache@88522ab9f39a2ea568f7027eddc7d8d8bc9d59c8 # v3.3.1
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 }}
Build: Bump actions/checkout, actions/setup-node & github/codeql-action 1: Bump actions/checkout from 3.5.3 to 3.6.0 Bumps [actions/checkout](https://github.com/actions/checkout) from 3.5.3 to 3.6.0. - [Release notes](https://github.com/actions/checkout/releases) - [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md) - [Commits](https://github.com/actions/checkout/compare/c85c95e3d7251135ab7dc9ce3241c5835cc595a9...f43a0e5ff2bd294095638e18286ca9a3d1956744) --- updated-dependencies: - dependency-name: actions/checkout dependency-type: direct:production update-type: version-update:semver-minor ... 2: Bump actions/setup-node from 3.6.0 to 3.8.1 Bumps [actions/setup-node](https://github.com/actions/setup-node) from 3.6.0 to 3.8.1. - [Release notes](https://github.com/actions/setup-node/releases) - [Commits](https://github.com/actions/setup-node/compare/64ed1c7eab4cce3362f8c340dee64e5eaeef8f7c...5e21ff4d9bc1a8cf6de233a3057d20ec6b3fb69d) --- updated-dependencies: - dependency-name: actions/setup-node dependency-type: direct:production update-type: version-update:semver-minor ... 3: Bump github/codeql-action from 2.20.1 to 2.21.5 Bumps [github/codeql-action](https://github.com/github/codeql-action) from 2.20.1 to 2.21.5. - [Release notes](https://github.com/github/codeql-action/releases) - [Changelog](https://github.com/github/codeql-action/blob/main/CHANGELOG.md) - [Commits](https://github.com/github/codeql-action/compare/f6e388ebf0efc915c6c5b165b019ee61a6746a38...00e563ead9f72a8461b24876bee2d0c2e8bd2ee8) --- updated-dependencies: - dependency-name: github/codeql-action dependency-type: direct:production update-type: version-update:semver-minor ... Closes gh-5311 Closes gh-5312 Closes gh-5313 Signed-off-by: dependabot[bot] <support@github.com>
2023-09-01 00:37:59 +00:00
uses: actions/setup-node@5e21ff4d9bc1a8cf6de233a3057d20ec6b3fb69d # v3.8.1
with:
node-version: ${{ matrix.NODE_VERSION }}
- 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')
- name: Install dependencies
run: npm install
- name: Install Playwright dependencies
run: npx playwright-webkit install-deps
if: matrix.NPM_SCRIPT == 'test:browser' && contains(matrix.BROWSERS, 'WebkitHeadless')
- name: Build jQuery for Lint
run: npm run build:all
if: matrix.NPM_SCRIPT == 'test:browserless'
- name: Lint code
run: npm run lint
if: matrix.NODE_VERSION == '18.x'
- name: Prepare tests
run: npm run pretest
- name: Run tests
env:
BROWSERS: ${{ matrix.BROWSERS }}
run: |
export PATH=${HOME}/firefox:$PATH
npm run ${{ matrix.NPM_SCRIPT }}