From 0c6a70f1220f47c36e8e65df9d1c950e917fd4c9 Mon Sep 17 00:00:00 2001 From: Miki Date: Wed, 12 Jul 2023 14:18:27 -0700 Subject: [PATCH] Add upgrading NPM to all workflows running older Node.js versions (#545) (#553) Also: * Add compatibility checks for Node.js v18 * Bump `actions/setup-node` to v3 Signed-off-by: Miki --- .github/workflows/bundler.yml | 13 ++++++++++++- .github/workflows/compatibility.yml | 2 +- .github/workflows/coverage.yml | 13 ++++++++++++- .github/workflows/gh_pages.yml | 2 +- .github/workflows/integration.yml | 30 +++++++++++++++++++++++++---- .github/workflows/license.yml | 13 ++++++++++++- .github/workflows/nodejs.yml | 15 +++++++++++++-- CHANGELOG.md | 3 +++ 8 files changed, 80 insertions(+), 11 deletions(-) diff --git a/.github/workflows/bundler.yml b/.github/workflows/bundler.yml index eeb16474a..8fb07ab73 100644 --- a/.github/workflows/bundler.yml +++ b/.github/workflows/bundler.yml @@ -30,10 +30,21 @@ jobs: make cluster.clean cluster.opensearch.build cluster.opensearch.start - name: Use Node.js 14.x - uses: actions/setup-node@v1 + uses: actions/setup-node@v3 with: node-version: 14.x + # NPM started understanding yarn.lock file starting from v7 + - name: Update NPM + shell: bash + run: | + export NPM_VERSION=$(npm -v) + export IS_NPM_SUITABLE=$(node -p "parseInt(process.env.NPM_ROOT, 10) >= 7") + if [ "$IS_NPM_SUITABLE" == "false" ]; then + echo "NPM needs upgrading!" + npm i npm@7 -g + fi + - name: Install run: | npm install diff --git a/.github/workflows/compatibility.yml b/.github/workflows/compatibility.yml index 132545b61..b711236a2 100644 --- a/.github/workflows/compatibility.yml +++ b/.github/workflows/compatibility.yml @@ -50,7 +50,7 @@ jobs: make cluster.clean cluster.opensearch.build cluster.opensearch.start - name: Use Node.js 16.x - uses: actions/setup-node@v1 + uses: actions/setup-node@v3 with: node-version: 16.x diff --git a/.github/workflows/coverage.yml b/.github/workflows/coverage.yml index 88a610c74..7de962d9b 100644 --- a/.github/workflows/coverage.yml +++ b/.github/workflows/coverage.yml @@ -23,10 +23,21 @@ jobs: - uses: actions/checkout@v2 - name: Use Node.js ${{ matrix.node-version }} - uses: actions/setup-node@v1 + uses: actions/setup-node@v3 with: node-version: ${{ matrix.node-version }} + # NPM started understanding yarn.lock file starting from v7 + - name: Update NPM + shell: bash + run: | + export NPM_VERSION=$(npm -v) + export IS_NPM_SUITABLE=$(node -p "parseInt(process.env.NPM_ROOT, 10) >= 7") + if [ "$IS_NPM_SUITABLE" == "false" ]; then + echo "NPM needs upgrading!" + npm i npm@7 -g + fi + - name: Install run: | npm install diff --git a/.github/workflows/gh_pages.yml b/.github/workflows/gh_pages.yml index ea39b7278..99f89b0cc 100644 --- a/.github/workflows/gh_pages.yml +++ b/.github/workflows/gh_pages.yml @@ -9,7 +9,7 @@ jobs: name: Update gh-pages with docs steps: - uses: actions/checkout@v3 - - uses: actions/setup-node@v1 + - uses: actions/setup-node@v3 with: ruby-version: 16.x - name: Install Tools diff --git a/.github/workflows/integration.yml b/.github/workflows/integration.yml index 14de9f6db..a99674a15 100644 --- a/.github/workflows/integration.yml +++ b/.github/workflows/integration.yml @@ -17,7 +17,7 @@ jobs: strategy: matrix: - node-version: [10.x, 12.x, 14.x, 16.x] + node-version: [10.x, 12.x, 14.x, 16.x, 18.x] steps: - uses: actions/checkout@v2 @@ -34,10 +34,21 @@ jobs: make cluster.clean cluster.opensearch.build cluster.opensearch.start - name: Use Node.js ${{ matrix.node-version }} - uses: actions/setup-node@v1 + uses: actions/setup-node@v3 with: node-version: ${{ matrix.node-version }} + # NPM started understanding yarn.lock file starting from v7 + - name: Update NPM + shell: bash + run: | + export NPM_VERSION=$(npm -v) + export IS_NPM_SUITABLE=$(node -p "parseInt(process.env.NPM_ROOT, 10) >= 7") + if [ "$IS_NPM_SUITABLE" == "false" ]; then + echo "NPM needs upgrading!" + npm i npm@7 -g + fi + - name: Install run: | npm install @@ -52,7 +63,7 @@ jobs: strategy: matrix: - node-version: [10.x, 12.x, 14.x, 16.x] + node-version: [10.x, 12.x, 14.x, 16.x, 18.x] steps: - uses: actions/checkout@v2 @@ -70,10 +81,21 @@ jobs: make cluster.clean cluster.opensearch.build cluster.opensearch.start - name: Use Node.js ${{ matrix.node-version }} - uses: actions/setup-node@v1 + uses: actions/setup-node@v3 with: node-version: ${{ matrix.node-version }} + # NPM started understanding yarn.lock file starting from v7 + - name: Update NPM + shell: bash + run: | + export NPM_VERSION=$(npm -v) + export IS_NPM_SUITABLE=$(node -p "parseInt(process.env.NPM_ROOT, 10) >= 7") + if [ "$IS_NPM_SUITABLE" == "false" ]; then + echo "NPM needs upgrading!" + npm i npm@7 -g + fi + - name: Install run: | npm install diff --git a/.github/workflows/license.yml b/.github/workflows/license.yml index 19b04b3c0..c9774ad67 100644 --- a/.github/workflows/license.yml +++ b/.github/workflows/license.yml @@ -15,10 +15,21 @@ jobs: - uses: actions/checkout@v2 - name: Use Node.js ${{ matrix.node-version }} - uses: actions/setup-node@v1 + uses: actions/setup-node@v3 with: node-version: ${{ matrix.node-version }} + # NPM started understanding yarn.lock file starting from v7 + - name: Update NPM + shell: bash + run: | + export NPM_VERSION=$(npm -v) + export IS_NPM_SUITABLE=$(node -p "parseInt(process.env.NPM_ROOT, 10) >= 7") + if [ "$IS_NPM_SUITABLE" == "false" ]; then + echo "NPM needs upgrading!" + npm i npm@7 -g + fi + - name: Install run: | npm install diff --git a/.github/workflows/nodejs.yml b/.github/workflows/nodejs.yml index 0576534f0..931c90d87 100644 --- a/.github/workflows/nodejs.yml +++ b/.github/workflows/nodejs.yml @@ -18,17 +18,28 @@ jobs: strategy: matrix: - node-version: [10.x, 12.x, 14.x, 16.x] + node-version: [10.x, 12.x, 14.x, 16.x, 18.x] os: [ubuntu-latest, windows-latest, macOS-latest] steps: - uses: actions/checkout@v2 - name: Use Node.js ${{ matrix.node-version }} - uses: actions/setup-node@v1 + uses: actions/setup-node@v3 with: node-version: ${{ matrix.node-version }} + # NPM started understanding yarn.lock file starting from v7 + - name: Update NPM + shell: bash + run: | + export NPM_VERSION=$(npm -v) + export IS_NPM_SUITABLE=$(node -p "parseInt(process.env.NPM_ROOT, 10) >= 7") + if [ "$IS_NPM_SUITABLE" == "false" ]; then + echo "NPM needs upgrading!" + npm i npm@7 -g + fi + - name: Install run: | npm install diff --git a/CHANGELOG.md b/CHANGELOG.md index 004050322..3aa42792e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,9 @@ Inspired from [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) ### Added ### Dependencies ### Changed + +- Add upgrading NPM to all workflows running older Node.js versions ([#545](https://github.com/opensearch-project/opensearch-js/issues/545)) + ### Deprecated ### Removed ### Fixed