Skip to content

Commit

Permalink
Merge branch 'develop' into refactor/ci-h2
Browse files Browse the repository at this point in the history
  • Loading branch information
kyum-q authored Aug 2, 2024
2 parents aa68aad + 02bd6d4 commit 2bdaef7
Show file tree
Hide file tree
Showing 94 changed files with 13,699 additions and 6,909 deletions.
16 changes: 3 additions & 13 deletions .github/workflows/backend_cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,19 +44,9 @@ jobs:
runs-on: self-hosted
steps:
- name: 브랜치명을 통해 개발 환경 알아내기
id: get-branch
run: |
BRANCH_NAME=${GITHUB_REF#refs/heads/}
if [ "$BRANCH_NAME" = "main" ]; then
echo "ENVIRONMENT=prod" >> $GITHUB_ENV
echo "개발 환경 : prod"
elif [ "$BRANCH_NAME" = "develop" ]; then
echo "ENVIRONMENT=dev" >> $GITHUB_ENV
echo "개발 환경 : dev"
else
exit 1
fi
cd ${{ secrets.SCRIPT_DIRECTORY }}
bash find-env-branch.sh
- name: Artifact 다운로드
uses: actions/download-artifact@v4
Expand All @@ -72,7 +62,7 @@ jobs:
- name: 배포 스크립트 실행
run: |
cd ${{ secrets.WORK_DIRECTORY }}
unzip -o code-zap-jar.zip
unzip -o code-zap-jar.zip -d ${{ env.ENVIRONMENT }}
cd ${{ secrets.SCRIPT_DIRECTORY }}
RUNNER_TRACKING_ID="" && bash start.sh ${{ env.ENVIRONMENT }}
Expand Down
51 changes: 51 additions & 0 deletions .github/workflows/frontend_cd.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
name: Frontend CD

on:
push:
branches:
- main
- develop

jobs:
build:
runs-on: ubuntu-latest
env:
frontend-directory: ./frontend
steps:
- uses: actions/checkout@v4

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

- name: Install Dependencies
run: npm install
working-directory: ${{ env.frontend-directory }}

- name: Run Build
run: npm run build
working-directory: ${{ env.frontend-directory }}

- name: Upload Artifact
uses: actions/upload-artifact@v4
with:
name: code-zap-front
path: ${{ env.frontend-directory }}/dist/**

deploy:
needs: build
runs-on: self-hosted
steps:
- name: Make Artifact Directory
run: mkdir ${{ secrets.FRONT_DIRECTORY }}
- name: Download Artifact
uses: actions/download-artifact@v4
with:
name: code-zap-front
path: ${{ secrets.FRONT_DIRECTORY }}
- name: Move To S3
run: |
aws s3 cp --recursive ${{ secrets.FRONT_DIRECTORY }} s3://techcourse-project-2024/code-zap
rm -rf ${{ secrets.FRONT_DIRECTORY }}
31 changes: 31 additions & 0 deletions .github/workflows/frontend_ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: Frontend CI

on:
pull_request:
branches:
- '**'

jobs:
build-with-test:
runs-on: ubuntu-latest
env:
frontend-directory: ./frontend
steps:
- uses: actions/checkout@v4

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

- name: Install Dependencies
run: npm install
working-directory: ${{ env.frontend-directory }}

- name: Run Type Checking
run: npm run tsc
working-directory: ${{ env.frontend-directory }}

- name: Run Tests
run: npm run test
working-directory: ${{ env.frontend-directory }}
20 changes: 0 additions & 20 deletions frontend/.eslintrc.cjs

This file was deleted.

103 changes: 103 additions & 0 deletions frontend/.eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
{
"root": true,
"env": {
"browser": true,
"es2020": true
},
"extends": [
"eslint:recommended",
"plugin:prettier/recommended",
"plugin:@typescript-eslint/recommended",
"plugin:import/recommended",
"plugin:react/recommended",
"plugin:react-hooks/recommended",
"plugin:react/jsx-runtime",
"plugin:storybook/recommended"
],
"ignorePatterns": ["dist", "*.config.ts", "*.common.js", "*.prod.js", "*.dev.js", "*.polyfills.js"],
"parser": "@typescript-eslint/parser",
"plugins": ["react-refresh", "react", "import"],
"settings": {
"import/resolver": {
"typescript": {
"alwaysTryTypes": true
},
"node": {
"extensions": [".js", ".jsx", ".ts", ".tsx"]
}
}
},
"rules": {
"prettier/prettier": "error",
"padding-line-between-statements": [
"error",
{ "blankLine": "always", "prev": "*", "next": "return" },
{ "blankLine": "always", "prev": ["const", "let", "var", "function", "block-like"], "next": "*" },
{ "blankLine": "any", "prev": ["const", "let", "var"], "next": ["const", "let", "var"] },
{ "blankLine": "always", "prev": "case", "next": "*" }
],
"prefer-template": "error",
"object-shorthand": ["error", "always"],
"prefer-arrow-callback": "error",
"func-style": ["error", "expression", { "allowArrowFunctions": true }],
"arrow-body-style": ["error", "as-needed"],
"consistent-return": "error",
"curly": ["error", "all"],
"default-case": "error",
"default-case-last": "error",
"no-fallthrough": "error",
"import/newline-after-import": ["error", { "count": 1 }],
"import/order": [
"error",
{
"groups": [
["builtin", "external"],
["internal", "parent", "sibling", "index", "type"]
],
"warnOnUnassignedImports": true,
"alphabetize": { "order": "asc" },
"newlines-between": "always",
"distinctGroup": false,
"pathGroups": [
{
"pattern": "@storybook/**",
"group": "external",
"position": "before"
},
{
"pattern": "@/**",
"group": "internal",
"position": "before"
},
{
"pattern": "./**",
"group": "sibling",
"position": "after"
}
]
}
],
"import/extensions": [
"error",
"ignorePackages",
{
"js": "never",
"jsx": "never",
"ts": "never",
"tsx": "never"
}
],
"react-refresh/only-export-components": ["error", { "allowConstantExport": false }],
"react/no-unknown-property": ["error", { "ignore": ["css"] }],
"import/no-default-export": "error"
},
"overrides": [
{
"files": ["*.tsx", "*.d.ts"],
"rules": {
"import/no-default-export": "off",
"import/prefer-default-export": "error"
}
}
]
}
4 changes: 4 additions & 0 deletions frontend/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,7 @@ node_modules
*storybook.log

dist

.env
.env.development
.env.production
11 changes: 8 additions & 3 deletions frontend/.storybook/main.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import type { StorybookConfig } from '@storybook/react-webpack5';
import { Configuration } from 'webpack';

import path from 'path';
const config: StorybookConfig = {
stories: ['../src/**/*.mdx', '../src/**/*.stories.@(js|jsx|mjs|ts|tsx)'],
addons: [
Expand All @@ -27,10 +27,15 @@ const config: StorybookConfig = {
},
],
});

config.resolve = {
...config.resolve,
alias: {
...config.resolve?.alias,
'@': path.resolve(__dirname, '../src'),
},
};
return config;
},

framework: {
name: '@storybook/react-webpack5',
options: {},
Expand Down
4 changes: 4 additions & 0 deletions frontend/.stylelintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"extends": ["stylelint-config-clean-order"],
"customSyntax": "postcss-styled-syntax"
}
21 changes: 21 additions & 0 deletions frontend/jest.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import type { Config } from 'jest';

const config: Config = {
preset: 'ts-jest',
testEnvironment: 'jsdom',
setupFiles: ['./jest.polyfills.js'],
testEnvironmentOptions: {
customExportConditions: [''],
},
setupFilesAfterEnv: ['./setupTests.ts'],
moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx', 'json'],
transform: {
'^.+\\.tsx?$': 'ts-jest',
},
clearMocks: true,
moduleNameMapper: {
'^@/(.*)$': '<rootDir>/src/$1',
},
};

export default config;
34 changes: 34 additions & 0 deletions frontend/jest.polyfills.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
const { ReadableStream, TransformStream } = require('node:stream/web');
const { TextDecoder, TextEncoder } = require('node:util');

Object.defineProperties(globalThis, {
TextDecoder: { value: TextDecoder },
TextEncoder: { value: TextEncoder },
ReadableStream: { value: ReadableStream },
TransformStream: { value: TransformStream },
});

Object.defineProperties(globalThis, {
TextDecoder: { value: TextDecoder },
TextEncoder: { value: TextEncoder },
ReadableStream: { value: ReadableStream },
});

const { Blob, File } = require('node:buffer');
const { fetch, Headers, FormData, Request, Response } = require('undici');

Object.defineProperties(globalThis, {
fetch: { value: fetch, writable: true },
Blob: { value: Blob },
File: { value: File },
Headers: { value: Headers },
FormData: { value: FormData },
Request: { value: Request },
Response: { value: Response },
});

globalThis.setImmediate = (callback, ...args) => setTimeout(callback, 0, ...args);

globalThis.clearImmediate = (immediateId) => {
clearTimeout(immediateId);
};
Loading

0 comments on commit 2bdaef7

Please sign in to comment.