Skip to content

Commit 6a7f765

Browse files
authored
Setting/#311-B: 의존성 캐시 추가 (#312)
1 parent 6b23eb6 commit 6a7f765

File tree

1 file changed

+44
-34
lines changed

1 file changed

+44
-34
lines changed

.github/workflows/ci.yml

Lines changed: 44 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -3,47 +3,57 @@ name: ci
33
on:
44
workflow_dispatch:
55
pull_request:
6-
branches: [ dev ]
6+
branches: [dev]
77

88
jobs:
99
build:
1010
name: Build and test
1111
strategy:
1212
matrix:
13-
os: [ ubuntu-latest, windows-latest, macos-latest ]
14-
node-version: [ 16, 18 ]
13+
os: [ubuntu-latest, windows-latest, macos-latest]
14+
node-version: [16, 18]
1515

1616
runs-on: ${{ matrix.os }}
1717

1818
steps:
19-
- uses: actions/checkout@v3
20-
- name: Use node.js ${{ matrix.node-version }}
21-
uses: actions/setup-node@v3
22-
with:
23-
node-version: ${{ matrix.node-version }}
24-
- run: npm ci
25-
26-
- name: For client directory
27-
run: |
28-
cd client
29-
npm run build --if-present
30-
npm test --if-present
31-
32-
- name: Install coreutils for macOS
33-
shell: bash
34-
if: runner.os == 'macOS'
35-
run: |
36-
brew install coreutils
37-
alias timeout=gtimeout
38-
39-
- name: For server directory
40-
shell: bash
41-
env:
42-
BACKEND_LOGIN_KEY: ${{ secrets.DOTENV_VAULT_BACKEND_CI_LOGIN_KEY }}
43-
run: |
44-
cd server
45-
npm run build --if-present
46-
npm test --if-present
47-
npx dotenv-vault login "$BACKEND_LOGIN_KEY" > /dev/null
48-
npx dotenv-vault pull ci .env
49-
timeout --verbose 10 npx ts-node index.ts || { if [ $? -eq 124 ]; then (exit 0); else (exit $?); fi }
19+
- uses: actions/checkout@v3
20+
- name: Use node.js ${{ matrix.node-version }}
21+
uses: actions/setup-node@v3
22+
with:
23+
node-version: ${{ matrix.node-version }}
24+
25+
- name: Cache dependencies
26+
id: cache
27+
uses: actions/cache@v3
28+
with:
29+
path: '**/node_modules'
30+
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
31+
32+
- name: Install Dependencies
33+
if: steps.cache.outputs.cache-hit != 'true'
34+
run: npm ci
35+
36+
- name: For client directory
37+
run: |
38+
cd client
39+
npm run build --if-present
40+
npm test --if-present
41+
42+
- name: Install coreutils for macOS
43+
shell: bash
44+
if: runner.os == 'macOS'
45+
run: |
46+
brew install coreutils
47+
alias timeout=gtimeout
48+
49+
- name: For server directory
50+
shell: bash
51+
env:
52+
BACKEND_LOGIN_KEY: ${{ secrets.DOTENV_VAULT_BACKEND_CI_LOGIN_KEY }}
53+
run: |
54+
cd server
55+
npm run build --if-present
56+
npm test --if-present
57+
npx dotenv-vault login "$BACKEND_LOGIN_KEY" > /dev/null
58+
npx dotenv-vault pull ci .env
59+
timeout --verbose 10 npx ts-node index.ts || { if [ $? -eq 124 ]; then (exit 0); else (exit $?); fi }

0 commit comments

Comments
 (0)