Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

필요 없는 파일 제거 및 CI 구성 #121

Merged
merged 7 commits into from
Nov 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
133 changes: 133 additions & 0 deletions .github/workflows/auto-assign-merge.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,133 @@
name: Auto Assign, Review, and Merge

on:
pull_request:
types:
[
opened,
labeled,
unlabeled,
review_requested,
review_request_removed,
]
pull_request_review:
types: [submitted]

jobs:
auto-assign:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v2

- name: Set up Node.js
uses: actions/setup-node@v2
with:
node-version: "16"

- name: Assign PR creator as Assignee
uses: actions/github-script@v6
with:
script: |
await github.rest.issues.addAssignees({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: context.payload.pull_request.number,
assignees: [context.actor]
});

auto-reviewers:
runs-on: ubuntu-latest
needs: auto-assign
steps:
- name: Checkout repository
uses: actions/checkout@v2

- name: Set up Node.js
uses: actions/setup-node@v2
with:
node-version: "16"

- name: Add reviewers based on labels
uses: actions/github-script@v6
with:
script: |
const prNumber = context.payload.pull_request.number;
const assignees = context.payload.pull_request.assignees.map(a => a.login);

// Define reviewers for each label
const BE_reviewers = ['summersummerwhy', 'ezcolin2', 'Tolerblanc'].filter(r => !assignees.includes(r));
const FE_reviewers = ['yewonJin', 'djk01281'].filter(r => !assignees.includes(r));
const doc_reviewers = ['summersummerwhy', 'ezcolin2', 'Tolerblanc', 'yewonJin', 'djk01281'].filter(r => !assignees.includes(r));

// Check the labels on the PR and assign appropriate reviewers
const labels = context.payload.pull_request.labels.map(label => label.name);
let reviewersToAdd = [];

if (labels.includes('🐧🚀😶‍🌫️ BE')) {
reviewersToAdd.push(...BE_reviewers);
}
if (labels.includes('🐳🐣 FE')) {
reviewersToAdd.push(...FE_reviewers);
}
if (labels.includes('📚 Documentation')) {
reviewersToAdd.push(...doc_reviewers);
}

// Remove duplicates if any
reviewersToAdd = [...new Set(reviewersToAdd)];

// Request reviewers
if (reviewersToAdd.length > 0) {
await github.rest.pulls.requestReviewers({
owner: context.repo.owner,
repo: context.repo.repo,
pull_number: prNumber,
reviewers: reviewersToAdd
});
}

auto-merge:
runs-on: ubuntu-latest
needs: [auto-assign, auto-reviewers]
if: github.event.pull_request.merged == false
steps:
- name: Checkout repository
uses: actions/checkout@v2

- name: Set up Node.js
uses: actions/setup-node@v2
with:
node-version: "16"

- name: Merge and Close PR if Approved
uses: actions/github-script@v6
with:
script: |
const prNumber = context.payload.pull_request.number;

// Check if PR is approved
const reviews = await github.rest.pulls.listReviews({
owner: context.repo.owner,
repo: context.repo.repo,
pull_number: prNumber
});

const approved = reviews.data.some(review => review.state === 'APPROVED');

// If approved, merge the PR
if (approved) {
await github.rest.pulls.merge({
owner: context.repo.owner,
repo: context.repo.repo,
pull_number: prNumber
});

// Delete the branch after merge
const branchName = context.payload.pull_request.head.ref;
await github.rest.git.deleteRef({
owner: context.repo.owner,
repo: context.repo.repo,
ref: `heads/${branchName}`
});
}
196 changes: 196 additions & 0 deletions .github/workflows/ci-pipeline.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,196 @@
name: OctoDocs CI Pipeline

on:
pull_request:
branches:
- develop
push:
branches:
- develop

jobs:
setup-backend:
runs-on: ubuntu-latest
outputs:
cache-key: ${{ steps.cache-backend-deps.outputs.cache-hit }}
steps:
- name: Checkout repository
uses: actions/checkout@v3

- name: Set up Node.js
uses: actions/setup-node@v3
with:
node-version: "23"

# 백엔드 의존성 캐시 설정
- name: Cache Yarn dependencies for backend
id: cache-backend-deps
uses: actions/cache@v3
with:
path: backend/node_modules
key: ${{ runner.os }}-backend-yarn-${{ hashFiles('backend/yarn.lock') }}

# 백엔드 의존성 설치
- name: Install backend dependencies
if: steps.cache-backend-deps.outputs.cache-hit != 'true'
working-directory: ./backend
run: yarn install

setup-frontend:
runs-on: ubuntu-latest
outputs:
cache-key: ${{ steps.cache-frontend-deps.outputs.cache-hit }}
steps:
- name: Checkout repository
uses: actions/checkout@v3

- name: Set up Node.js
uses: actions/setup-node@v3
with:
node-version: "23"

# 프론트엔드 의존성 캐시 설정
- name: Cache Yarn dependencies for frontend
id: cache-frontend-deps
uses: actions/cache@v3
with:
path: frontend/node_modules
key: ${{ runner.os }}-frontend-yarn-${{ hashFiles('frontend/yarn.lock') }}

# 프론트엔드 의존성 설치
- name: Install frontend dependencies
if: steps.cache-frontend-deps.outputs.cache-hit != 'true'
working-directory: ./frontend
run: yarn install

backend-lint:
runs-on: ubuntu-latest
needs: setup-backend
steps:
- name: Checkout repository
uses: actions/checkout@v3

- name: Set up Node.js
uses: actions/setup-node@v3
with:
node-version: "23"

# 백엔드 의존성 캐시 복원
- name: Restore Yarn dependencies for backend
uses: actions/cache@v3
with:
path: backend/node_modules
key: ${{ runner.os }}-backend-yarn-${{ hashFiles('backend/yarn.lock') }}

# 백엔드 린트 실행
- name: Run backend lint
working-directory: ./backend
run: yarn lint
continue-on-error: true

# 백엔드 린트 경고 포스트
- name: Post backend lint warning if any
if: failure()
run: echo "⚠️ 백엔드 lint 실행 도중 경고가 발생했습니다. 확인해주세요."

frontend-lint:
runs-on: ubuntu-latest
needs: setup-frontend
steps:
- name: Checkout repository
uses: actions/checkout@v3

- name: Set up Node.js
uses: actions/setup-node@v3
with:
node-version: "23"

# 프론트엔드 의존성 캐시 복원
- name: Restore Yarn dependencies for frontend
uses: actions/cache@v3
with:
path: frontend/node_modules
key: ${{ runner.os }}-frontend-yarn-${{ hashFiles('frontend/yarn.lock') }}

# 프론트엔드 린트 실행
- name: Run frontend lint
working-directory: ./frontend
run: yarn lint
continue-on-error: true

# 프론트엔드 린트 경고 포스트
- name: Post frontend lint warning if any
if: failure()
run: echo "⚠️ 프론트엔드 lint 실행 도중 경고가 발생했습니다. 확인해주세요."

backend-build:
runs-on: ubuntu-latest
needs: setup-backend
steps:
- name: Checkout repository
uses: actions/checkout@v3

- name: Set up Node.js
uses: actions/setup-node@v3
with:
node-version: "23"

# 백엔드 의존성 캐시 복원
- name: Restore Yarn dependencies for backend
uses: actions/cache@v3
with:
path: backend/node_modules
key: ${{ runner.os }}-backend-yarn-${{ hashFiles('backend/yarn.lock') }}

# 백엔드 빌드 실행
- name: Run backend build
working-directory: ./backend
run: yarn build

frontend-build:
runs-on: ubuntu-latest
needs: setup-frontend
steps:
- name: Checkout repository
uses: actions/checkout@v3

- name: Set up Node.js
uses: actions/setup-node@v3
with:
node-version: "23"

# 프론트엔드 의존성 캐시 복원
- name: Restore Yarn dependencies for frontend
uses: actions/cache@v3
with:
path: frontend/node_modules
key: ${{ runner.os }}-frontend-yarn-${{ hashFiles('frontend/yarn.lock') }}

# 프론트엔드 빌드 실행
- name: Run frontend build
working-directory: ./frontend
run: yarn build

backend-test:
runs-on: ubuntu-latest
needs: [setup-backend, backend-build]
steps:
- name: Checkout repository
uses: actions/checkout@v3

- name: Set up Node.js
uses: actions/setup-node@v3
with:
node-version: "23"

# 백엔드 의존성 캐시 복원
- name: Restore Yarn dependencies for backend
uses: actions/cache@v3
with:
path: backend/node_modules
key: ${{ runner.os }}-backend-yarn-${{ hashFiles('backend/yarn.lock') }}

# 백엔드 테스트 실행
- name: Run backend tests
working-directory: ./backend
run: yarn test
14 changes: 12 additions & 2 deletions backend/.gitignore → .gitignore
Original file line number Diff line number Diff line change
@@ -1,10 +1,14 @@
# env
.env
.env*
*.local

# compiled output
/dist
/node_modules
*/dist
*/node_modules
dist
node_modules
dist-ssr

# Logs
logs
Expand All @@ -24,12 +28,18 @@ lerna-debug.log*

# IDEs and editors
/.idea
.idea
.project
.classpath
.c9/
*.launch
.settings/
*.sublime-workspace
*.suo
*.ntvs*
*.njsproj
*.sln
*.sw?

# IDE - VSCode
.vscode/*
Expand Down
6 changes: 0 additions & 6 deletions .vscode/settings.json

This file was deleted.

Binary file removed backend/db_name
Binary file not shown.
Loading
Loading