https://ldd6cr-adness.tistory.com/309
Github Actions๋ ๋ญ๊น
๋ชฉ์ฐจ1. Github Actions๋?2. ์์ฑ ์์3. ๊ตฌ์ฑ ์์ ์์ธํ ๋ณด๊ธฐ 3-1. Workflow 3-2. Event 3-3. Job 3-4. Runner 3-5. Step 3-6. Action1. Github Actions๋?Github์์ ์ ๊ณตํ๋ ๋น๋, ํ ์คํธ ๋ฐ ๋ฐฐํฌ ํ์ดํ๋ผ์ธ์ ์๋ํํ ์
ldd6cr-adness.tistory.com
๋ชฉ์ฐจ
1. ์ํฌํ๋ก์ฐ ํ์ผ ์์ฑ
2. ESLint ๋ฐ Prettier ํตํฉ
3. ๋น๋ ์ฑ๊ณตํ ๋ชจ์ต
1. ์ํฌํ๋ก์ฐ ํ์ผ ์์ฑ
๋ ํฌ์งํ ๋ฆฌ์ ๋ฃจํธ ๋๋ ํ ๋ฆฌ์ .github/workflows/ci.yml ํ์ผ์ ์์ฑํ๊ณ ๋ด์ฉ์ ์์ฑํ๋ค.
// ci.yml
name: CI
on:
push:
branches:
- main
pull_request:
branches:
- main
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Set up Node.js
uses: actions/setup-node@v3
with:
node-version: "18"
- name: Install dependencies
run: npm install
- name: Run tests
run: npm test -- --coverage
github ์ ์ฅ์์ ์ ๋ด์ฉ์ push ํ๋ฉด Actions ํญ์์ ์ํฌํ๋ก์ฐ ์คํ ์ํ๋ฅผ ํ์ธํ ์ ์๋ค.
ํ์ฌ ๋น๋๊ฐ ์คํจํ๋ ์ด์ ๋ ํ ์คํธ ์ฝ๋๊ฐ ์์ด์์ด๋ค.
์ด๋ ๊ฒ ์์ธํ ๋ด์ฉ์ ๋ณผ ์ ์๋๋ฐ, ์ค๊ฐ์ No tests found, exiting with code 1์ด๋ผ๋ ๋ฌธ๊ตฌ๋ฅผ ๋ณผ ์ ์๋ค.
์๋๋ผ๋ฉด ํ ์คํธ ํ์ผ์ ์์ฑํด์ฃผ๋ ๊ฒ์ด ๋ง์ง๋ง ๊ทธ๊ฑด ๋ค๋ฅธ ์ค์ต์ผ๋ก ์งํํด๋ณด๊ณ ์ฌ๊ธฐ์๋ ํ ์คํธ๋ฅผ ๊ฑด๋๋ฐ๋ ํค์๋๋ฅผ ๋ฃ์ด์ฃผ์
--passWithNoTests์ต์ ์ ํ ์คํธํ์ผ์ด ์กด์ฌํ์ง ์์ ๋ ํ ์คํธ๋ฅผ ๊ฑด๋๋ธ ์ ์๋ ์ต์ ์ด๋ค.
2. ESLint ๋ฐ Prettier ํตํฉ
์ฝ๋ ํ์ง ์ ์ง๋ฅผ ์ํด ESLint์ Prettier๋ ์ํฌํ๋ก์ฐ์ ํตํฉํด๋ณด์.
์ด๋ฐ ์์ผ๋ก ๋ช ์ค ์ถ๊ฐํด์ฃผ๋ฉด ๋๋ค.
๋ํ package.json์๋ ์คํฌ๋ฆฝํธ๋ฅผ ์ถ๊ฐํด์ค์ผํ๋ค.
์ด๊ฑธ ์ํ๋ฉด npm error Missing script: "lint"์ด๋ฐ ์๋ฌ๋ก ๋น๋๊ฐ ์๋๋ค.
3. ๋น๋ ์ฑ๊ณตํ ๋ชจ์ต
์ด๋ฐ์์ผ๋ก ๋ด๊ฐ pushํ ๋๋ง๋ค ์๋ ํ ์คํธ๊ฐ ์งํ๋ ๊ฑธ ํ์ธํ ์ ์๋ค
์ฐธ๊ณ
GitHub Actions๋ฅผ ํ์ฉํ CI/CD ํ์ดํ๋ผ์ธ ๊ตฌ์ถ
GitHub Actions๋ฅผ ํ์ฉํ CI/CD ํ์ดํ๋ผ์ธ ๊ตฌ์ถ
์ด ๋ธ๋ก๊ทธ ํฌ์คํธ๋ GitHub Actions๋ฅผ ํ์ฉํ CI/CD ํ์ดํ๋ผ์ธ ๊ตฌ์ถ ๋ฐฉ๋ฒ์ ๋ํด ๋ค๋ฃน๋๋ค. GitHub Actions์ ๊ธฐ๋ณธ ์ค์ ๋ถํฐ SonarQube์์ ํตํฉ, ๊ณ ๊ธ ์ค์ ๋ฐฉ๋ฒ๊น์ง ์์ธํ ์ค๋ช ํฉ๋๋ค.
f-lab.kr
'ํ๋ก ํธ์๋(Front-end) > Tools' ์นดํ ๊ณ ๋ฆฌ์ ๋ค๋ฅธ ๊ธ
Github Actions๋ ๋ญ๊น (1) | 2025.05.26 |
---|---|
axios ์ฌ์ฉํด๋ณด๊ธฐ (0) | 2025.05.26 |
axios๋ ๋ญ๊น (1) | 2025.05.22 |
Zustand ์ฌ์ฉํด๋ณด๊ธฐ (0) | 2025.05.15 |
TanStack Query ์ฌ์ฉํด๋ณด๊ธฐ (0) | 2025.05.14 |