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

80 lines
2.6 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, 14.x, 16.x, 18.x, 19.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: AMD build, Chrome stable"
NODE_VERSION: "18.x"
NPM_SCRIPT: "test:amd"
BROWSERS: "ChromeHeadless"
- NAME: "Browser tests: full build, Firefox ESR"
NODE_VERSION: "18.x"
NPM_SCRIPT: "test:browser"
BROWSERS: "FirefoxHeadless"
steps:
- name: Checkout
Build: Update GitHub Actions * Build(deps): Bump actions/cache from 2 to 3 Bumps [actions/cache](https://github.com/actions/cache) from 2 to 3. - [Release notes](https://github.com/actions/cache/releases) - [Changelog](https://github.com/actions/cache/blob/main/RELEASES.md) - [Commits](https://github.com/actions/cache/compare/v2...v3) --- updated-dependencies: - dependency-name: actions/cache dependency-type: direct:production update-type: version-update:semver-major ... * Build(deps): Bump actions/setup-node from 2.1.2 to 3.3.0 Bumps [actions/setup-node](https://github.com/actions/setup-node) from 2.1.2 to 3.3.0. - [Release notes](https://github.com/actions/setup-node/releases) - [Commits](https://github.com/actions/setup-node/compare/v2.1.2...v3.3.0) --- updated-dependencies: - dependency-name: actions/setup-node dependency-type: direct:production update-type: version-update:semver-major ... * Build(deps): Bump actions/checkout from 2 to 3 Bumps [actions/checkout](https://github.com/actions/checkout) from 2 to 3. - [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/v2...v3) --- updated-dependencies: - dependency-name: actions/checkout dependency-type: direct:production update-type: version-update:semver-major ... Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Closes gh-5067 (cherry picked from commit 52f452b2e8881e5ec5c9e880e277c8ecf633e8dc)
2022-06-27 16:53:31 +00:00
uses: actions/checkout@v3
- name: Cache
Build: Update GitHub Actions * Build(deps): Bump actions/cache from 2 to 3 Bumps [actions/cache](https://github.com/actions/cache) from 2 to 3. - [Release notes](https://github.com/actions/cache/releases) - [Changelog](https://github.com/actions/cache/blob/main/RELEASES.md) - [Commits](https://github.com/actions/cache/compare/v2...v3) --- updated-dependencies: - dependency-name: actions/cache dependency-type: direct:production update-type: version-update:semver-major ... * Build(deps): Bump actions/setup-node from 2.1.2 to 3.3.0 Bumps [actions/setup-node](https://github.com/actions/setup-node) from 2.1.2 to 3.3.0. - [Release notes](https://github.com/actions/setup-node/releases) - [Commits](https://github.com/actions/setup-node/compare/v2.1.2...v3.3.0) --- updated-dependencies: - dependency-name: actions/setup-node dependency-type: direct:production update-type: version-update:semver-major ... * Build(deps): Bump actions/checkout from 2 to 3 Bumps [actions/checkout](https://github.com/actions/checkout) from 2 to 3. - [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/v2...v3) --- updated-dependencies: - dependency-name: actions/checkout dependency-type: direct:production update-type: version-update:semver-major ... Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Closes gh-5067 (cherry picked from commit 52f452b2e8881e5ec5c9e880e277c8ecf633e8dc)
2022-06-27 16:53:31 +00:00
uses: actions/cache@v3
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 }}
uses: actions/setup-node@v3.5.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'"
- name: Run tests
env:
BROWSERS: ${{ matrix.BROWSERS }}
run: |
export PATH=${HOME}/firefox:$PATH
npm run ${{ matrix.NPM_SCRIPT }}