์๊ฐ
์ด ๊ฐ์ด๋์์๋ Node.js ์ฝ๋๋ฅผ ๋น๋ํ๊ณ ํ ์คํธํ๋ CI(์ฐ์ ํตํฉ) ์ํฌํ๋ก๋ฅผ ๋ง๋๋ ๋ฐฉ๋ฒ์ ๋ณด์ฌ ์ค๋๋ค. CI ํ ์คํธ์ ํต๊ณผํ๋ฉด ์ฝ๋๋ฅผ ๋ฐฐํฌํ๊ฑฐ๋ ํจํค์ง๋ฅผ ๊ฒ์ํ ์ ์์ต๋๋ค.
ํ์ ์กฐ๊ฑด
Node.js, YAML, ์ํฌํ๋ก ๊ตฌ์ฑ ์ต์ ๊ณผ ์ํฌํ๋ก ํ์ผ์ ๋ง๋๋ ๋ฐฉ๋ฒ์ ๊ธฐ๋ณธ์ ์ผ๋ก ์ดํดํ๋ ๊ฒ์ด ์ข์ต๋๋ค. ์์ธํ ๋ด์ฉ์ ๋ค์์ ์ฐธ์กฐํ์ธ์.
Node.js ์ํฌํ๋ก ํ ํ๋ฆฟ ์ฌ์ฉ
๋น ๋ฅด๊ฒ ์์ํ๋ ค๋ฉด ์ํฌํ๋ก ํ
ํ๋ฆฟ์ ๋ฆฌํฌ์งํ ๋ฆฌ์ .github/workflows
๋๋ ํฐ๋ฆฌ์ ์ถ๊ฐํฉ๋๋ค.
GitHub๋ ๋๋ถ๋ถ์ Node.js ๊ธฐ๋ฐ Java ํ๋ก์ ํธ์์ ์๋ํ๋ Node.js ์ํฌํ๋ก ํ ํ๋ฆฟ์ ์ ๊ณตํฉ๋๋ค. ์ด ๊ฐ์ด๋์ ํ์ ์น์ ์์๋ ์ด ์ํฌํ๋ก ํ ํ๋ฆฟ์ ์ฌ์ฉ์ ์ง์ ํ๋ ๋ฐฉ๋ฒ์ ๋ํ ์์๋ฅผ ์ ๊ณตํฉ๋๋ค.
-
GitHub์์ ๋ฆฌํฌ์งํ ๋ฆฌ์ ๊ธฐ๋ณธ ํ์ด์ง๋ก ์ด๋ํฉ๋๋ค.
-
๋ฆฌํฌ์งํ ๋ฆฌ ์ด๋ฆ ์๋์์ ์์ ์ ํด๋ฆญํฉ๋๋ค.
-
๋ฆฌํฌ์งํ ๋ฆฌ์ ์ํฌํ๋ก๊ฐ ์ด๋ฏธ ์๋ ๊ฒฝ์ฐ ์ ์ํฌํ๋ก๋ฅผ ํด๋ฆญํฉ๋๋ค.
-
"์ํฌํ๋ก ์ ํ" ํ์ด์ง์๋ ๊ถ์ฅ๋๋ ์ํฌํ๋ก ํ ํ๋ฆฟ์ ์ ํ ํญ๋ชฉ์ด ํ์๋ฉ๋๋ค. "Node.js"๋ฅผ ๊ฒ์ํฉ๋๋ค.
-
์ง์์ ํตํฉ์ ํด๋ฆญํ์ฌ ์ํฌํ๋ก ์ ํ์ ํํฐ๋งํฉ๋๋ค.
-
"Node.js" ์ํฌํ๋ก์์ ๊ตฌ์ฑ์ ํด๋ฆญํฉ๋๋ค.
-
ํ์์ ๋ฐ๋ผ ์ํฌํ๋ก๋ฅผ ํธ์งํฉ๋๋ค. ์๋ฅผ ๋ค์ด ์ฌ์ฉํ๋ ค๋ ๋ ธ๋ ๋ฒ์ ์ ๋ณ๊ฒฝํฉ๋๋ค.
-
๋ณ๊ฒฝ ๋ด์ฉ ์ปค๋ฐ์ ํด๋ฆญํฉ๋๋ค.
node.js.yml
์ํฌํ๋ก ํ์ผ์ด ๋ฆฌํฌ์งํ ๋ฆฌ์ .github/workflows
๋๋ ํฐ๋ฆฌ์ ์ถ๊ฐ๋ฉ๋๋ค.
Node.js ๋ฒ์ ์ง์
Node.js ๋ฒ์ ์ ์ง์ ํ๋ ๊ฐ์ฅ ์ฌ์ด ๋ฐฉ๋ฒ์ GitHub์์ ์ ๊ณตํ๋ setup-node
์์
์ ์ฌ์ฉํ๋ ๊ฒ์
๋๋ค. ์์ธํ ๋ด์ฉ์ setup-node
๋ฅผ ์ฐธ์กฐํ์ธ์.
์ด setup-node
์์
์ Node.js ๋ฒ์ ์ ์
๋ ฅ์ผ๋ก ์ฌ์ฉํ๊ณ ์คํ๊ธฐ์์ ํด๋น ๋ฒ์ ์ ๊ตฌ์ฑํฉ๋๋ค. setup-node
์์
์ ๊ฐ ์คํ๊ธฐ์ ๋๊ตฌ ์บ์์์ Node.js์ ํน์ ๋ฒ์ ์ ์ฐพ์ ํ์ ์ด์ง ํ์ผ์ PATH
์ ์ถ๊ฐํฉ๋๋ค. ์ด ์ด์ง ํ์ผ์ ๋๋จธ์ง ์์
๋์ ์ ์ง๋ฉ๋๋ค. setup-node
์์
์ ์ฌ์ฉํ๋ ๊ฒ์ ๋ค์ํ ์คํ๊ธฐ ๋ฐ Node.js ๋ฒ์ ๊ฐ์ ์ผ๊ด๋ ๋์์ ๋ณด์ฅํ๋ฏ๋ก GitHub Actions๋ก Node.js๋ฅผ ์ฌ์ฉํ๋ ๋ฐ ๊ถ์ฅ๋๋ ๋ฐฉ๋ฒ์
๋๋ค. ์์ฒด ํธ์คํธ ์คํ๊ธฐ๋ฅผ ์ฌ์ฉํ๋ ๊ฒฝ์ฐ Node.js๋ฅผ ์ค์นํ๊ณ ์ด๋ฅผ PATH
์ ์ถ๊ฐํด์ผ ํฉ๋๋ค.
์ํฌํ๋ก ํ
ํ๋ฆฟ์๋ node-version
์ ๋์ด๋ Node.js ๋ฒ์ ์ผ๋ก ์ฝ๋๋ฅผ ๋น๋ํ๊ณ ํ
์คํธํ๋ ํ๋ ฌํ ์ ๋ต์ด ํฌํจ๋์ด ์์ต๋๋ค. โxโ๋ ๋ฒ์ ์ ์ฌ์ฉํ ์ ์๋ ์ต์ ๋ถ ๋ฒ์ ๋ฐ ํจ์น ๋ฆด๋ฆฌ์ค์ ์ผ์นํ๋ ์์ผ๋์นด๋ ๋ฌธ์์
๋๋ค. node-version
๋ฐฐ์ด์ ์ง์ ๋ Node.js์ ๊ฐ ๋ฒ์ ์ ๋์ผํ ๋จ๊ณ๋ฅผ ์คํํ๋ ์์
์ ๋ง๋ญ๋๋ค.
๊ฐ ์์
์ matrix
์ปจํ
์คํธ๋ฅผ ์ฌ์ฉํ์ฌ ๋งคํธ๋ฆญ์ค node-version
๋ฐฐ์ด์ ์ ์๋ ๊ฐ์ ์ก์ธ์คํ ์ ์์ต๋๋ค. setup-node
์์
์ ์ปจํ
์คํธ๋ฅผ node-version
์
๋ ฅ์ผ๋ก ์ฌ์ฉํฉ๋๋ค. setup-node
์์
์ ์ฝ๋๋ฅผ ๋น๋ํ๊ณ ํ
์คํธํ๊ธฐ ์ ์ ๋ค๋ฅธ Node.js ๋ฒ์ ์ผ๋ก ๊ฐ ์์
์ ๊ตฌ์ฑํฉ๋๋ค. ํ๋ ฌ ์ ๋ต ๋ฐ ์ปจํ
์คํธ์ ๋ํ ์์ธํ ๋ด์ฉ์ GitHub Actions์ ๋ํ ์ํฌํ๋ก ๊ตฌ๋ฌธ ๋ฐ ์ปจํ
์คํธ ์ฐธ์กฐ์(๋ฅผ) ์ฐธ์กฐํ์ธ์.
strategy: matrix: node-version: ['18.x', '20.x'] steps: - uses: actions/checkout@v4 - name: Use Node.js ${{ matrix.node-version }} uses: actions/setup-node@v4 with: node-version: ${{ matrix.node-version }}
strategy:
matrix:
node-version: ['18.x', '20.x']
steps:
- uses: actions/checkout@v4
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
๋๋ ์ ํํ Node.js ๋ฒ์ ์ผ๋ก ๋น๋ํ๊ณ ํ ์คํธํ ์ ์์ต๋๋ค.
strategy: matrix: node-version: ['10.17.0', '17.9.0']
strategy:
matrix:
node-version: ['10.17.0', '17.9.0']
๋จ์ผ ๋ฒ์ ์ Node.js๋ฅผ ์ฌ์ฉํ์ฌ ๋น๋ํ๊ณ ํ ์คํธํ ์๋ ์์ต๋๋ค.
name: Node.js CI on: [push] jobs: build: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - name: Use Node.js uses: actions/setup-node@v4 with: node-version: '20.x' - run: npm ci - run: npm run build --if-present - run: npm test
name: Node.js CI
on: [push]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Use Node.js
uses: actions/setup-node@v4
with:
node-version: '20.x'
- run: npm ci
- run: npm run build --if-present
- run: npm test
Node.js ๋ฒ์ ์ ์ง์ ํ์ง ์์ผ๋ฉด GitHub์์ ํ๊ฒฝ์ ๊ธฐ๋ณธ Node.js ๋ฒ์ ์ ์ฌ์ฉํฉ๋๋ค. ์์ธํ ๋ด์ฉ์ GitHub ํธ์คํ ์คํ๊ธฐ์(๋ฅผ) ์ฐธ์กฐํ์ธ์.
์ข ์์ฑ ์ค์น
GitHub ํธ์คํธ ์คํ๊ธฐ์๋ npm ๋ฐ Yarn ์ข ์์ฑ ๊ด๋ฆฌ์๊ฐ ์ค์น๋์ด ์์ต๋๋ค. ์ฝ๋๋ฅผ ๋น๋ํ๊ณ ํ ์คํธํ๊ธฐ ์ ์ npm ๋ฐ Yarn์ ์ฌ์ฉํ์ฌ ์ํฌํ๋ก์ ์ข ์์ฑ์ ์ค์นํ ์ ์์ต๋๋ค. Windows ๋ฐ Linux GitHubํธ์คํธ ์คํ๊ธฐ์๋ Grunt, Gulp, Bower๊ฐ ์ค์น๋์ด ์์ต๋๋ค.
์ข ์์ฑ์ ์บ์ํ์ฌ ์ํฌํ๋ก ์๋๋ฅผ ๋์ผ ์๋ ์์ต๋๋ค. ์์ธํ ๋ด์ฉ์ ์ข ์์ฑ ์บ์ฑ ์ฐธ์กฐ์(๋ฅผ) ์ฐธ์กฐํ์ธ์.
npm์ ์ฌ์ฉํ ์์
์ด ์์์์๋ package-lock.json
๋๋ npm-shrinkwrap.json
ํ์ผ์ ๋ฒ์ ์ ์ค์นํ๊ณ ์ ๊ธ ํ์ผ์ด ์
๋ฐ์ดํธ๋ฅผ ๋ฐฉ์งํฉ๋๋ค. ์ผ๋ฐ์ ์ผ๋ก npm ci
๋ฅผ ์ฌ์ฉํ๋ ๊ฒ์ด npm install
์ ์คํํ๋ ๊ฒ๋ณด๋ค ๋น ๋ฆ
๋๋ค. ์์ธํ ๋ด์ฉ์ npm ci
๋ฐ ๋ ๋น ๋ฅด๊ณ ์์ ์ ์ธ ๋น๋๋ฅผ ์ํ npm ci
์๊ฐ๋ฅผ ์ฐธ์กฐํ์ธ์.
steps: - uses: actions/checkout@v4 - name: Use Node.js uses: actions/setup-node@v4 with: node-version: '20.x' - name: Install dependencies run: npm ci
steps:
- uses: actions/checkout@v4
- name: Use Node.js
uses: actions/setup-node@v4
with:
node-version: '20.x'
- name: Install dependencies
run: npm ci
npm install
์ ์ฌ์ฉํ๋ฉด package.json
ํ์ผ์ ์ ์๋ ์ข
์์ฑ์ด ์ค์น๋ฉ๋๋ค. ์์ธํ ๋ด์ฉ์ npm install
๋ฅผ ์ฐธ์กฐํ์ธ์.
steps: - uses: actions/checkout@v4 - name: Use Node.js uses: actions/setup-node@v4 with: node-version: '20.x' - name: Install dependencies run: npm install
steps:
- uses: actions/checkout@v4
- name: Use Node.js
uses: actions/setup-node@v4
with:
node-version: '20.x'
- name: Install dependencies
run: npm install
Yarn์ ์ฌ์ฉํ ์์
์ด ์์์์๋ yarn.lock
ํ์ผ์ ์ ์๋ ์ข
์์ฑ์ ์ค์นํ๊ณ yarn.lock
ํ์ผ ์
๋ฐ์ดํธ๋ฅผ ๋ฐฉ์งํฉ๋๋ค. ์์ธํ ๋ด์ฉ์ yarn install
๋ฅผ ์ฐธ์กฐํ์ธ์.
steps: - uses: actions/checkout@v4 - name: Use Node.js uses: actions/setup-node@v4 with: node-version: '20.x' - name: Install dependencies run: yarn --frozen-lockfile
steps:
- uses: actions/checkout@v4
- name: Use Node.js
uses: actions/setup-node@v4
with:
node-version: '20.x'
- name: Install dependencies
run: yarn --frozen-lockfile
๋๋ package.json
ํ์ผ์ ์ ์๋ ์ข
์์ฑ์ ์ค์นํ ์ ์์ต๋๋ค.
steps: - uses: actions/checkout@v4 - name: Use Node.js uses: actions/setup-node@v4 with: node-version: '20.x' - name: Install dependencies run: yarn
steps:
- uses: actions/checkout@v4
- name: Use Node.js
uses: actions/setup-node@v4
with:
node-version: '20.x'
- name: Install dependencies
run: yarn
ํ๋ผ์ด๋น ๋ ์ง์คํธ๋ฆฌ๋ฅผ ์ฌ์ฉํ๊ณ .npmrc ํ์ผ์ ๋ง๋๋ ์์
setup-node
์์
์ ์ฌ์ฉํ์ฌ ๊ธฐ๋ณธ ๋ ์ง์คํธ๋ฆฌ ๋ฐ ๋ฒ์๋ฅผ ๊ตฌ์ฑํ๋ ์คํ๊ธฐ์์ ๋ก์ปฌ .npmrc
ํ์ผ์ ๋ง๋ค ์ ์์ต๋๋ค. ๋ํ setup-node
์์
์ ํ๋ผ์ด๋น ๋ ์ง์คํธ๋ฆฌ์ ์ก์ธ์คํ๊ฑฐ๋ ๋
ธ๋ ํจํค์ง๋ฅผ ๊ฒ์ํ๋ ๋ฐ ์ฌ์ฉ๋๋ ์
๋ ฅ์ผ๋ก ์ธ์ฆ ํ ํฐ์ ํ์ฉํฉ๋๋ค. ์์ธํ ๋ด์ฉ์ setup-node
๋ฅผ ์ฐธ์กฐํ์ธ์.
ํ๋ผ์ด๋น ๋ ์ง์คํธ๋ฆฌ์ ์ธ์ฆํ๋ ค๋ฉด npm ์ธ์ฆ ํ ํฐ์ ๋น๋ฐ๋ก ์ ์ฅํด์ผ ํฉ๋๋ค. ์๋ฅผ ๋ค์ด NPM_TOKEN
์ด๋ผ๋ ๋ ์ง์คํธ๋ฆฌ ๋น๋ฐ์ ๋ง๋ญ๋๋ค. ์์ธํ ๋ด์ฉ์ GitHub Actions์์ ๋น๋ฐ ์ฌ์ฉ์(๋ฅผ) ์ฐธ์กฐํ์ธ์.
์๋ ์์์์ ๋น๋ฐ NPM_TOKEN
์ npm ์ธ์ฆ ํ ํฐ์ ์ ์ฅํฉ๋๋ค. setup-node
์์
์ NODE_AUTH_TOKEN
ํ๊ฒฝ ๋ณ์์์ npm ์ธ์ฆ ํ ํฐ์ ์ฝ๋๋ก .npmrc
ํ์ผ์ ๊ตฌ์ฑํฉ๋๋ค. setup-node
์์
์ ์ฌ์ฉํ์ฌ .npmrc
ํ์ผ์ ๋ง๋ค ๋ npm ์ธ์ฆ ํ ํฐ์ด ํฌํจ๋ ๋น๋ฐ๋ก NODE_AUTH_TOKEN
ํ๊ฒฝ ๋ณ์๋ฅผ ์ค์ ํด์ผ ํฉ๋๋ค.
์ข
์์ฑ์ ์ค์นํ๊ธฐ ์ ์ setup-node
์์
์ ์ฌ์ฉํ์ฌ .npmrc
ํ์ผ์ ๋ง๋ญ๋๋ค. ์์
์๋ ๋ ๊ฐ์ ์
๋ ฅ ๋งค๊ฐ ๋ณ์๊ฐ ์์ต๋๋ค. node-version
๋งค๊ฐ ๋ณ์๋ Node.js ๋ฒ์ ์ ์ค์ ํ๊ณ registry-url
๋งค๊ฐ ๋ณ์๋ ๊ธฐ๋ณธ ๋ ์ง์คํธ๋ฆฌ๋ฅผ ์ค์ ํฉ๋๋ค. ํจํค์ง ๋ ์ง์คํธ๋ฆฌ์์ ๋ฒ์๋ฅผ ์ฌ์ฉํ๋ ๊ฒฝ์ฐ scope
๋งค๊ฐ ๋ณ์๋ฅผ ์ฌ์ฉํด์ผ ํฉ๋๋ค. ์์ธํ ๋ด์ฉ์ npm-scope
๋ฅผ ์ฐธ์กฐํ์ธ์.
steps: - uses: actions/checkout@v4 - name: Use Node.js uses: actions/setup-node@v4 with: always-auth: true node-version: '20.x' registry-url: https://registry.npmjs.org scope: '@octocat' - name: Install dependencies run: npm ci env: NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
steps:
- uses: actions/checkout@v4
- name: Use Node.js
uses: actions/setup-node@v4
with:
always-auth: true
node-version: '20.x'
registry-url: https://registry.npmjs.org
scope: '@octocat'
- name: Install dependencies
run: npm ci
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
์์ ์์ ์์๋ ๋ค์ ์ฝํ
์ธ ๊ฐ ํฌํจ๋ .npmrc
ํ์ผ์ ๋ง๋ญ๋๋ค.
//registry.npmjs.org/:_authToken=${NODE_AUTH_TOKEN}
@octocat:registry=https://registry.npmjs.org/
always-auth=true
์ข ์์ฑ ์บ์ฑ ์์
setup-node
์์
์ ์ฌ์ฉํ์ฌ ์ข
์์ฑ์ ์บ์ํ๊ณ ๋ณต์ํ ์ ์์ต๋๋ค.
๋ค์ ์์์์๋ npm์ ๋ํ ์ข ์์ฑ์ ์บ์ํฉ๋๋ค.
steps: - uses: actions/checkout@v4 - uses: actions/setup-node@v4 with: node-version: '20' cache: 'npm' - run: npm install - run: npm test
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: '20'
cache: 'npm'
- run: npm install
- run: npm test
๋ค์ ์์์์๋ Yarn์ ๋ํ ์ข ์์ฑ์ ์บ์ํฉ๋๋ค.
steps: - uses: actions/checkout@v4 - uses: actions/setup-node@v4 with: node-version: '20' cache: 'yarn' - run: yarn - run: yarn test
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: '20'
cache: 'yarn'
- run: yarn
- run: yarn test
๋ค์ ์์์์๋ pnpm(v6.10 ์ด์)์ ๋ํ ์ข ์์ฑ์ ์บ์ํฉ๋๋ค.
# ์ด ์ํฌํ๋ก๋ GitHub์์ ์ธ์ฆ๋์ง ์์ ์์ ์ ์ฌ์ฉํฉ๋๋ค. # ์์ ์ ํ์ฌ์์ ์ ๊ณตํ๋ฉฐ # ๋ณ๋์ ์๋น์ค ์ฝ๊ด, ๊ฐ์ธ์ ๋ณด์ฒ๋ฆฌ๋ฐฉ์นจ, ์ง์ ์ค๋ช ์์์ ๊ท์ ๋ฉ๋๋ค. # ์ฐธ์กฐํ์ธ์. # NOTE: pnpm caching support requires pnpm version >= 6.10.0 steps: - uses: actions/checkout@v4 - uses: pnpm/action-setup@0609f0983b7a228f052f81ef4c3d6510cae254ad with: version: 6.10.0 - uses: actions/setup-node@v4 with: node-version: '20' cache: 'pnpm' - run: pnpm install - run: pnpm test
# ์ด ์ํฌํ๋ก๋ GitHub์์ ์ธ์ฆ๋์ง ์์ ์์
์ ์ฌ์ฉํฉ๋๋ค.
# ์์
์ ํ์ฌ์์ ์ ๊ณตํ๋ฉฐ
# ๋ณ๋์ ์๋น์ค ์ฝ๊ด, ๊ฐ์ธ์ ๋ณด์ฒ๋ฆฌ๋ฐฉ์นจ, ์ง์ ์ค๋ช
์์์ ๊ท์ ๋ฉ๋๋ค.
# ์ฐธ์กฐํ์ธ์.
# NOTE: pnpm caching support requires pnpm version >= 6.10.0
steps:
- uses: actions/checkout@v4
- uses: pnpm/action-setup@0609f0983b7a228f052f81ef4c3d6510cae254ad
with:
version: 6.10.0
- uses: actions/setup-node@v4
with:
node-version: '20'
cache: 'pnpm'
- run: pnpm install
- run: pnpm test
์ฌ์ฉ์ ์ง์ ์๊ตฌ์ฌํญ์ด ์๊ฑฐ๋ ์บ์ฑ์ ๋ํ ์ธ๋ถ์ ์ธ ์ ์ด๊ฐ ํ์ํ ๊ฒฝ์ฐ cache
์์
์ ์ฌ์ฉํ ์ ์์ต๋๋ค. ์์ธํ ๋ด์ฉ์ ์ข
์์ฑ ์บ์ฑ ์ฐธ์กฐ์(๋ฅผ) ์ฐธ์กฐํ์ธ์.
์ฝ๋ ๋น๋ ๋ฐ ํ ์คํธ
์ฝ๋๋ฅผ ๋น๋ํ๊ณ ํ
์คํธํ๊ธฐ ์ํด ๋ก์ปฌ์์ ์ฌ์ฉํ๋ ๊ฒ๊ณผ ๋์ผํ ๋ช
๋ น์ ์ฌ์ฉํ ์ ์์ต๋๋ค. ์๋ฅผ ๋ค์ด npm run build
๋ฅผ ์คํํ์ฌ package.json
ํ์ผ์ ์ ์๋ ๋น๋ ๋จ๊ณ๋ฅผ ์คํํ๊ณ npm test
๋ฅผ ์คํํ์ฌ ํ
์คํธ ๋ชจ์์ ์คํํ๋ ๊ฒฝ์ฐ ์ํฌํ๋ก ํ์ผ์ ํด๋น ๋ช
๋ น์ ์ถ๊ฐํฉ๋๋ค.
steps: - uses: actions/checkout@v4 - name: Use Node.js uses: actions/setup-node@v4 with: node-version: '20.x' - run: npm install - run: npm run build --if-present - run: npm test
steps:
- uses: actions/checkout@v4
- name: Use Node.js
uses: actions/setup-node@v4
with:
node-version: '20.x'
- run: npm install
- run: npm run build --if-present
- run: npm test
์ํฌํ๋ก ๋ฐ์ดํฐ๋ฅผ ์ํฐํฉํธ๋ก ํจํค์ง
๋น๋ ๋ฐ ํ ์คํธ ๋จ๊ณ์์ ์ํฐํฉํธ๋ฅผ ์ ์ฅํ์ฌ ์์ ์ด ์๋ฃ๋ ํ ๋ณผ ์ ์์ต๋๋ค. ์๋ฅผ ๋ค์ด ๋ก๊ทธ ํ์ผ, ์ฝ์ด ๋คํ, ํ ์คํธ ๊ฒฐ๊ณผ ๋๋ ์คํฌ๋ฆฐ์ท์ ์ ์ฅํด์ผ ํ ์ ์์ต๋๋ค. ์์ธํ ๋ด์ฉ์ ์ํฌํ๋ก ์ํฐํฉํธ์ ๋ฐ์ดํฐ ์ ์ฅ ๋ฐ ๊ณต์ ์(๋ฅผ) ์ฐธ์กฐํ์ธ์.
ํจํค์ง ๋ ์ง์คํธ๋ฆฌ์ ๊ฒ์
CI ํ ์คํธ์ ํต๊ณผํ๋ฉด Node.js ํจํค์ง๋ฅผ ํจํค์ง ๋ ์ง์คํธ๋ฆฌ์ ๊ฒ์ํ๋๋ก ์ํฌํ๋ก๋ฅผ ๊ตฌ์ฑํ ์ ์์ต๋๋ค. npm ๋ฐ GitHub Packages์ ๊ฒ์ํ๋ ๋ฐฉ๋ฒ์ ๋ํ ์์ธํ ๋ด์ฉ์ Node.js ํจํค์ง ๊ฒ์์(๋ฅผ) ์ฐธ์กฐํ์ธ์.