Skip to content

Commit cf9db7a

Browse files
committed
Add setup actions and migrate ci package manager to pnpm
1 parent addc715 commit cf9db7a

File tree

2 files changed

+48
-40
lines changed

2 files changed

+48
-40
lines changed

.github/actions/setup/action.yaml

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
name: Setup Action
2+
description: |
3+
Setup Node.js and pnpm.
4+
5+
runs:
6+
using: composite
7+
steps:
8+
- name: Setup pnpm
9+
uses: pnpm/action-setup@fe02b34f77f8bc703788d5817da081398fad5dd2 # v4.0.0
10+
- name: Setup Node.js
11+
uses: actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8 # v4.0.2
12+
with:
13+
node-version-file: ./.node-version
14+
cache: pnpm
15+
- name: Get pnpm store directory
16+
shell: bash
17+
run: |
18+
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV
19+
- uses: actions/cache@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 # v4.0.2
20+
name: Setup pnpm cache
21+
with:
22+
path: ${{ env.STORE_PATH }}
23+
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
24+
restore-keys: |
25+
${{ runner.os }}-pnpm-store-
26+
- name: Install Dependencies
27+
run: pnpm install --frozen-lockfile
28+
shell: bash

.github/workflows/workflow.yaml

Lines changed: 20 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -6,54 +6,39 @@ jobs:
66
runs-on: ubuntu-latest
77
steps:
88
- name: Checkout
9-
uses: actions/checkout@1d96c772d19495a3b5c517cd2bc0cb401ea0529f # v4.1.3
10-
- name: Set Node.js 20.x
11-
uses: actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8 # v4.0.2
12-
with:
13-
node-version: 20.x
14-
cache: yarn
15-
- name: Install Dependencies
16-
run: yarn install --frozen-lockfile
9+
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
10+
- name: Setup
11+
uses: ./.github/actions/setup
1712
- name: Lint
18-
run: yarn lint
13+
run: pnpm lint
1914
- name: TypeCheck
20-
run: yarn typecheck
15+
run: pnpm typecheck
2116

2217
unit-test:
2318
name: Unit Tests
2419
runs-on: ubuntu-latest
2520
needs: check
2621
steps:
27-
- name: Checkout
28-
uses: actions/checkout@1d96c772d19495a3b5c517cd2bc0cb401ea0529f # v4.1.3
29-
- name: Set Node.js 20.x
30-
uses: actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8 # v4.0.2
31-
with:
32-
node-version: 20.x
33-
cache: yarn
34-
- name: Install Dependencies
35-
run: yarn install --frozen-lockfile
36-
- name: Test
37-
run: yarn test
38-
- name: Build
39-
run: yarn build
22+
- name: Checkout
23+
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
24+
- name: Setup
25+
uses: ./.github/actions/setup
26+
- name: Test
27+
run: pnpm test
28+
- name: Build
29+
run: pnpm build
4030

4131
build:
4232
name: Build
4333
runs-on: ubuntu-latest
4434
needs: check
4535
steps:
4636
- name: Checkout
47-
uses: actions/checkout@1d96c772d19495a3b5c517cd2bc0cb401ea0529f # v4.1.3
48-
- name: Set Node.js 20.x
49-
uses: actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8 # v4.0.2
50-
with:
51-
node-version: 20.x
52-
cache: yarn
53-
- name: Install Dependencies
54-
run: yarn install --frozen-lockfile
37+
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
38+
- name: Setup
39+
uses: ./.github/actions/setup
5540
- name: Build
56-
run: yarn build
41+
run: pnpm build
5742
- name: Upload Artifact
5843
uses: actions/upload-artifact@65462800fd760344b1a7b4382951275a0abb4808 # v4.3.3
5944
with:
@@ -72,14 +57,9 @@ jobs:
7257
os: [ubuntu-latest, windows-latest, macos-latest]
7358
steps:
7459
- name: Checkout
75-
uses: actions/checkout@1d96c772d19495a3b5c517cd2bc0cb401ea0529f # v4.1.3
76-
- name: Set Node.js 20.x
77-
uses: actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8 # v4.0.2
78-
with:
79-
node-version: 20.x
80-
cache: yarn
81-
- name: Install Dependencies
82-
run: yarn install --frozen-lockfile
60+
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
61+
- name: Setup
62+
uses: ./.github/actions/setup
8363
- name: Download Artifact
8464
uses: actions/download-artifact@9c19ed7fe5d278cd354c7dfd5d3b88589c7e2395 # v4.1.6
8565
- name: Run Integration Tests

0 commit comments

Comments
 (0)