Skip to content

Commit

Permalink
Merge pull request #241 from woowa-techcamp-2021/develop
Browse files Browse the repository at this point in the history
1.0.0
  • Loading branch information
Choi-Jinwoo authored Aug 29, 2021
2 parents 0c8ecbf + b601741 commit b1888fe
Show file tree
Hide file tree
Showing 335 changed files with 16,892 additions and 436 deletions.
20 changes: 12 additions & 8 deletions .github/workflows/dev-server-cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,10 @@ jobs:
- uses: technote-space/get-diff-action@v4
with:
PATTERNS: |
server/src/**/*.+(ts|tsx)
src/**/*.+(ts|tsx)
FILES: |
server/package.json
package.json
RELATIVE: "server"
- name: Configure SSH
run: |
mkdir -p ~/.ssh/
Expand All @@ -33,10 +34,10 @@ jobs:
SSH_KEY: ${{ secrets.DEV_PRIVATE_KEY }}
- name: Checkout and Pull origin
run: ssh develop 'cd ~/store-4 && git checkout develop && git pull origin'
- name: if changed dependencies, install dependencies

- name: if changed dependencies, install dependencies
run: ssh develop 'cd ~/store-4/server && npm i'
if: env.GIT_MATCHED_FILES
if: env.MATCHED_FILES

- name: Reload Pm2
run: ssh develop 'cd ~/store-4/server && npm run build && sudo pm2 reload store-4'
Expand Down Expand Up @@ -72,9 +73,12 @@ jobs:
SSH_HOST: ${{ secrets.DEV_HOSTNAME }}
SSH_USER: ${{ secrets.DEV_USERNAME }}
SSH_KEY: ${{ secrets.DEV_PRIVATE_KEY }}
- name: Touch .env file
run: |
cat >>./.env <<END
SERVER_URL=${{ secrets.DEV_SERVER_URL }}
END
working-directory: client
- name: Run build script && Sync build files to server
run: cd client && npm i && npm run build && rsync -avz ./dist/ develop:~/store-4/client/dist
if: env.GIT_DIFF



84 changes: 84 additions & 0 deletions .github/workflows/prod-server-cd.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
name: Production Server CD

on:
push:
branches:
- main
jobs:
backend:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: technote-space/get-diff-action@v4
with:
PATTERNS: |
src/**/*.+(ts|tsx)
FILES: |
package.json
RELATIVE: "server"
- name: Configure SSH
run: |
mkdir -p ~/.ssh/
echo "$SSH_KEY" > ~/.ssh/production.key
chmod 600 ~/.ssh/production.key
cat >>~/.ssh/config <<END
Host production
HostName $SSH_HOST
User $SSH_USER
IdentityFile ~/.ssh/production.key
StrictHostKeyChecking no
END
env:
SSH_HOST: ${{ secrets.HOSTNAME }}
SSH_USER: ${{ secrets.USERNAME }}
SSH_KEY: ${{ secrets.PRIVATE_KEY }}
- name: Checkout and Pull origin
run: ssh production 'cd ~/store-4 && git checkout main && git pull origin'

- name: if changed dependencies, install dependencies
run: ssh production 'cd ~/store-4/server && npm i'
if: env.MATCHED_FILES

- name: Reload Pm2
run: ssh production 'cd ~/store-4/server && npm run build && sudo pm2 reload store-4'
if: env.GIT_DIFF
frontend:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [14.x]
steps:
- uses: actions/checkout@v2
- uses: technote-space/get-diff-action@v4
with:
PATTERNS: |
client/src/**/*.+(ts|tsx)
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}
- name: Configure SSH
run: |
mkdir -p ~/.ssh/
echo "$SSH_KEY" > ~/.ssh/production.key
chmod 600 ~/.ssh/production.key
cat >>~/.ssh/config <<END
Host production
HostName $SSH_HOST
User $SSH_USER
IdentityFile ~/.ssh/production.key
StrictHostKeyChecking no
END
env:
SSH_HOST: ${{ secrets.HOSTNAME }}
SSH_USER: ${{ secrets.USERNAME }}
SSH_KEY: ${{ secrets.PRIVATE_KEY }}
- name: Touch .env file
run: |
cat >>./.env <<END
SERVER_URL=${{ secrets.SERVER_URL }}
END
working-directory: client
- name: Run build script && Sync build files to server
run: cd client && npm i && npm run build && rsync -avz ./dist/ production:~/store-4/client/dist
if: env.GIT_DIFF
28 changes: 28 additions & 0 deletions .github/workflows/typescript-compile.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: NodeJS CI - compile

on:
pull_request:

jobs:
build:
runs-on: ubuntu-latest

strategy:
matrix:
node-version: [14.x]

steps:
- uses: actions/checkout@v2
- name: Use NodeJS ${{ matrix.node-version }}
uses: actions/setup-node@v2
with:
node-version: ${{ matrix.node-version }}
- run: npm ci
working-directory: client
- run: npx tsc
working-directory: client

- run: npm ci
working-directory: server
- run: npx tsc
working-directory: server
23 changes: 22 additions & 1 deletion client/.babelrc
Original file line number Diff line number Diff line change
@@ -1,3 +1,24 @@
{
"presets": ["@babel/preset-env", "@babel/preset-react", "@babel/preset-typescript"]
"presets": [
[
"@babel/preset-env",
{
"targets": { "browsers": ["last 2 versions", "ie >= 11"] },
"useBuiltIns": "entry",
"corejs": "3.16"
}
],
"@babel/preset-react",
"@babel/preset-typescript"
],
"plugins": [
["@babel/plugin-proposal-decorators", { "legacy": true }],
[
"@babel/plugin-transform-runtime",
{
"corejs": 3,
"regenerator": true
}
]
]
}
3 changes: 0 additions & 3 deletions client/index.d.ts

This file was deleted.

2 changes: 1 addition & 1 deletion client/jest.config.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module.exports = {
testEnvironment: 'jsdom',
moduleNameMapper: {
'.+\\.(css|styl|less|sass|scss|png|jpg|ttf|woff|woff2|svg)$': 'jest-transform-stub',
'.+\\.(css|styl|less|sass|scss|png|jpg|ttf|woff|woff2|svg|gif)$': 'jest-transform-stub',
},
};
6 changes: 6 additions & 0 deletions client/module.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
declare module '*.png';
declare module '*.jpg';
declare module '*.svg';
declare module '*.gif';
declare module '*.mp4';
declare module '*.webm';
Loading

0 comments on commit b1888fe

Please sign in to comment.