Skip to content

Commit

Permalink
merge-fe: cruru version 1.1 코드 병합 (v24.09.27) (#740)
Browse files Browse the repository at this point in the history
Co-authored-by: Jeongwoo Park <[email protected]>
Co-authored-by: Do Yeop Kim <[email protected]>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: KIM DAEUN <[email protected]>
  • Loading branch information
5 people committed Sep 27, 2024
1 parent 8fa579f commit db0712e
Show file tree
Hide file tree
Showing 348 changed files with 40,329 additions and 0 deletions.
122 changes: 122 additions & 0 deletions .github/workflows/fe-ci-cd-dev.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,122 @@
name: FE/CI-CD - Development 테스트, 빌드 및 배포

on:
push:
branches:
- fe/develop

env:
lurgi: "U07BJB1M53K"
U07BJB1M53K: "FE팀 러기"
llqqssttyy: "U07AZ2992CW"
U07AZ2992CW: "FE팀 렛서"
seongjinme: "U07B9HQDF4M"
U07B9HQDF4M: "FE팀 아르"
Dobby-Kim: "U07BJABU6G1"
U07BJABU6G1: "BE팀 도비"
Chocochip101: "U07BUEJDS8G"
U07BUEJDS8G: "BE팀 초코칩"
xogns1514: "U07AZ26UC2J"
U07AZ26UC2J: "BE팀 러쉬"
cutehumanS2: "U07B88ZQDU4"
U07B88ZQDU4: "BE팀 냥인"
HyungHoKim00: "U07B5HBKZM1"
U07B5HBKZM1: "BE팀 명오"

jobs:
test-build:
runs-on: ubuntu-22.04
environment: dev
defaults:
run:
working-directory: ./frontend
concurrency:
group: ${{ github.workflow }}
cancel-in-progress: true
env:
API_URL: ${{ secrets.API_URL }}
DOMAIN_URL: ${{ secrets.DOMAIN_URL }}
API_VERSION: ${{ secrets.API_VERSION }}
GA_MEASUREMENT_ID: ${{ secrets.GA_MEASUREMENT_ID }}
SENTRY_DSN: ${{ secrets.SENTRY_DSN }}
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }}
ROBOTS_TXT_PATH: ${{ secrets.ROBOTS_TXT_PATH }}

steps:
- name: 저장소 checkout
uses: actions/checkout@v4
with:
# chromatic에서는 fetch-depth를 0으로 설정하지 않으면 에러가 발생
fetch-depth: 0

- name: Node.js 셋업
uses: actions/setup-node@v4
with:
node-version: 20.x

- uses: actions/cache@v4
id: npm-cache
with:
path: |
frontend/node_modules
~/.npm
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}

- name: 애플리케이션 의존성 항목들 설치
if: steps.npm-cache.outputs.cache-hit != 'true'
run: npm ci

- name: 코드 문법 테스트
run: npm run lint

- name: 애플리케이션 기능 테스트
run: npm run test -- --passWithNoTests

- name: Storybook 빌드 테스트
run: npm run build-storybook

- name: 애플리케이션 빌드
run: npm run build

- name: 빌드된 파일을 artifact로 업로드
uses: actions/upload-artifact@v4
with:
name: fe-dev-dist
path: frontend/dist

- name: 컴포넌트 Storybook을 Chromatic으로 배포
uses: chromaui/action@latest
with:
projectToken: ${{ secrets.CHROMATIC_PROJECT_TOKEN }}
workingDir: frontend

deploy:
needs: test-build
runs-on: [self-hosted, linux, cruru-fe]
environment: dev

steps:
- name: 작업 디렉터리 생성 및 이동
run: |
mkdir -p ~/actions-runner/deploy/dev
cd ~/actions-runner/deploy/dev
- name: 기존 빌드 파일들 삭제
run: |
cd ~/actions-runner/deploy/dev
rm -rf dist
- name: 새 빌드 파일을 runner instance에 다운로드
uses: actions/download-artifact@v4
with:
name: fe-dev-dist
path: ~/actions-runner/deploy/dev/dist

- name: 다운로드 된 빌드 파일을 S3에 배포
run: |
cd ~/actions-runner/deploy/dev
aws s3 sync dist ${{ secrets.FE_DEPLOY_S3_URI }} --delete
- name: CloudFront 캐시 무효화
run: |
aws cloudfront create-invalidation --distribution-id ${{ secrets.FE_CLOUDFRONT_ID }} --paths "/*"
116 changes: 116 additions & 0 deletions .github/workflows/fe-ci-cd-prod.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,116 @@
name: FE/CI-CD - Production 테스트, 빌드 및 배포

on:
push:
branches:
- fe/main

env:
lurgi: "U07BJB1M53K"
U07BJB1M53K: "FE팀 러기"
llqqssttyy: "U07AZ2992CW"
U07AZ2992CW: "FE팀 렛서"
seongjinme: "U07B9HQDF4M"
U07B9HQDF4M: "FE팀 아르"
Dobby-Kim: "U07BJABU6G1"
U07BJABU6G1: "BE팀 도비"
Chocochip101: "U07BUEJDS8G"
U07BUEJDS8G: "BE팀 초코칩"
xogns1514: "U07AZ26UC2J"
U07AZ26UC2J: "BE팀 러쉬"
cutehumanS2: "U07B88ZQDU4"
U07B88ZQDU4: "BE팀 냥인"
HyungHoKim00: "U07B5HBKZM1"
U07B5HBKZM1: "BE팀 명오"

jobs:
test-build:
runs-on: ubuntu-22.04
environment: prod
defaults:
run:
working-directory: ./frontend
concurrency:
group: ${{ github.workflow }}
cancel-in-progress: true
env:
API_URL: ${{ secrets.API_URL }}
DOMAIN_URL: ${{ secrets.DOMAIN_URL }}
API_VERSION: ${{ secrets.API_VERSION }}
GA_MEASUREMENT_ID: ${{ secrets.GA_MEASUREMENT_ID }}
SENTRY_DSN: ${{ secrets.SENTRY_DSN }}
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }}
ROBOTS_TXT_PATH: ${{ secrets.ROBOTS_TXT_PATH }}

steps:
- name: 저장소 checkout
uses: actions/checkout@v4
with:
# chromatic에서는 fetch-depth를 0으로 설정하지 않으면 에러가 발생
fetch-depth: 0

- name: Node.js 셋업
uses: actions/setup-node@v4
with:
node-version: 20.x

- uses: actions/cache@v4
id: npm-cache
with:
path: |
frontend/node_modules
~/.npm
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}

- name: 애플리케이션 의존성 항목들 설치
if: steps.npm-cache.outputs.cache-hit != 'true'
run: npm ci

- name: 코드 문법 테스트
run: npm run lint

- name: 애플리케이션 기능 테스트
run: npm run test -- --passWithNoTests

- name: Storybook 빌드 테스트
run: npm run build-storybook

- name: 애플리케이션 빌드
run: npm run build

- name: 빌드된 파일을 artifact로 업로드
uses: actions/upload-artifact@v4
with:
name: fe-prod-dist
path: frontend/dist

deploy:
needs: test-build
runs-on: [self-hosted, linux, cruru-fe]
environment: prod

steps:
- name: 작업 디렉터리 생성 및 이동
run: |
mkdir -p ~/actions-runner/deploy/prod
cd ~/actions-runner/deploy/prod
- name: 기존 빌드 파일들 삭제
run: |
cd ~/actions-runner/deploy/prod
rm -rf dist
- name: 새 빌드 파일을 runner instance에 다운로드
uses: actions/download-artifact@v4
with:
name: fe-prod-dist
path: ~/actions-runner/deploy/prod/dist

- name: 다운로드 된 빌드 파일을 S3에 배포
run: |
cd ~/actions-runner/deploy/prod
aws s3 sync dist ${{ secrets.FE_DEPLOY_S3_URI }} --delete
- name: CloudFront 캐시 무효화
run: |
aws cloudfront create-invalidation --distribution-id ${{ secrets.FE_CLOUDFRONT_ID }} --paths "/*"
82 changes: 82 additions & 0 deletions .github/workflows/fe-ci-pr-review-message.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
name: FE/CI - PR 리뷰 준비 메시지 전송

on:
pull_request:
types: [opened, ready_for_review]
branches:
- fe/develop

jobs:
pr-ready:
runs-on: ubuntu-latest
steps:
- name: Set reviewer and sender variables
id: set-vars
run: |
echo "ASSIGNEE_SLACK_ID=${{ env[github.event.pull_request.assignee.login] }}" >> $GITHUB_ENV
- name: Set reviewer and sender nickname
id: set-nicks
run: |
echo "ASSIGNEE_NICKNAME=${{ env[format('{0}', env.ASSIGNEE_SLACK_ID)] }}" >> $GITHUB_ENV
- name: pr review 요청 -> 리뷰어에게 slack 멘션 알림
id: send-message
uses: slackapi/[email protected]
with:
channel-id: ${{ secrets.REVIEW_MENTION_CHANNEL_ID }}
payload: |
{
"blocks": [
{
"type": "divider"
},
{
"type": "header",
"text": {
"type": "plain_text",
"text": "🎁 (#${{ github.event.pull_request.number }}) Pull Request가 준비되었습니다!",
"emoji": true
}
},
{
"type": "section",
"text": {
"type": "mrkdwn",
"text": "\n*진행자:*\n${{ env.ASSIGNEE_NICKNAME }}"
}
},
{
"type": "section",
"text": {
"type": "mrkdwn",
"text": "*${{ github.event.pull_request.title }}*"
},
"accessory": {
"type": "button",
"text": {
"type": "plain_text",
"text": "👉🏻 PR 바로가기 👈🏻",
"emoji": true
},
"value": "바로가기 링크",
"url": "${{ github.event.pull_request.html_url }}",
"action_id": "button-action"
}
},
{
"type": "divider"
}
],
"icon_url": "${{ github.event.sender.avatar_url }}"
}
env:
SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }}

- name: Slack 메세지 ID를 PR comment에 등록
uses: peter-evans/create-or-update-comment@v4
with:
issue-number: ${{ github.event.number }}
body: |
${{ steps.send-message.outputs.ts }}
58 changes: 58 additions & 0 deletions .github/workflows/fe-ci-pr-test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
name: FE/CI - 테스트 실행 및 검증

on:
pull_request:
types: [opened, ready_for_review, synchronize]
branches:
- fe/develop

jobs:
run-test-pr-opened:
if: startsWith(github.head_ref, 'fe-')
runs-on: ubuntu-22.04
environment: dev
permissions:
pull-requests: write
defaults:
run:
working-directory: ./frontend
env:
API_URL: ${{ secrets.API_URL }}
DOMAIN_URL: ${{ secrets.DOMAIN_URL }}
API_VERSION: ${{ secrets.API_VERSION }}
GA_MEASUREMENT_ID: ${{ secrets.GA_MEASUREMENT_ID }}
SENTRY_DSN: ${{ secrets.SENTRY_DSN }}
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }}

steps:
- name: 저장소 checkout
uses: actions/checkout@v4

- name: Node.js 셋업
uses: actions/setup-node@v4
with:
node-version: 20.x

- uses: actions/cache@v4
id: npm-cache
with:
path: |
frontend/node_modules
~/.npm
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}

- name: 애플리케이션 의존성 항목들 설치
if: steps.npm-cache.outputs.cache-hit != 'true'
run: npm ci

- name: 코드 문법 테스트
run: npm run lint

- name: 애플리케이션 기능 테스트
run: npm run test -- --passWithNoTests

- name: Storybook 빌드 테스트
run: npm run build-storybook

- name: 애플리케이션 빌드 테스트
run: npm run build
Loading

0 comments on commit db0712e

Please sign in to comment.