Skip to content

Commit

Permalink
Add setup-node action
Browse files Browse the repository at this point in the history
  • Loading branch information
fvictorio committed Aug 21, 2024
1 parent 695a61f commit 303e16f
Show file tree
Hide file tree
Showing 6 changed files with 36 additions and 89 deletions.
24 changes: 24 additions & 0 deletions .github/actions/setup-node/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: Setup node
description: Sets up node and pnpm

inputs:
pnpm-version:
description: Version of pnpm to install
required: false
default: "9"
node-version:
description: Version of node to install
required: false
default: "20"

runs:
using: composite
steps:
- uses: pnpm/action-setup@v4
with:
version: ${{ inputs.pnpm-version }}
- uses: actions/setup-node@v4
id: setup-node
with:
node-version: ${{ inputs.node-version }}
cache: pnpm
10 changes: 1 addition & 9 deletions .github/workflows/edr-benchmark.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,15 +27,7 @@ jobs:
if: github.ref == 'refs/heads/main' || github.repository == github.event.pull_request.head.repo.full_name
steps:
- uses: actions/checkout@v3

- uses: pnpm/action-setup@v4
with:
version: 9
- name: Install Node
uses: actions/setup-node@v2
with:
node-version: 20
cache: pnpm
- uses: .github/actions/setup-node

- name: Install Rust (stable)
uses: actions-rs/toolchain@v1
Expand Down
20 changes: 2 additions & 18 deletions .github/workflows/edr-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -165,19 +165,10 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3

- uses: pnpm/action-setup@v4
with:
version: 9
- name: Install Node
uses: actions/setup-node@v2
with:
node-version: ${{ matrix.node }}
cache: pnpm
- uses: .github/actions/setup-node

- name: Install package
run: pnpm install --frozen-lockfile --prefer-offline

- name: Run lint script
run: pnpm run lint

Expand All @@ -186,14 +177,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: pnpm/action-setup@v4
with:
version: 9
- name: Install Node
uses: actions/setup-node@v2
with:
node-version: ${{ matrix.node }}
cache: pnpm
- uses: .github/actions/setup-node

- name: Install package
run: pnpm install --frozen-lockfile --prefer-offline
Expand Down
40 changes: 5 additions & 35 deletions .github/workflows/edr-npm-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ jobs:
uses: actions/setup-node@v3
if: ${{ !matrix.settings.docker }}
with:
node-version: 18
node-version: 20
check-latest: true
cache: pnpm
- name: Install Rust toolchain
Expand Down Expand Up @@ -174,15 +174,7 @@ jobs:
working-directory: ./crates/edr_napi
steps:
- uses: actions/checkout@v4
- uses: pnpm/action-setup@v4
with:
version: 9
- name: Setup node
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node }}
check-latest: true
cache: pnpm
- uses: .github/actions/setup-node
- name: Install dependencies
run: pnpm install --frozen-lockfile --prefer-offline
- name: Download artifacts
Expand All @@ -208,15 +200,7 @@ jobs:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
- uses: pnpm/action-setup@v4
with:
version: 9
- name: Setup node
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node }}
check-latest: true
cache: pnpm
- uses: .github/actions/setup-node
- name: Install dependencies
run: pnpm install --frozen-lockfile --prefer-offline
- name: Download artifacts
Expand Down Expand Up @@ -244,15 +228,9 @@ jobs:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
- uses: pnpm/action-setup@v4
with:
version: 9
- name: Setup node
uses: actions/setup-node@v3
- uses: .github/actions/setup-node
with:
node-version: ${{ matrix.node }}
check-latest: true
cache: pnpm
- name: Install dependencies
run: |
pnpm config set supportedArchitectures.libc "musl"
Expand Down Expand Up @@ -395,15 +373,7 @@ jobs:
working-directory: ./crates/edr_napi
steps:
- uses: actions/checkout@v4
- uses: pnpm/action-setup@v4
with:
version: 9
- name: Setup node
uses: actions/setup-node@v3
with:
node-version: 18
check-latest: true
cache: pnpm
- uses: .github/actions/setup-node
- name: Install dependencies
run: pnpm install --frozen-lockfile --prefer-offline
- name: Download all artifacts
Expand Down
20 changes: 3 additions & 17 deletions .github/workflows/hardhat-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,19 +16,13 @@ jobs:
strategy:
fail-fast: false
matrix:
node: [18.15]
node: [20]
os: ["macos-latest", "ubuntu-latest", "windows-latest"]
steps:
- uses: actions/checkout@v3

- uses: pnpm/action-setup@v4
with:
version: 9
- name: Install Node
uses: actions/setup-node@v2
- uses: .github/actions/setup-node
with:
node-version: ${{ matrix.node }}
cache: pnpm

- name: Install Rust (stable)
uses: actions-rs/toolchain@v1
Expand Down Expand Up @@ -72,15 +66,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3

- uses: pnpm/action-setup@v4
with:
version: 9
- name: Install Node
uses: actions/setup-node@v2
with:
node-version: 18.15
cache: pnpm
- uses: .github/actions/setup-node

- name: Install package
run: pnpm install --frozen-lockfile --prefer-offline
Expand Down
11 changes: 1 addition & 10 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,16 +19,7 @@ jobs:
# This makes Actions fetch all Git history so that Changesets can generate changelogs with the correct commits
fetch-depth: 0

- name: Setup pnpm
uses: pnpm/action-setup@v4
with:
version: 9

- name: Setup Node.js 18.x
uses: actions/setup-node@v2
with:
node-version: 18.x
cache: "pnpm"
- uses: .github/actions/setup-node

- name: Install Dependencies
run: pnpm install --frozen-lockfile --prefer-offline
Expand Down

0 comments on commit 303e16f

Please sign in to comment.