Skip to content

Commit

Permalink
Merge pull request #572 from boostcampwm2023/dev
Browse files Browse the repository at this point in the history
release v1.0.1
  • Loading branch information
HeoJiye authored Feb 23, 2024
2 parents c4d9b97 + 54e3388 commit d19d03f
Show file tree
Hide file tree
Showing 108 changed files with 1,503 additions and 1,690 deletions.
11 changes: 6 additions & 5 deletions .github/pr-labels.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
feature: "*/feature/*"
bug: "*/bugfix/*"
refactor: "*/refactor/*"
BE: "Be/*"
FE: "Fe/*"
feature: "*feature*"
bug: ["*bugfix*", "*hotfix*"]
refactor: "*refactor*"
release: "release*"
BE: ["Be/*", "Fe,be/*", "Be,fe/*"]
FE: ["Fe/*", "Fe,be/*", "Be,fe/*"]
DevOps: "Devops/*"
43 changes: 43 additions & 0 deletions .github/release-drafter.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
name-template: "v$RESOLVED_VERSION"
tag-template: "v$RESOLVED_VERSION"
template: |
# Changes (v$RESOLVED_VERSION)
$CHANGES
footer: |
### Contributors
$CONTRIBUTORS
categories:
- title: "🚀 Features"
collapse-after: 15
labels:
- "feature"
- title: "🐛 Bug Fixes"
collapse-after: 15
labels:
- "bug"
- title: "🛠️ Improvement"
collapse-after: 15
labels:
- "refactor"
change-template: "- $TITLE (#$NUMBER) @$AUTHOR"
change-title-escapes: '\<*_&#/@[]'
version-resolver:
major:
labels:
- "major"
minor:
labels:
- "minor"
patch:
labels:
- "patch"
default: patch
replacers:
- search: "/$(Be|Fe|Devops|Be,fe|Fe,be)/"
replace: "[$1]"
- search: "/(feature|bugfix|hotfix|refactor)(,(feature|bugfix|hotfix|refactor))/"
replace: "[$1$2]"
- search: "/"
replace: " "
File renamed without changes.
11 changes: 11 additions & 0 deletions .github/workflows/assert-branch-naming.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
name: "Assert Branch Naming Convention"
on: pull_request

jobs:
branch-naming-rules:
runs-on: ubuntu-latest
steps:
- uses: deepakputhraya/action-branch-name@master
with:
regex: '(BE|FE|DEVOPS|BE,FE|Fe,BE)\/(feature|bugfix|hotfix|refactor)(,(feature|bugfix|hotfix|refactor))*\/#[\d]+(-#[\d]+)*.+'
ignore: dev,release
9 changes: 2 additions & 7 deletions .github/workflows/blue-green-cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name: Blue/Green CD for Backend
on:
push:
paths: ["backend/**"]
branches: ["dev"]
branches: ["release", "*hotfix*"]

env:
DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }}
Expand All @@ -25,11 +25,6 @@ jobs:
echo "${{ secrets.ENV_FILE }}" > .env
echo "DOCKER_USERNAME=${{ secrets.DOCKER_USERNAME }}" >> .env
echo "GITHUB_SHA=${{ github.sha }}" >> .env
mkdir -p config/nginx/ssl/
echo "${{ secrets.SSL_OPTIONS }}" > config/nginx/ssl/options-ssl-nginx.conf
echo "${{ secrets.SSL_FULLCHAIN }}" > config/nginx/ssl/fullchain.pem
echo "${{ secrets.SSL_PRIVKEY }}" > config/nginx/ssl/privkey.pem
echo "${{ secrets.SSL_DHPARAMS }}" > config/nginx/ssl/ssl-dhparams.pem
- name: Add Remote Host Key to known_hosts
run: |
Expand All @@ -43,7 +38,7 @@ jobs:
username: ${{ secrets.SSH_USERNAME }}
key: ${{ secrets.SSH_PRIVATE_KEY }}
port: ${{ secrets.SSH_PORT }}
source: "backend/.env,backend/deploy.sh,backend/send-slack-message.sh,backend/config,backend/compose.blue-deploy.yml,backend/compose.green-deploy.yml,backend/Dockerfile.nginx"
source: "backend/.env,backend/deploy.sh,backend/send-slack-message.sh,backend/compose.blue-deploy.yml,backend/compose.green-deploy.yml,backend/Dockerfile.nginx"
target: "~/app/"
overwrite: true

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ on:
jobs:
close-issue:
name: Close Issue
if: github.event.pull_request.base.ref != 'release'
runs-on: ubuntu-latest
steps:
- uses: actions/github-script@v7
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,20 @@ permissions:
contents: read

jobs:
check-title:
name: Check PR Title
runs-on: ubuntu-latest

steps:
- name: Check PR title
uses: deepakputhraya/action-pr-title@master
with:
regex: '((Be|Fe|Devops|Be,fe|Fe,be)\/(feature|bugfix|hotfix|refactor)(,(feature|bugfix|hotfix|refactor))*\/#[\d]+( #[\d]+)*.+|release v[\d]+\.[\d]+\.[\d]+)'
github_token: ${{ secrets.ADD_TO_PROJECT_PAT }}

set-label:
name: Set Labels to PR
needs: check-title
runs-on: ubuntu-latest
permissions:
contents: read
Expand All @@ -24,23 +36,25 @@ jobs:

set-issue:
name: Set Issue to PR
needs: check-title
runs-on: ubuntu-latest

steps:
- uses: actions/github-script@v7
if: github.event.pull_request.base.ref != 'release'
with:
github-token: ${{ secrets.ADD_TO_PROJECT_PAT }}
script: |
const prTitle = context.payload.pull_request.title;
const issueNumbers = prTitle.match(/#(\d+)/g);
const prefix = issueNumbers ? issueNumbers.reduce((acc, curr) => `${acc} ${curr}`, "resolved") : '';
const body = context.payload.pull_request.body.replace(/🔮 resolved #(\d+)( #(\d+))*/g, '');
const prefix = issueNumbers ? issueNumbers.reduce((acc, curr) => `${acc}🔮 resolved ${curr}\n`, "") : '';
const body = context.payload.pull_request.body.replace(/(🔮 resolved #\d+)+/g, '');
github.rest.pulls.update({
owner: context.repo.owner,
repo: context.repo.repo,
pull_number: context.payload.number,
body: `🔮 ${prefix}\n${body}`,
body: `${prefix}${body}`,
});
issueNumbers?.forEach((num) => {
Expand All @@ -58,6 +72,7 @@ jobs:

steps:
- uses: actions/github-script@v7
if: github.event.pull_request.base.ref != 'release'
with:
github-token: ${{ secrets.ADD_TO_PROJECT_PAT }}
script: |
Expand Down
20 changes: 20 additions & 0 deletions .github/workflows/release-drafter.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
name: Release Drafter

on:
push:
branches:
- release

permissions:
contents: read

jobs:
update-release-draft:
runs-on: ubuntu-latest
permissions:
contents: write
pull-requests: write
steps:
- uses: release-drafter/release-drafter@v5
env:
GITHUB_TOKEN: ${{ secrets.ADD_TO_PROJECT_PAT }}
48 changes: 48 additions & 0 deletions @types/event.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
interface AiSocketEvent {
ServerToClientEvent: {
streamStart: () => void;
streaming: (token: string) => void;
streamEnd: () => void;
tarotCard: () => void; // 타로 카드 펼치기 요청
chatEnd: (resultId: string) => void;
error: (message: string) => void;
};
ClientToServerEvent: {
message: (message: string) => void;
tarotRead: (cardIdx: number) => void; // 타로 카드 해설 요청
};
InterServerEvents: {};
SocketData: {};
}

interface HumanSocketEvent {
ServerToClientEvent: {
connection: (data: {
description?: RTCSessionDescription | null;
candidate?: RTCIceCandidate | null;
}) => void;
welcome: (otherUsers: any) => void;
userExit: (data: { id: string }) => void;
hostExit: () => void;
roomCreated: () => void;
roomNameGenerated: (roomId: string) => void;
joinRoomFailed: () => void;
joinRoomSuccess: (roomId: string) => void;
roomExist: () => void;
roomNotExist: () => void;
roomFull: () => void;
};
ClientToServerEvent: {
connection: (data: {
description?: RTCSessionDescription | null;
candidate?: RTCIceCandidate | null;
roomName: string;
}) => void;
generateRoomName: () => void;
createRoom: (roomId: string, password: string) => void;
joinRoom: (roomId: string, password: string) => void;
checkRoomExist: (roomName: string) => void;
};
InterServerEvents: {};
SocketData: {};
}
5 changes: 0 additions & 5 deletions backend/Dockerfile.nginx
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,4 @@ FROM nginx:1.18.0

COPY config/nginx/default.conf /etc/nginx/conf.d/default.conf

COPY config/nginx/ssl/options-ssl-nginx.conf /etc/letsencrypt/options-ssl-nginx.conf
COPY config/nginx/ssl/fullchain.pem /etc/letsencrypt/live/was.tarotmilktea.com/fullchain.pem
COPY config/nginx/ssl/privkey.pem /etc/letsencrypt/live/was.tarotmilktea.com/privkey.pem
COPY config/nginx/ssl/ssl-dhparams.pem /etc/letsencrypt/ssl-dhparams.pem

CMD ["nginx", "-g", "daemon off;"]
12 changes: 2 additions & 10 deletions backend/compose.blue-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,21 +49,13 @@ services:
depends_on:
- was-blue
- signal-blue
- certbot
volumes:
- /var/www/certbot:/var/www/certbot
- /etc/letsencrypt:/etc/letsencrypt
- /var/log/nginx:/var/log/nginx
networks:
- backend

certbot:
image: certbot/certbot
volumes:
- /etc/letsencrypt
- /var/www/html:/var/www/html
networks:
- backend
command: certonly --webroot --webroot-path=/var/www/html -d was.tarotmilktea.com

networks:
backend:
external: true
Expand Down
12 changes: 2 additions & 10 deletions backend/compose.green-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,21 +49,13 @@ services:
depends_on:
- was-green
- signal-green
- certbot
volumes:
- /var/www/certbot:/var/www/certbot
- /etc/letsencrypt:/etc/letsencrypt
- /var/log/nginx:/var/log/nginx
networks:
- backend

certbot:
image: certbot/certbot
volumes:
- /etc/letsencrypt
- /var/www/html:/var/www/html
networks:
- backend
command: certonly --webroot --webroot-path=/var/www/html -d was.tarotmilktea.com

networks:
backend:
external: true
Expand Down
6 changes: 0 additions & 6 deletions backend/signal/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion backend/signal/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@
"@nestjs/platform-express": "^10.0.0",
"@nestjs/platform-socket.io": "^10.2.10",
"@nestjs/websockets": "^10.2.10",
"@tarotmilktea/human-socketio-event": "^2.0.2",
"reflect-metadata": "^0.1.13",
"rxjs": "^7.8.1",
"socket.io": "^4.7.2",
Expand Down
39 changes: 17 additions & 22 deletions backend/signal/src/events/events.gateway.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -202,32 +202,27 @@ describe('EventsGateway', () => {
});
});

describe('signal 이벤트 (offer, answer, candidate) on', () => {
it('offer 이벤트: 방에 offer이벤트에 받은 sdp 보냄', () => {
gateway.handleOfferEvent(hostSocket, ['sdp' as any, roomMock.roomId]);

expectEmitToRoom(hostSocket, roomMock.roomId, 'offer', 'sdp');
expect(loggerService.debug).toHaveBeenCalledWith(
`🚀 Offer Received from ${hostSocket.id}`,
);
});

it('answer 이벤트: 방에 answer이벤트에 받은 sdp 보냄', () => {
gateway.handleAnswerEvent(guestSocket, ['sdp' as any, roomMock.roomId]);
describe('connection 이벤트 (offer, answer, candidate) ', () => {
it('description(offer, answer)이 있을 때: 방에 description 보냄', () => {
gateway.handleConnectionEvent(hostSocket, {
description: 'description' as any,
roomName: roomMock.roomId,
});

expectEmitToRoom(guestSocket, roomMock.roomId, 'answer', 'sdp');
expect(loggerService.debug).toHaveBeenCalledWith(
`🚀 Answer Received from ${guestSocket.id}`,
);
expectEmitToRoom(hostSocket, roomMock.roomId, 'connection', {
description: 'description',
});
});

it('candidate 이벤트: 방에 candidate이벤트에 받은 candidate 보냄', () => {
gateway.handleCandidateEvent(guestSocket, ['candidate' as any, 'roomId']);
it('candidate가 있을 때: 방에 candidate 보냄', () => {
gateway.handleConnectionEvent(hostSocket, {
candidate: 'candidate' as any,
roomName: roomMock.roomId,
});

expectEmitToRoom(guestSocket, 'roomId', 'candidate', 'candidate');
expect(loggerService.debug).toHaveBeenCalledWith(
`🚀 Candidate Received from ${guestSocket.id}`,
);
expectEmitToRoom(hostSocket, roomMock.roomId, 'connection', {
candidate: 'candidate',
});
});
});

Expand Down
Loading

0 comments on commit d19d03f

Please sign in to comment.