-
Notifications
You must be signed in to change notification settings - Fork 2
65 lines (54 loc) · 1.8 KB
/
CI_PIPELINE.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
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 }}