
공식문서 : https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#onworkflow_runbranchesbranches-ignore
name: ci-backend
// 워크플로우를 트리거할 수 있는 이벤트 정의
on:
pull_request:
branches: ["main", "develop"] // 특정 브랜치에 pull_request를 보냈을 때
paths: // 특정 디렉토리가 변경되었을 때
- "backend/**"
// 워크플로우가 트리거되면 실행할 작업 (각 job을 병렬로 실행)
jobs:
check-backend: // job
name: check-backend
runs-on: ubuntu-latest // 해당 job을 실행할 러너 환경(서버 인스턴스)
defaults: // 해당 job의 모든 steps에 적용되는 기본 설정
run:
working-directory: backend // 작업 디렉토리 설정
steps: // 해당 job에서 실행되는 일련의 태스크
- name: checkout
uses: actions/checkout@v3 // 재사용 가능한 외부 액션을 가져와 실행한다.
- name: install dependencies
run: npm ci // 러너 쉘로 명령 실행
- name: lint test
run: npm run lint
- name: unit test
run: npm run test
- name: build
run: npm run build
backend 폴더에 변화가 있을 때 트리거되는 workflow (GitHub Actions에서 확인 가능)

on 언제?
pull_request
branches main/develop 브랜치에 PR을 보냈을 때 &&paths [frontend/backend] 폴더에 변화가 있을 때jobs 무엇을?
checkout 코드(레포) 내려받기
uses: actions/checkout@v3 (public action - {owner}/{repo}@{ref})install dependencies 패키지 설치
lint test 린트 테스트 (eslint)
unit test 유닛 테스트 (jest)
build 빌드 (컴파일 에러 - typescript 등)