Skip to content

Commit

Permalink
Merge pull request #177 from sparcs-kaist/release/0.2.0
Browse files Browse the repository at this point in the history
  • Loading branch information
withSang authored Sep 16, 2023
2 parents 89690b0 + 605d8fb commit aef0a0b
Show file tree
Hide file tree
Showing 364 changed files with 16,133 additions and 21,301 deletions.
8 changes: 8 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
.idea
.git
.gitignore
.dockerignore
Dockerfile
*.md
*.sh
node_modules
148 changes: 22 additions & 126 deletions .eslintrc
Original file line number Diff line number Diff line change
@@ -1,132 +1,28 @@
{
"extends": [
"airbnb-base",
"airbnb/rules/react",
],
"plugins": [
"@typescript-eslint",
"simple-import-sort"
],
"parser": "@typescript-eslint/parser",
"parserOptions": {
"ecmaVersion": 2018,
"sourceType": "module"
},
"rules": {
"react/prefer-stateless-function": 0,
"react/jsx-filename-extension": 0,
"react/jsx-one-expression-per-line": 0,
"react/jsx-props-no-spreading": 0,
"react/state-in-constructor": "off",
"react/destructuring-assignment": "warn",
"react/no-unused-state": "warn",
"react/button-has-type": "warn",
"react/no-array-index-key": "warn",
"react/sort-comp": "off",
"react/prop-types": "warn",
"react/require-default-props": "warn",
"import/prefer-default-export": "warn",
"import/named": "warn",
"import/no-named-as-default": "off",
"import/extensions": [
"error",
"ignorePackages",
{
"js": "never",
"jsx": "never",
"ts": "never",
"tsx": "never"
}
],
"@typescript-eslint/type-annotation-spacing": ["warn", { "before": false, "after": true, "overrides": { "colon": { "before": true, "after": true }, "arrow": { "before": true, "after": true } } }],
"arrow-parens": ["warn", "as-needed"],
"no-nested-ternary": "off",
"no-unused-expressions": "off",
"no-unused-vars": "off",
"@typescript-eslint/no-unused-vars": "off",
"no-useless-constructor": "off",
"@typescript-eslint/no-useless-constructor": "warn",
"space-before-function-paren": ["warn", "always"],
"no-spaced-func": "off",
"func-call-spacing": ["warn", "always"],
"no-underscore-dangle": "off",
"no-mixed-spaces-and-tabs": "error",
"no-shadow": "warn",
"max-len": ["warn", 150],
"no-console": ["warn", { "allow": ["warn", "error"] }],
"func-names": "off",
"no-plusplus": ["warn", {
"allowForLoopAfterthoughts": true
}],
"no-trailing-spaces": "warn",
"indent": ["warn", 2],
"semi": ["warn", "always"],
"no-param-reassign": ["warn", { "props": true, "ignorePropertyModificationsFor": ["draft"] }],
"simple-import-sort/sort": [
1,
{
"groups": [
["^\\u0000"],
[
"^react$",
"^prop-types$",
"^react-router-dom$",
"^react-redux$",
"^react",
"^styled-components$",
"^[^.]"
],
[
"^containers",
"^components",
"^atoms",
"^molecules",
"^organisms",
"^templates",
"^pages"
],
[
"^store",
"^hoc",
"^hooks",
"^lib"
],
[
"^(static)",
"^(?!(assets|static)($|/))\\w"
],
["^\\."]
]
}
]
"settings": {
"react": {
"version": "detect"
}
},
"env": {
"browser": true
"browser": true,
"node": true,
"jest": true
},
"settings": {
"import/resolver": {
"node": {
"moduleDirectory": ["node_modules", "src", "src/components"],
"extensions": [".js",".jsx",".ts",".tsx"]
}
},
"import/extensions": [".js",".jsx",".ts",".tsx"],
"import/parsers": {
"@typescript-eslint/parser": [".ts",".tsx"]
}
"extends": [
"eslint:recommended",
"plugin:react/recommended",
"plugin:react-hooks/recommended",
"plugin:@typescript-eslint/recommended",
"plugin:import/typescript",
"prettier"
],
"rules": {
"react/prop-types": "warn"
},
"overrides": [
{
"files": ["*.stories.js", "*.test.js"],
"rules": {
"import/no-extraneous-dependencies": "off",
}
},
{
"files": ["*.test.js"],
"env": {
"jest": true
}
}
]
"parser": "@typescript-eslint/parser",
"root": true,
"parserOptions": {
"project": "./tsconfig.json"
}
}
31 changes: 31 additions & 0 deletions .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
---
name: Bug report
about: Create a report to help us improve
title: "[Bug] Bug title"
labels: bug
assignees: ''

---

# Describe the bug

<!-- 버그가 발생한 상황을 간결하고 명확하게 설명해주세요. 버그가 발생한 원인을 추측하실 수 있다면, 같이 써주셔도 좋습니다. -->

A clear and concise description of what the bug is.

# To Reproduce

<!-- 버그를 재현할 수 있는 과정을 단계별로 설명해주세요. -->

Steps to reproduce the behavior:

1. Go to '...'
2. Click on '....'
3. Scroll down to '....'
4. See error

# Screenshots

<!-- 스크린샷이나 영상이 버그 설명에 도움이 된다면, 함께 첨부해주시면 감사하겠습니다. -->

If applicable, add screenshots to help explain your problem.
18 changes: 18 additions & 0 deletions .github/ISSUE_TEMPLATE/feature-request.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
---
name: Feature request
about: Suggest an idea for this project
title: issue title
labels: enhancement
assignees: ''

---

# Summary <!-- 간단한 요약. -->

It implements ...

# Tasks <!-- 해야 할 태스크 체크리스트로 만들기 -->

- [ ] Task 1
- [ ] Task 2
- [ ] Task 3
9 changes: 9 additions & 0 deletions .github/ISSUE_TEMPLATE/issue-template.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# Summary <!-- 이슈에 대한 간단한 요약. -->

It implements ...

# Tasks <!-- 해야 할 태스크 체크리스트로 만들기 -->

- [ ] Task 1
- [ ] Task 2
- [ ] Task 3
13 changes: 13 additions & 0 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# Summary <!-- PR 내용에 대한 간단한 요약 및 닫는 이슈 번호 표기. -->

<!-- 같은 레포의 이슈를 해결할 경우엔 "closes", 다른 레포의 이슈를 해결할 경우엔 "fixes", 여러 개의 이슈를 해결할 경우엔 "resolves"를 사용할 수 있습니다. -->

It closes #issue_number

# Extra info <!-- Answer 'y' or 'n'. 필요하지 않으면 지우셔도 됩니다. -->

# Images or Screenshots <!-- PR 변경 사항에 대한 Screenshot이나 .gif 파일 -->

# Further Work <!-- PR 이후 개설할 이슈 목록 -->

- Do something...
36 changes: 36 additions & 0 deletions .github/workflows/dev-build-image.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: Build docker image on push to develop

on:
push:
branches: ["develop"]

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Cache Docker layers
uses: actions/cache@v3
with:
path: /tmp/.buildx-cache
key: ${{ runner.os }}-buildx-${{ github.sha }}
restore-keys: |
${{ runner.os }}-buildx-
- name: Log in to GitHub Container Registry
run: echo ${{ secrets.GITHUB_TOKEN }} | docker login ghcr.io -u USERNAME --password-stdin
- name: Build and push Image
id: docker-build
uses: docker/build-push-action@v5
env:
IMAGE_TAG: dev
with:
push: true
tags: "ghcr.io/sparcs-kaist/zabo-front:${{ env.IMAGE_TAG }}"
cache-from: type=local,src=/tmp/.buildx-cache
cache-to: type=local,dest=/tmp/.buildx-cache-new
- name: Remove old cache
run: |
rm -rf /tmp/.buildx-cache
mv /tmp/.buildx-cache-new /tmp/.buildx-cache
32 changes: 32 additions & 0 deletions .github/workflows/dev-deploy.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: Deploy to dev server

# when dev image build action is completed, run this action
on:
workflow_run:
workflows: ["Build docker image on push to develop"]
types:
- completed

jobs:
if_workflow_success:
name: Deploy to dev server
runs-on: ubuntu-latest
if: ${{ github.event.workflow_run.conclusion == 'success' }}

steps:
- name: pull the image and restart the container
uses: appleboy/ssh-action@v1.0.0
with:
host: ${{ secrets.DEV_HOST }}
port: ${{ secrets.DEV_PORT }}
username: ${{ secrets.DEV_USERNAME }}
password: ${{ secrets.DEV_PASSWORD }}
proxy_host: ${{ secrets.DEV_PROXY_HOST }}
proxy_port: ${{ secrets.DEV_PROXY_PORT }}
proxy_username: ${{ secrets.DEV_PROXY_USERNAME }}
proxy_password: ${{ secrets.DEV_PROXY_PASSWORD }}
script_stop: true # stop script if any command has failed
script: |
docker pull ghcr.io/sparcs-kaist/zabo-front:dev
docker rm -f zabo-front
docker run --restart always -d -p ${{ secrets.DEV_CONTAINER_PORT }}:80 --name zabo-front ghcr.io/sparcs-kaist/zabo-front:dev
40 changes: 40 additions & 0 deletions .github/workflows/prod-build-image.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: Build docker image on release tag created

on:
push:
tags:
- v**

jobs:
build:
name: Build and push Image to GitHub Container Registry
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Cache Docker layers
uses: actions/cache@v3
with:
path: /tmp/.buildx-cache
key: ${{ runner.os }}-buildx-${{ github.sha }}
restore-keys: |
${{ runner.os }}-buildx-
- name: Log in to GitHub Container Registry
run: echo ${{ secrets.GITHUB_TOKEN }} | docker login ghcr.io -u USERNAME --password-stdin
- name: Build and push Image
id: docker-build
uses: docker/build-push-action@v5
env:
IMAGE_TAG: ${{github.ref_name}}
with:
push: true
tags: |
"ghcr.io/sparcs-kaist/zabo-front:${{ env.IMAGE_TAG }}"
"ghcr.io/sparcs-kaist/zabo-front:latest"
cache-from: type=local,src=/tmp/.buildx-cache
cache-to: type=local,dest=/tmp/.buildx-cache-new
- name: Remove old cache
run: |
rm -rf /tmp/.buildx-cache
mv /tmp/.buildx-cache-new /tmp/.buildx-cache
32 changes: 32 additions & 0 deletions .github/workflows/prod-deploy.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: Deploy to prod server

# when prod image build action is completed, run this action
on:
workflow_run:
workflows: ["Build docker image on release tag created"]
types:
- completed

jobs:
if_workflow_success:
name: Deploy to dev server
runs-on: ubuntu-latest
if: ${{ github.event.workflow_run.conclusion == 'success' }}

steps:
- name: pull the image and restart the container
uses: appleboy/ssh-action@v1.0.0
with:
host: ${{ secrets.PROD_HOST }}
port: ${{ secrets.PROD_PORT }}
username: ${{ secrets.PROD_USERNAME }}
password: ${{ secrets.PROD_PASSWORD }}
proxy_host: ${{ secrets.PROD_PROXY_HOST }}
proxy_port: ${{ secrets.PROD_PROXY_PORT }}
proxy_username: ${{ secrets.PROD_PROXY_USERNAME }}
proxy_password: ${{ secrets.PROD_PROXY_PASSWORD }}
script_stop: true # stop script if any command has failed
script: |
docker pull ghcr.io/sparcs-kaist/zabo-front:latest
docker rm -f zabo-front
docker run --restart always -d -p ${{ secrets.PROD_CONTAINER_PORT }}:80 --name zabo-front ghcr.io/sparcs-kaist/zabo-front:latest
Loading

0 comments on commit aef0a0b

Please sign in to comment.