Skip to content

리드미에 핵심 경험 요약 추가 #390

리드미에 핵심 경험 요약 추가

리드미에 핵심 경험 요약 추가 #390

Workflow file for this run

name: CI Pipeline
on:
pull_request:
types: [ opened, reopened, synchronize ]
branches:
- develop
- main
jobs:
build:
name: Lint, Build and Test
runs-on: ubuntu-latest
strategy:
matrix:
project: [ frontend, backend ]
steps:
- name: Checkout Repository
uses: actions/checkout@v3
with:
fetch-depth: 2
- name: Fetch base branch
run: |
echo "BASE_BRANCH=${{ github.event.pull_request.base.ref }}" >> $GITHUB_ENV
git fetch origin $BASE_BRANCH --depth=1
- name: Check for changes in ${{ matrix.project }}
id: changes
run: |
if git diff --name-only origin/$BASE_BRANCH HEAD | grep -q "^${{ matrix.project }}/"; then
echo "changed=true" >> $GITHUB_ENV
else
echo "changed=false" >> $GITHUB_ENV
fi
- name: Set up Node.js
if: env.changed == 'true'
uses: actions/setup-node@v3
with:
node-version: '20'
- name: Install Dependencies for ${{ matrix.project }}
if: env.changed == 'true'
run: yarn install --frozen-lockfile # yarn.lock 을 기준으로 설치하며, 의존성 재해석 방지
working-directory: ${{ matrix.project }}
- name: Lint ${{ matrix.project }}
if: env.changed == 'true'
run: yarn format-check
working-directory: ${{ matrix.project }}
- name: Build ${{ matrix.project }}
if: env.changed == 'true'
run: yarn build
working-directory: ${{ matrix.project }}
- name: Test ${{ matrix.project }}
if: env.changed == 'true'
run: |
echo "${{ secrets.DOT_ENV_PROD }}" > ${{ github.workspace }}/backend/.env
yarn test
working-directory: ${{ matrix.project }}