Skip to content

Commit

Permalink
ci: Implement restore-node as composite action (#339)
Browse files Browse the repository at this point in the history
ci: Implement `restore-node` as composite action
  • Loading branch information
wakamsha authored Dec 2, 2024
1 parent c5a1544 commit f850c1b
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 19 deletions.
22 changes: 22 additions & 0 deletions .github/actions/restore-node/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
name: Restore Node.js env

description: Restore the task runner infrastructure by Node.js

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

- name: cache node_modules
uses: actions/cache@v4
with:
path: |
./node_modules
key: node-${{ hashFiles('package-lock.json') }}

- name: install node_modules
shell: bash
run: npm install
9 changes: 2 additions & 7 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,8 @@ jobs:
fetch-depth: 0
persist-credentials: false

- name: Setup Node
uses: actions/setup-node@v4
with:
node-version-file: ./.node-version

- name: Install Dependencies
run: npm install
- name: Initialize
uses: ./.github/actions/restore-node

- name: Release
run: npm run release ${{ github.event.inputs.dry_run == 'true' && '-- --dry-run' || '' }}
Expand Down
18 changes: 6 additions & 12 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,21 +7,15 @@ on:

jobs:
test:
strategy:
matrix:
eslint: [8]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- uses: actions/setup-node@v4
with:
node-version-file: ./.node-version
- name: Initialize
uses: ./.github/actions/restore-node

- name: Use ESLint ${{ matrix.eslint }}
run: npm install eslint@${{ matrix.eslint }}
- name: Run Lint
run: npm run lint

- run: |
npm install --silent
npm run lint
npm run test
- name: Run Test
run: npm run test

0 comments on commit f850c1b

Please sign in to comment.