Skip to content

Commit

Permalink
Move environment setup to custom action
Browse files Browse the repository at this point in the history
  • Loading branch information
jantoun-scottlogic committed May 21, 2024
1 parent 9400f5e commit f157b7d
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 22 deletions.
16 changes: 16 additions & 0 deletions .github/actions/set-up-environment/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
name: "Set up environment"
description: "Sets up Node and installs dependencies"
runs:
using: "composite"
steps:
- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: 18
- name: Cache dependencies
uses: actions/cache@v4
with:
path: ~/.npm
key: node-modules-${{ hashFiles('**/package-lock.json') }}
- name: Install dependencies
run: npm ci
26 changes: 4 additions & 22 deletions .github/workflows/pull-request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,8 @@ jobs:
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: 18
- name: Cache dependencies
uses: actions/cache@v4
with:
path: ~/.npm
key: node-modules-${{ hashFiles('**/package-lock.json') }}
- name: Install dependencies
run: npm ci
- name: Set up environment
uses: ./.github/actions/set-up-environment
- name: Build app
run: npm run build
unit_tests:
Expand All @@ -26,16 +17,7 @@ jobs:
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: 18
- name: Cache dependencies
uses: actions/cache@v4
with:
path: ~/.npm
key: node-modules-${{ hashFiles('**/package-lock.json') }}
- name: Install dependencies
run: npm ci
- name: Set up environment
uses: ./.github/actions/set-up-environment
- name: Run tests
run: npm test

0 comments on commit f157b7d

Please sign in to comment.