feat(ci): add custom Node.js and pnpm setup action
- Introduced a new GitHub Action for setting up Node.js and pnpm with caching capabilities. - Updated workflows to utilize the new action, changing the Node.js version to 22.x across CI, API client, and release workflows. - Streamlined dependency installation and caching processes for improved build performance. Signed-off-by: Innei <tukon479@gmail.com>
This commit is contained in:
40
.github/actions/setup-node/action.yml
vendored
Normal file
40
.github/actions/setup-node/action.yml
vendored
Normal file
@@ -0,0 +1,40 @@
|
|||||||
|
name: 'Setup Node.js and pnpm'
|
||||||
|
description: 'Sets up Node.js and pnpm with caching'
|
||||||
|
|
||||||
|
inputs:
|
||||||
|
node-version:
|
||||||
|
description: 'Node.js version to use'
|
||||||
|
required: false
|
||||||
|
default: '22.x'
|
||||||
|
|
||||||
|
runs:
|
||||||
|
using: 'composite'
|
||||||
|
steps:
|
||||||
|
- name: Use Node.js ${{ inputs.node-version }}
|
||||||
|
uses: actions/setup-node@v4
|
||||||
|
with:
|
||||||
|
node-version: ${{ inputs.node-version }}
|
||||||
|
|
||||||
|
- name: Setup pnpm
|
||||||
|
uses: pnpm/action-setup@v4.1.0
|
||||||
|
with:
|
||||||
|
run_install: false
|
||||||
|
|
||||||
|
- name: Get pnpm store directory
|
||||||
|
shell: bash
|
||||||
|
run: |
|
||||||
|
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV
|
||||||
|
|
||||||
|
- name: Cache pnpm modules
|
||||||
|
uses: actions/cache@v4
|
||||||
|
env:
|
||||||
|
cache-name: cache-pnpm-modules
|
||||||
|
with:
|
||||||
|
path: ${{ env.STORE_PATH }}
|
||||||
|
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ inputs.node-version }}-${{ hashFiles('**/pnpm-lock.yaml') }}
|
||||||
|
restore-keys: |
|
||||||
|
${{ runner.os }}-build-${{ env.cache-name }}-${{ inputs.node-version }}-${{ hashFiles('**/pnpm-lock.yaml') }}
|
||||||
|
|
||||||
|
- name: Install Dependencies
|
||||||
|
shell: bash
|
||||||
|
run: pnpm i
|
||||||
2
.github/workflows/api-client.yml
vendored
2
.github/workflows/api-client.yml
vendored
@@ -23,7 +23,7 @@ jobs:
|
|||||||
|
|
||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
node-version: [20.x]
|
node-version: [22.x]
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
|
|||||||
76
.github/workflows/ci.yml
vendored
76
.github/workflows/ci.yml
vendored
@@ -4,7 +4,8 @@ on:
|
|||||||
- 'v*'
|
- 'v*'
|
||||||
paths-ignore:
|
paths-ignore:
|
||||||
- CHANGELOG.MD
|
- CHANGELOG.MD
|
||||||
branches: master
|
branches:
|
||||||
|
- master
|
||||||
pull_request:
|
pull_request:
|
||||||
workflow_dispatch:
|
workflow_dispatch:
|
||||||
name: CI
|
name: CI
|
||||||
@@ -54,44 +55,15 @@ jobs:
|
|||||||
core:
|
core:
|
||||||
name: Build (Core)
|
name: Build (Core)
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
strategy:
|
|
||||||
matrix:
|
|
||||||
node-version: [20.x]
|
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- name: Checkout
|
||||||
- name: Use Node.js ${{ matrix.node-version }}
|
uses: actions/checkout@v4
|
||||||
uses: actions/setup-node@v4
|
- name: Setup Node.js and pnpm
|
||||||
|
uses: ./.github/actions/setup-node
|
||||||
with:
|
with:
|
||||||
node-version: ${{ matrix.node-version }}
|
node-version: '22.x'
|
||||||
|
|
||||||
- name: Setup pnpm
|
|
||||||
uses: pnpm/action-setup@v4.1.0
|
|
||||||
with:
|
|
||||||
version:
|
|
||||||
run_install: false
|
|
||||||
|
|
||||||
- name: Get pnpm store directory
|
|
||||||
shell: bash
|
|
||||||
run: |
|
|
||||||
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV
|
|
||||||
|
|
||||||
- name: Cache pnpm modules
|
|
||||||
uses: actions/cache@v4
|
|
||||||
env:
|
|
||||||
cache-name: cache-pnpm-modules
|
|
||||||
with:
|
|
||||||
path: ${{ env.STORE_PATH }}
|
|
||||||
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ matrix.node-version }}-${{ hashFiles('**/pnpm-lock.yaml') }}
|
|
||||||
restore-keys: |
|
|
||||||
${{ runner.os }}-build-${{ env.cache-name }}-${{ matrix.node-version }}-${{ hashFiles('**/pnpm-lock.yaml') }}
|
|
||||||
- name: Install Dependencies
|
|
||||||
run: |
|
|
||||||
pnpm i
|
|
||||||
- name: Build project
|
- name: Build project
|
||||||
run: |
|
run: npm run bundle
|
||||||
npm run bundle
|
|
||||||
- name: Start MongoDB
|
- name: Start MongoDB
|
||||||
uses: supercharge/mongodb-github-action@1.12.0
|
uses: supercharge/mongodb-github-action@1.12.0
|
||||||
with:
|
with:
|
||||||
@@ -101,36 +73,22 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
redis-version: 6
|
redis-version: 6
|
||||||
- name: Test Bundle Server
|
- name: Test Bundle Server
|
||||||
run: |
|
run: bash scripts/workflow/test-server.sh
|
||||||
bash scripts/workflow/test-server.sh
|
|
||||||
test:
|
test:
|
||||||
name: Test
|
name: Test
|
||||||
timeout-minutes: 10
|
timeout-minutes: 10
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
strategy:
|
|
||||||
matrix:
|
|
||||||
node-version: [20.x]
|
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- name: Checkout
|
||||||
- name: Use Node.js ${{ matrix.node-version }}
|
uses: actions/checkout@v4
|
||||||
uses: actions/setup-node@v4
|
- name: Setup Node.js and pnpm
|
||||||
|
uses: ./.github/actions/setup-node
|
||||||
with:
|
with:
|
||||||
node-version: ${{ matrix.node-version }}
|
node-version: '22.x'
|
||||||
|
|
||||||
- name: Setup pnpm
|
|
||||||
uses: pnpm/action-setup@v3
|
|
||||||
with:
|
|
||||||
run_install: |
|
|
||||||
- recursive: false
|
|
||||||
- name: Run Lint
|
- name: Run Lint
|
||||||
run: |
|
run: npm run lint
|
||||||
npm run lint
|
|
||||||
|
|
||||||
- name: Run Tests
|
- name: Run Tests
|
||||||
run: |
|
run: npm run test
|
||||||
npm run test
|
|
||||||
|
|
||||||
env:
|
env:
|
||||||
CI: true
|
CI: true
|
||||||
|
|||||||
3
.github/workflows/release.yml
vendored
3
.github/workflows/release.yml
vendored
@@ -19,7 +19,7 @@ jobs:
|
|||||||
fetch-depth: 0
|
fetch-depth: 0
|
||||||
- uses: actions/setup-node@v4
|
- uses: actions/setup-node@v4
|
||||||
with:
|
with:
|
||||||
node-version: 20.x
|
node-version: 22.x
|
||||||
|
|
||||||
- name: Start MongoDB
|
- name: Start MongoDB
|
||||||
uses: supercharge/mongodb-github-action@1.12.0
|
uses: supercharge/mongodb-github-action@1.12.0
|
||||||
@@ -32,7 +32,6 @@ jobs:
|
|||||||
- name: Setup pnpm
|
- name: Setup pnpm
|
||||||
uses: pnpm/action-setup@v4.1.0
|
uses: pnpm/action-setup@v4.1.0
|
||||||
with:
|
with:
|
||||||
version:
|
|
||||||
run_install: false
|
run_install: false
|
||||||
|
|
||||||
- name: Get pnpm store directory
|
- name: Get pnpm store directory
|
||||||
|
|||||||
Reference in New Issue
Block a user