Skip to content

Commit

Permalink
Add install deps action to reuse between workflows
Browse files Browse the repository at this point in the history
  • Loading branch information
joshmgross committed Oct 12, 2023
1 parent 30d8f85 commit a903cf2
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 41 deletions.
11 changes: 11 additions & 0 deletions .github/actions/install-dependencies/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
name: 'Install dependencies'
description: 'Set up node and install dependencies'
runs:
using: 'composite'
steps:
- uses: actions/setup-node@v3
with:
node-version: '20.x'
cache: npm

- run: npm ci
8 changes: 1 addition & 7 deletions .github/workflows/check-dist.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,7 @@ jobs:
steps:
- uses: actions/checkout@v3

- uses: actions/setup-node@v3
with:
node-version: '20.x'
cache: npm

- name: Install dependencies
run: npm ci
- uses: ./.github/actions/install-dependencies

- name: Rebuild the dist/ directory
run: npm run build
Expand Down
6 changes: 1 addition & 5 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,6 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: '20.x'
cache: npm
- run: npm ci
- uses: ./.github/actions/install-dependencies
- run: npm run style:check
- run: npm test
28 changes: 4 additions & 24 deletions .github/workflows/integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,12 +50,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/cache@v3
with:
path: ~/.npm
key: ${{runner.os}}-npm-${{hashFiles('**/package-lock.json')}}
restore-keys: ${{runner.os}}-npm-
- run: npm ci
- uses: ./.github/actions/install-dependencies
- id: npm-require
uses: ./
with:
Expand All @@ -75,12 +70,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/cache@v3
with:
path: ~/.npm
key: ${{runner.os}}-npm-${{hashFiles('**/package-lock.json')}}
restore-keys: ${{runner.os}}-npm-
- run: npm ci
- uses: ./.github/actions/install-dependencies
- id: previews-default
name: Default previews not set
uses: ./
Expand Down Expand Up @@ -133,12 +123,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/cache@v3
with:
path: ~/.npm
key: ${{runner.os}}-npm-${{hashFiles('**/package-lock.json')}}
restore-keys: ${{runner.os}}-npm-
- run: npm ci
- uses: ./.github/actions/install-dependencies
- id: user-agent-default
name: Default user-agent not set
uses: ./
Expand Down Expand Up @@ -195,12 +180,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/cache@v3
with:
path: ~/.npm
key: ${{runner.os}}-npm-${{hashFiles('**/package-lock.json')}}
restore-keys: ${{runner.os}}-npm-
- run: npm ci
- uses: ./.github/actions/install-dependencies
- id: debug-default
name: Default debug not set
uses: ./
Expand Down
6 changes: 1 addition & 5 deletions .github/workflows/licensed.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,5 @@ jobs:
- uses: jonabc/setup-licensed@82c5f4d19e8968efa74a25b132922382c2671fe2
with:
version: '3.x'
- uses: actions/setup-node@v3
with:
node-version: '20.x'
cache: npm
- run: npm ci
- uses: ./.github/actions/install-dependencies
- run: licensed status

0 comments on commit a903cf2

Please sign in to comment.