클러스터 알고리즘 테스트, api 경로 수정 #383
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 }} |