장소에 색상 추가 #100
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: Cache dependencies for ${{ matrix.project }} | |
if: env.changed == 'true' | |
uses: actions/cache@v3 | |
with: | |
path: ${{ matrix.project }}/node_modules | |
key: ${{ runner.os }}-yarn-${{ hashFiles(format('{0}/yarn.lock', matrix.project)) }} | |
restore-keys: | | |
${{ runner.os }}-yarn- | |
- name: Install Dependencies for ${{ matrix.project }} | |
if: env.changed == 'true' | |
run: yarn install | |
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: yarn test | |
working-directory: ${{ matrix.project }} |