Skip to content

Commit

Permalink
ci: refactor node setup into a composite action to remove duplication
Browse files Browse the repository at this point in the history
  • Loading branch information
Chrysalis-B committed Nov 15, 2024
1 parent 4df0e2a commit 8733dcd
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 24 deletions.
15 changes: 15 additions & 0 deletions .github/actions/node-setup/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
name: Node.js Setup
description: Sets up Node.js and installs dependencies.

runs:
using: composite
steps:
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version-file: '.nvmrc'
cache: 'npm'

- name: Install Dependencies
shell: bash
run: npm ci
32 changes: 8 additions & 24 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,22 +13,16 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Install nodejs
uses: actions/setup-node@v4
with:
node-version-file: '.nvmrc'
cache: 'npm'

- name: Node.js Setup
uses: ./.github/actions/node-setup

- name: Restore puppeteer cache
uses: actions/cache@v4
with:
path: ~/.cache/puppeteer
key: ${{ runner.os }}-${{ hashFiles('package-lock.json') }}

- name: Install dependencies
run: npm ci

- run: npm rebuild full-icu

- name: Run Jest Tests
Expand All @@ -38,15 +32,9 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Install nodejs
uses: actions/setup-node@v4
with:
node-version-file: '.nvmrc'
cache: 'npm'

- name: Install dependencies
run: npm ci
- name: Node.js Setup
uses: ./.github/actions/node-setup

- name: Install Playwright Browsers
run: npx playwright install --with-deps
Expand All @@ -58,20 +46,16 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Install nodejs
uses: actions/setup-node@v4
with:
node-version-file: '.nvmrc'
cache: 'npm'

- name: Node.js Setup
uses: ./.github/actions/node-setup

- name: Restore puppeteer cache
uses: actions/cache@v4
with:
path: ~/.cache/puppeteer
key: ${{ runner.os }}-${{ hashFiles('package-lock.json') }}

- run: npm ci
- name: "run linter"
env:
NODE_OPTIONS: "--max_old_space_size=4096"
Expand Down

0 comments on commit 8733dcd

Please sign in to comment.