chore(deps-dev): update to node 16 (#5343)

#### Details

This PR bumps our default/recommended build environment to Node 16.

There aren't any real breaking changes affecting us here, except that our unit tests appear to be much slower (timing out after 10m instead of taking 6-7m in Node 14). We could work around this by just sharding the unit tests like we do for e2e tests already, but it's not ideal; besides "still being slower for local development", it also breaks code coverage reporting (unless we add some new job to merge the results before publishing coverage).

The most relevant looking Jest/Node/V8 issues seem to be covered in the discussion of https://github.com/facebook/jest/issues/11956 - it would be good to experiment with some of the options on that thread to see if we can get the unit test time back down without needing to shard them. Some options to explore:

* Test Node 16.10.0 vs 16.11.0 (we wouldn't want to pin to 16.10.0, but it would be good to try it out to verify that the slowness really is caused by the V8 update in question on that issue)
* Try out the assorted node/v8 command line argument combinations suggested by that thread

Alternatively, we could explore more generic ways of making the tests faster; I think https://github.com/nicolo-ribaudo/jest-light-runner would be promising to look into.

##### Motivation

Keep dependencies up to date; 16 has been an LTS release for several months now.

Also, `accessibility-insights-service` updated to Node 16 yesterday, and we want to ensure that the packages we publish for it to consume are tested in the same environment.

##### Context

n/a

#### Pull request checklist
<!-- If a checklist item is not applicable to this change, write "n/a" in the checkbox -->
- [n/a] Addresses an existing issue: #0000
- [x] Ran `yarn fastpass`
- [ ] Added/updated relevant unit test(s) (and ran `yarn test`)
- [n/a] Verified code coverage for the changes made. Check coverage report at: `<rootDir>/test-results/unit/coverage`
- [x] PR title *AND* final merge commit title both start with a semantic tag (`fix:`, `chore:`, `feat(feature-name):`, `refactor:`). See `CONTRIBUTING.md`.
- [n/a] (UI changes only) Added screenshots/GIFs to description above
- [n/a] (UI changes only) Verified usability with NVDA/JAWS
This commit is contained in:
Dan Bjorge 2022-04-29 17:57:41 -04:00 коммит произвёл GitHub
Родитель 6c2346f594
Коммит 83aa9147cf
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
6 изменённых файлов: 52 добавлений и 20 удалений

37
.github/workflows/ci.yml поставляемый
Просмотреть файл

@ -11,7 +11,7 @@ on:
env:
# Keep this in sync with /pipeline/install-node-prerequisites.yaml
NODE_VERSION: 14.19.0
NODE_VERSION: 16.14.2
jobs:
build:
@ -57,8 +57,14 @@ jobs:
timeout-minutes: 5
unit-tests:
name: unit-tests (${{ matrix.shard-index }}/${{ strategy.job-total }})
runs-on: ubuntu-20.04
env: { PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: 1 }
strategy:
fail-fast: false
matrix:
shard-index: [1, 2]
steps:
- uses: actions/checkout@v2
timeout-minutes: 2
@ -86,19 +92,44 @@ jobs:
- run: yarn install --frozen-lockfile --prefer-offline
timeout-minutes: 10
- run: yarn test --ci
- run: yarn test --ci --shard=${{ matrix.shard-index }}/${{ strategy.job-total }}
timeout-minutes: 10
- name: upload artifact unit-tests-results
uses: actions/upload-artifact@v2
if: ${{ always() }}
with:
name: unit-tests-results
name: unit-tests-${{ matrix.shard-index }}-results
path: |
test-results/unit/junit.xml
test-results/unit/coverage/cobertura-coverage.xml
timeout-minutes: 5
publish-code-coverage:
needs: unit-tests # This waits for *all* of the unit-tests jobs
runs-on: ubuntu-20.04
steps:
# This only needs to be present so codecov can use the source tree for some post-processing
# This job doesn't require that we install dependencies
- uses: actions/checkout@v2
timeout-minutes: 2
- uses: actions/setup-node@v2
with: { node-version: "${{ env.NODE_VERSION }}" }
timeout-minutes: 2
- uses: actions/download-artifact@v3
with:
name: unit-tests-1-results
path: unit-tests-1-results
timeout-minutes: 2
- uses: actions/download-artifact@v3
with:
name: unit-tests-2-results
path: unit-tests-2-results
timeout-minutes: 2
- run: yarn publish-code-coverage
timeout-minutes: 3

Просмотреть файл

@ -10,14 +10,15 @@ FROM mcr.microsoft.com/playwright:v1.21.1-focal AS setup
USER root
# We need to update certificates before we can successfully update and install node
# This is a workaround for https://github.com/nodesource/distributions/issues/1266
# Downgrading from nodejs 16.3.0 to 14.* is both for consistency with our other build
# environments and a workaround for https://github.com/nodejs/node/issues/39019
# This is a workaround for https://github.com/nodesource/distributions/issues/1266
#
# We pin nodejs 16.x instead of accepting Playwright's default for consistency with
# our other build environments.
RUN apt-get update ; apt-get install ca-certificates \
&& apt-get update \
&& apt-get install -y curl && \
curl -fsSL https://deb.nodesource.com/setup_14.x | bash - && \
apt-get install -y --allow-downgrades nodejs=14.* && \
curl -fsSL https://deb.nodesource.com/setup_16.x | bash - && \
apt-get install -y --allow-downgrades nodejs=16.* && \
rm -rf /var/lib/apt/lists/*
RUN npm install -g yarn@1.22.10

Просмотреть файл

@ -13,7 +13,7 @@ This document describes how to build and test Accessibility Insights for Web (th
You will need the following tools installed:
- [Node](https://nodejs.org) >= 14.19.0 (check by running `node --version`) - This is the version being enforced on our builds
- [Node](https://nodejs.org) >= 16.14.2 (check by running `node --version`) - This is the version being enforced on our builds
- [Yarn](https://yarnpkg.com/getting-started/install) >= 1.22.10 (check by running `yarn --version`)
- Note: There is a [known name collision](https://github.com/yarnpkg/yarn/issues/673) between Yarn package manager and Hadoop YARN. If you have Hadoop YARN installed, replace `yarn` with `yarnpkg` in the commands below.
- **macOS only** [Xcode](https://wilsonmar.github.io/xcode/#XcodeInstall). This is needed when installing certain dependencies with native compilation steps. After installing Xcode, run the following commands from a command terminal:

Просмотреть файл

@ -69,9 +69,9 @@
"start:unified": "electron drop/electron/unified-dev/product/bundle/main.bundle.js",
"start:unified:dev": "cross-env DEV_MODE=true yarnpkg start:unified",
"start:unified:mock-adb": "cross-env ANDROID_HOME=drop/mock-adb yarnpkg start:unified",
"test": "cross-env NODE_OPTIONS='--unhandled-rejections=strict' --max-old-space-size=16384 jest --projects src/tests/unit",
"test": "cross-env NODE_OPTIONS='--unhandled-rejections=strict' jest --projects src/tests/unit",
"publish-code-coverage": "npx codecov",
"test:e2e": "cross-env NODE_OPTIONS='--unhandled-rejections=strict' --max-old-space-size=16384 jest --projects src/tests/end-to-end --runInBand --forceExit --detectOpenHandles",
"test:e2e": "cross-env NODE_OPTIONS='--unhandled-rejections=strict' jest --projects src/tests/end-to-end --runInBand --forceExit --detectOpenHandles",
"test:e2e:docker:build": "docker build -t accessibility-insights-e2e --target web .",
"test:e2e:docker:build:web": "docker build -t accessibility-insights-web-e2e --target web .",
"test:e2e:docker:build:unified": "docker build -t accessibility-insights-unified-e2e --target unified .",
@ -79,7 +79,7 @@
"test:e2e:docker:run:web": "docker run -t accessibility-insights-web-e2e",
"test:e2e:docker:run:unified": "docker run -t accessibility-insights-unified-e2e sh -c \"yarn test:unified --ci\"",
"test:e2e:docker": "npm-run-all --serial test:e2e:docker:build \"test:e2e:docker:run {@}\" --",
"test:unified": "cross-env NODE_OPTIONS='--unhandled-rejections=strict' --max-old-space-size=16384 jest --projects src/tests/electron --runInBand --forceExit --detectOpenHandles",
"test:unified": "cross-env NODE_OPTIONS='--unhandled-rejections=strict' jest --projects src/tests/electron --runInBand --forceExit --detectOpenHandles",
"test:report:e2e": "lerna --scope accessibility-insights-report-e2e-tests run test",
"unified-mac-sign": "node ./pipeline/scripts/unified-mac-sign.js",
"watch": "npm-run-all --parallel --race --print-label watch:scss watch:grunt watch:test watch:webpack-dev-browser watch:webpack-unified",
@ -104,7 +104,7 @@
"@types/jsdom": "^16.2.14",
"@types/lodash": "^4.14.182",
"@types/luxon": "^2.3.1",
"@types/node": "^14.18.16",
"@types/node": "^16.11.7",
"@types/react": "^16.14.25",
"@types/react-copy-to-clipboard": "^5.0.2",
"@types/react-dom": "^16.9.15",
@ -202,7 +202,7 @@
"webextension-polyfill": "^0.9.0"
},
"resolutions": {
"@types/node": "^14.14.6",
"@types/node": "^16.11.7",
"ansi-regex": "^5.0.1",
"dot-prop": "^5.2.0",
"kind-of": "^6.0.3",

Просмотреть файл

@ -4,8 +4,8 @@ steps:
- task: NodeTool@0
inputs:
# Keep this in sync with /.github/workflows/ci.yml
versionSpec: '14.19.0'
displayName: use node 14.19.0
versionSpec: '16.14.2'
displayName: use node 16.14.2
timeoutInMinutes: 2
- script: npm install yarn@1.22.10 -g

Просмотреть файл

@ -2668,10 +2668,10 @@
resolved "https://registry.yarnpkg.com/@types/ms/-/ms-0.7.31.tgz#31b7ca6407128a3d2bbc27fe2d21b345397f6197"
integrity sha512-iiUgKzV9AuaEkZqkOLDIvlQiL6ltuZd9tGcW3gwpnX8JbuiuhFlEGmmFXEXkN50Cvq7Os88IY2v0dkDqXYWVgA==
"@types/node@*", "@types/node@16.9.1", "@types/node@^14.14.6", "@types/node@^14.18.16", "@types/node@^14.6.2":
version "14.18.16"
resolved "https://registry.yarnpkg.com/@types/node/-/node-14.18.16.tgz#878f670ba3f00482bf859b6550b6010610fc54b5"
integrity sha512-X3bUMdK/VmvrWdoTkz+VCn6nwKwrKCFTHtqwBIaQJNx4RUIBBUFXM00bqPz/DsDd+Icjmzm6/tyYZzeGVqb6/Q==
"@types/node@*", "@types/node@16.9.1", "@types/node@^14.6.2", "@types/node@^16.11.7":
version "16.11.26"
resolved "https://registry.yarnpkg.com/@types/node/-/node-16.11.26.tgz#63d204d136c9916fb4dcd1b50f9740fe86884e47"
integrity sha512-GZ7bu5A6+4DtG7q9GsoHXy3ALcgeIHP4NnL0Vv2wu0uUB/yQex26v0tf6/na1mm0+bS9Uw+0DFex7aaKr2qawQ==
"@types/normalize-package-data@^2.4.0":
version "2.4.1"