Skip to content

Commit

Permalink
Merge pull request #1060 from woowacourse-teams/BE/test2
Browse files Browse the repository at this point in the history
[ALL] 충돌 해결 테스트
  • Loading branch information
yechop authored Jan 22, 2025
2 parents 003c433 + ac4ea09 commit 861f546
Show file tree
Hide file tree
Showing 475 changed files with 1,360 additions and 26,580 deletions.
50 changes: 36 additions & 14 deletions .github/workflows/be_cd-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ jobs:

- name: Image build and push
run: |
docker build --build-arg PROFILE=test --build-arg DEPENDENCY=build/dependency -t ${{ secrets.DOCKER_REPO_NAME }}/springboot-app:test-latest --platform linux/arm64 .
docker build --build-arg PROFILE=test --build-arg DEPENDENCY=build/dependency -t ${{ secrets.DOCKER_REPO_NAME }}/springboot-app:test-latest --platform linux/amd64 .
docker push ${{ secrets.DOCKER_REPO_NAME }}/springboot-app:test-latest
- name: Upload docker-compose yaml script to artifact
Expand All @@ -51,8 +51,11 @@ jobs:

deploy:
environment: test
runs-on: test-ec2-runner
runs-on: ${{ matrix.instance }}
needs: build
strategy:
matrix:
instance: [ "test-ec2-runner-a", "test-ec2-runner-b" ]
defaults:
run:
working-directory: ./backend
Expand All @@ -67,13 +70,23 @@ jobs:
run: |
sudo mv be_app-docker-compose.yml ${{ secrets.DOCKER_COMPOSE_YAML_PATH }}/
- name: Extract secrets as .be_app-env file
- name: Run deploy script
run: |
chmod +x ./deploy.sh
source ./deploy.sh
echo "BLUE_PORT=$BLUE_PORT" >> $GITHUB_ENV
echo "GREEN_PORT=$GREEN_PORT" >> $GITHUB_ENV
- name: Extract secrets as .be_app-env file
run: |
if [ "${{ matrix.instance }}" = "test-ec2-runner-a" ]; then
INSTANCE_NAME=${{ secrets.INSTANCE_A_NAME }}
elif [ "${{ matrix.instance }}" = "test-ec2-runner-b" ]; then
INSTANCE_NAME=${{ secrets.INSTANCE_B_NAME }}
else
echo "Unknown instance: ${{ matrix.instance }}"
exit 1
fi
cat <<EOF > ${{ secrets.DOCKER_COMPOSE_YAML_PATH }}/.be_app-env
Expand All @@ -82,41 +95,50 @@ jobs:
DOCKER_IMAGE_VERSION=test-latest
# DB Configuration secrets info from Github Secrets
MASTER_DB_URL=${{ secrets.TEST_SERVER_DB_URL }}
MYSQL_TIME_ZONE=${{ secrets.MYSQL_TIME_ZONE }}
DB_BINDING_PORT=${{ secrets.DB_BINDING_PORT }}
MASTER_DB_URL=${{ secrets.TEST_SERVER_MASTER_DB_URL }}
MASTER_DB_USERNAME=${{ secrets.TEST_SERVER_DB_USERNAME }}
MASTER_DB_PASSWORD=${{ secrets.TEST_SERVER_DB_PASSWORD }}
SLAVE_DB_URL=${{ secrets.TEST_SERVER_DB_URL }}
SLAVE_DB_URL=${{ secrets.TEST_SERVER_SLAVE_DB_URL }}
SLAVE_DB_USERNAME=${{ secrets.TEST_SERVER_DB_USERNAME }}
SLAVE_DB_PASSWORD=${{ secrets.TEST_SERVER_DB_PASSWORD }}
DDL_AUTO=${{ secrets.DDL_AUTO }}
DDL_AUTO=${{ secrets.TEST_DDL_AUTO }}
# OAUTH & JWT
CLIENT_ID=${{ secrets.TEST_CLIENT_ID }}
CLIENT_SECRET=${{ secrets.TEST_CLIENT_SECRET }}
CLIENT_REDIRECT_URI=${{ secrets.TEST_CLIENT_REDIRECT_URI }}
JWT_KEY=${{ secrets.JWT_KEY}}
# Sticky Synchronize
INSTANCE_NAME=${{ secrets.INSTANCE_A_NAME }}
# INSTANCE NAME
INSTANCE_NAME=$INSTANCE_NAME
# Server App
BLUE_SERVER_BINDING_PORT=${BLUE_PORT}
GREEN_SERVER_BINDING_PORT=${GREEN_PORT}
SERVER_LOGS_PATH=${{ secrets.SERVER_LOGS_PATH }}
EOF
- name: remove old spring-app image
run: |
sudo docker image rm -f coduo2024/springboot-app:test-latest;
sudo docker image rm -f ${{ secrets.DOCKER_REPO_NAME }}/springboot-app:test-latest;
- name: Start the new (green/blue) environment
run: |
sudo docker-compose --env-file ${{ secrets.DOCKER_COMPOSE_YAML_PATH }}/.be_app-env -f ${{ secrets.DOCKER_COMPOSE_YAML_PATH }}/be_app-docker-compose.yml -p $GREEN_PORT up -d
- name: Wait for new environment to be healthy
run: |
until curl -sf http://localhost:${GREEN_PORT}/api/actuator/health | grep "UP"; do sleep 5; done
timeout=30
while ! curl -sf http://localhost:${GREEN_PORT}/api/actuator/health | grep "UP"; do
((timeout--))
if [ $timeout -le 0 ]; then
echo "Health check timed out" >&2
exit 1
fi
sleep 5
done
- name: Reload NGINX
run: |
Expand All @@ -128,4 +150,4 @@ jobs:
- name: Delete Dangling docker images
run: |
sudo docker image prune
sudo docker image prune -a -f
33 changes: 33 additions & 0 deletions .github/workflows/be_review_request.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: review_request

on:
pull_request:
branches: [ "BE/dev", "BE/test", "production" ]
workflow_dispatch:

jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Extract receiver list
id: extract_receiver_list
uses: actions/[email protected]
with:
script: |
const excludeMember = context.payload.pull_request.user.login;
const members = JSON.parse(${{secrets.DISCORD_BE}});
const requester = members.find(entry => entry.github === excludeMember);
let outputString = '';
for (const member of members) {
if ((member.github !== excludeMember)) {
outputString += `<@${member.discord}> `;
}
}
console.log(`::set-output name=names::${outputString.trim()}`);
console.log(`::set-output name=requester::${requester.name}`);
- name: Discord Message
uses: discord-actions/message@v2
with:
webhookUrl: https://discord.com/api/webhooks/1326090386669572127/_ccJi99YPqQGq-es7-52RVHDzvbKOUz4fD9B-k8sCN1OKtDGOfcX5bPBbijS-lfjsn5-
message: "👑${{steps.extract_receiver_list.outputs.requester}}👑 PR이 도착했습니다. \n↓↓↓\n\n⚡⚡⚡⚡⚡⚡⚡⚡⚡\n*⚡[${{steps.extract_receiver_list.outputs.requester}}](${{github.event.pull_request.html_url}}) 혼구멍 내러가기~>⚡* \n⚡⚡⚡⚡⚡⚡⚡⚡⚡\n\n _혼내줄 사람들: ${{steps.extract_receiver_list.outputs.names}}_ \n"
92 changes: 0 additions & 92 deletions .github/workflows/pull_request.yml

This file was deleted.

15 changes: 0 additions & 15 deletions .vscode/settings.json

This file was deleted.

3 changes: 3 additions & 0 deletions backend/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,9 @@ dependencies {
implementation 'io.jsonwebtoken:jjwt:0.12.6'
implementation 'io.jsonwebtoken:jjwt-impl:0.12.6'

// Web Socket
implementation 'org.springframework.boot:spring-boot-starter-websocket'

// Test
testImplementation 'org.springframework.boot:spring-boot-starter-test'
testRuntimeOnly 'org.junit.platform:junit-platform-launcher'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,9 @@ public void addCorsMappings(final CorsRegistry registry) {
registry.addMapping("/**")
.allowedMethods("GET", "POST", "PUT", "DELETE", "OPTIONS", "PATCH", "HEAD")
.allowedOrigins("http://localhost:3000", "https://coduo.site", "https://test.coduo.site",
"https://api-test.coduo.site", "https://api.coduo.site")
"https://api-test.coduo.site", "https://api.coduo.site",
"ws://test.coduo.site", "wss://test.coduo.site",
"ws://api-test.coduo.site", "wss://api-test.coduo.site")
.allowCredentials(true);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,22 +2,20 @@

import com.fasterxml.jackson.annotation.JsonProperty;

import site.coduo.member.domain.Member;
import site.coduo.member.domain.repository.MemberEntity;
import site.coduo.member.infrastructure.http.Bearer;

public record GithubUserResponse(@JsonProperty(value = "id") String userId,
@JsonProperty(value = "login") String longin,
@JsonProperty(value = "avatar_url") String avatarUrl
) {

public Member toDomain(final Bearer accessToken, final String username) {
return Member.builder()
.profileImage(avatarUrl)
.userId(userId)
.loginId(longin)
public MemberEntity toDomain(final Bearer accessToken, final String username) {
return MemberEntity.builder()
.providerUserId(userId)
.providerLoginId(longin)
.username(username)
.accessToken(accessToken.getCredential())
.providerAccessToken(accessToken.getCredential())
.build();
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

import lombok.RequiredArgsConstructor;
import site.coduo.member.controller.docs.MemberControllerDocs;
import site.coduo.member.domain.Member;
import site.coduo.member.domain.repository.MemberEntity;
import site.coduo.member.service.MemberService;
import site.coduo.member.service.dto.member.MemberNameResponse;
import site.coduo.member.service.dto.member.MemberReadResponse;
Expand All @@ -35,8 +35,8 @@ public ResponseEntity<MemberNameResponse> existsMember(
@RequestParam("user_id") String userId
) {

final Member member = memberService.checkAndFindMember(token, userId);
final MemberNameResponse response = new MemberNameResponse(member.getUsername());
final MemberEntity memberEntity = memberService.checkAndFindMember(token, userId);
final MemberNameResponse response = new MemberNameResponse(memberEntity.getUsername());

return ResponseEntity.ok(response);
}
Expand Down
Loading

0 comments on commit 861f546

Please sign in to comment.