Skip to content

Commit

Permalink
Add upgrading NPM to all workflows running older Node.js versions (#545
Browse files Browse the repository at this point in the history
…) (#553)

Also:
* Add compatibility checks for Node.js v18
* Bump `actions/setup-node` to v3

Signed-off-by: Miki <miki@amazon.com>
  • Loading branch information
AMoo-Miki committed Jul 12, 2023
1 parent 9ed86ee commit 0c6a70f
Show file tree
Hide file tree
Showing 8 changed files with 80 additions and 11 deletions.
13 changes: 12 additions & 1 deletion .github/workflows/bundler.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/compatibility.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
13 changes: 12 additions & 1 deletion .github/workflows/coverage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/gh_pages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
30 changes: 26 additions & 4 deletions .github/workflows/integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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
Expand Down
13 changes: 12 additions & 1 deletion .github/workflows/license.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
15 changes: 13 additions & 2 deletions .github/workflows/nodejs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 0c6a70f

Please sign in to comment.