From 3e07ab44a8b67d2e892457492025b7dab6049b1e Mon Sep 17 00:00:00 2001 From: Miki Date: Tue, 11 Jul 2023 20:49:39 -0700 Subject: [PATCH] Add upgrading NPM to all workflows running older Node.js versions (#545) 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/gh_pages.yml | 2 +- .github/workflows/integration.yml | 30 ++++++++++++++++++++++++++---- CHANGELOG.md | 3 ++- 4 files changed, 41 insertions(+), 7 deletions(-) diff --git a/.github/workflows/bundler.yml b/.github/workflows/bundler.yml index 9c3d11de6..fee280303 100644 --- a/.github/workflows/bundler.yml +++ b/.github/workflows/bundler.yml @@ -31,10 +31,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/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/CHANGELOG.md b/CHANGELOG.md index c9af4a2f3..4f0523114 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -18,6 +18,7 @@ Inspired from [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) - Bumps `node-fetch` from 3.2.10 to 3.3.1 ### Changed - Implemented Docker Image caching for `integration-unreleased` workflow ([#387](https://github.com/opensearch-project/opensearch-js/issues/387)) +- Add upgrading NPM to all workflows running older Node.js versions ([#545](https://github.com/opensearch-project/opensearch-js/issues/545)) ### Deprecated ### Removed ### Fixed @@ -151,4 +152,4 @@ Inspired from [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) [2.1.0]: https://github.com/opensearch-project/opensearch-js/releases/tag/2.1.0 [2.2.0]: https://github.com/opensearch-project/opensearch-js/releases/tag/2.2.0 [2.2.1]: https://github.com/opensearch-project/opensearch-js/releases/tag/2.2.1 -[Unreleased]: https://github.com/opensearch-project/opensearch-js/compare/2.2.1...HEAD \ No newline at end of file +[Unreleased]: https://github.com/opensearch-project/opensearch-js/compare/2.2.1...HEAD