From 5dfce5443744271f778313c23eb8ec3a5af481f8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=BA=8C=E8=B4=A7=E7=88=B1=E5=90=83=E7=99=BD=E8=90=9D?= =?UTF-8?q?=E5=8D=9C?= Date: Sun, 19 Feb 2023 13:56:20 +0800 Subject: [PATCH] ci: use node 16 (#40800) * chore: use node 16 * chore: all lock ver * chore: size-limit * chore: mv clean up logic into master --- .github/workflows/size-limit.yml | 4 ++++ .github/workflows/test.yml | 33 ++++++++++++++++++++++++++++++++ tests/setup.js | 15 +++++++++++++++ 3 files changed, 52 insertions(+) diff --git a/.github/workflows/size-limit.yml b/.github/workflows/size-limit.yml index bcce41cd74..147e80e5bd 100644 --- a/.github/workflows/size-limit.yml +++ b/.github/workflows/size-limit.yml @@ -25,6 +25,10 @@ jobs: - name: checkout uses: actions/checkout@v3 + - uses: actions/setup-node@v3 + with: + node-version: 16 + - name: cache package-lock.json uses: actions/cache@v3 with: diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 78d828022c..76f053b7ec 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -19,6 +19,10 @@ jobs: - name: checkout uses: actions/checkout@v3 + - uses: actions/setup-node@v3 + with: + node-version: 16 + - name: cache package-lock.json uses: actions/cache@v3 with: @@ -51,6 +55,10 @@ jobs: - name: checkout uses: actions/checkout@v3 + - uses: actions/setup-node@v3 + with: + node-version: 16 + - name: restore cache from package-lock.json uses: actions/cache@v3 with: @@ -73,6 +81,10 @@ jobs: - name: checkout uses: actions/checkout@v3 + - uses: actions/setup-node@v3 + with: + node-version: 16 + - name: restore cache from package-lock.json uses: actions/cache@v3 with: @@ -97,6 +109,10 @@ jobs: - name: checkout uses: actions/checkout@v3 + - uses: actions/setup-node@v3 + with: + node-version: 16 + - name: restore cache from package-lock.json uses: actions/cache@v3 with: @@ -136,6 +152,10 @@ jobs: - name: checkout uses: actions/checkout@v3 + - uses: actions/setup-node@v3 + with: + node-version: 16 + - name: restore cache from package-lock.json uses: actions/cache@v3 with: @@ -209,6 +229,11 @@ jobs: needs: [normal-test] steps: - uses: actions/checkout@v3 + + - uses: actions/setup-node@v3 + with: + node-version: 16 + - uses: actions/download-artifact@v3 with: name: coverage-artifacts @@ -231,6 +256,10 @@ jobs: - name: checkout uses: actions/checkout@v3 + - uses: actions/setup-node@v3 + with: + node-version: 16 + - name: restore cache from package-lock.json uses: actions/cache@v3 with: @@ -278,6 +307,10 @@ jobs: if: ${{ github.event_name != 'pull_request' || matrix.module != 'lib' }} uses: actions/checkout@v3 + - uses: actions/setup-node@v3 + with: + node-version: 16 + - name: restore cache from package-lock.json # lib only run in master branch not in pull request if: ${{ github.event_name != 'pull_request' || matrix.module != 'lib' }} diff --git a/tests/setup.js b/tests/setup.js index 8623ee6bb0..25f9bf9901 100644 --- a/tests/setup.js +++ b/tests/setup.js @@ -4,6 +4,21 @@ const util = require('util'); // eslint-disable-next-line no-console console.log('Current React Version:', React.version); +const originConsoleErr = console.error; + +// Hack off React warning to avoid too large log in CI. +console.error = (...args) => { + const str = args.join('').replace(/\n/g, ''); + + if ( + ['validateDOMNesting', 'on an unmounted component', 'not wrapped in act'].every( + (warn) => !str.includes(warn), + ) + ) { + originConsoleErr(...args); + } +}; + /* eslint-disable global-require */ if (typeof window !== 'undefined') { global.window.resizeTo = (width, height) => {