-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #29 from YAPP-Github/feature/PC-268-matching-algor…
…ithm [PC-268] Greedy 매칭 알고리즘 구현
- Loading branch information
Showing
37 changed files
with
999 additions
and
103 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
name: CI/CD using github actions & docker | ||
|
||
on: | ||
push: | ||
branches: [ "main", "develope" ] | ||
|
||
permissions: | ||
contents: read | ||
|
||
jobs: | ||
CI-CD: | ||
runs-on: ubuntu-latest | ||
steps: | ||
|
||
- uses: actions/checkout@v3 | ||
- name: Set up JDK 17 | ||
uses: actions/setup-java@v3 | ||
with: | ||
java-version: '17' | ||
distribution: 'temurin' | ||
|
||
- name: Gradle Caching | ||
uses: actions/cache@v3 | ||
with: | ||
path: | | ||
~/.gradle/caches | ||
~/.gradle/wrapper | ||
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }} | ||
restore-keys: | | ||
${{ runner.os }}-gradle- | ||
# secret yml 파일 생성 | ||
- name: make application-secret.yml | ||
if: | | ||
contains(github.ref, 'main') || | ||
contains(github.ref, 'develope') | ||
run: | | ||
cd ./api/src/main/resources | ||
touch ./application-secret.yml | ||
echo "${{ secrets.YML }}" > ./application-secret.yml | ||
shell: bash | ||
|
||
# gradle build | ||
- name: Build with Gradle | ||
run: ./gradlew build -x test | ||
|
||
# docker build & push to develop | ||
- name: Docker build & push to dev | ||
if: contains(github.ref, 'develope') | ||
run: | | ||
docker login -u ${{ secrets.DOCKER_USERNAME }} -p ${{ secrets.DOCKER_PASSWORD }} | ||
docker build -f Dockerfile-dev -t ${{ secrets.DOCKER_USERNAME }}/docker-test-dev . | ||
docker push ${{ secrets.DOCKER_USERNAME }}/docker-test-dev | ||
## deploy to develop | ||
- name: Deploy to dev | ||
uses: appleboy/ssh-action@master | ||
id: deploy-dev | ||
if: contains(github.ref, 'develope') | ||
with: | ||
host: ${{ secrets.HOST_DEV }} | ||
username: ${{ secrets.USERNAME }} | ||
password: ${{ secrets.PASSWORD }} | ||
port: 22 | ||
key: ${{ secrets.PRIVATE_KEY }} | ||
script: | | ||
sudo docker ps | ||
sudo docker pull ${{ secrets.DOCKER_USERNAME }}/docker-test-dev | ||
sudo docker run -d -p 8080:8080 --add-host=localhost:host-gateway ${{ secrets.DOCKER_USERNAME }}/docker-test-dev | ||
sudo docker image prune -f |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
name: PR Test | ||
|
||
on: | ||
pull_request: | ||
branches: [ "develope" ] | ||
|
||
jobs: | ||
test: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
|
||
- name: Set up JDK 17 | ||
uses: actions/setup-java@v1 | ||
with: | ||
java-version: 17 | ||
|
||
- name: Cache Gradle packages | ||
uses: actions/cache@v2 | ||
with: | ||
path: | | ||
~/.gradle/caches | ||
~/.gradle/wrapper | ||
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }} | ||
restore-keys: | | ||
${{ runner.os }}-gradle- | ||
- name: Grant execute permission for gradlew | ||
run: chmod +x gradlew | ||
|
||
- name: Test with Gradle | ||
run: ./gradlew --info test | ||
|
||
- name: Publish Unit Test Results | ||
uses: EnricoMi/publish-unit-test-result-action@v1 | ||
if: ${{ always() }} | ||
with: | ||
files: build/reports/test-results/**/*.xml | ||
|
||
- name: Cleanup Gradle Cache | ||
# Remove some files from the Gradle cache, so they aren't cached by GitHub Actions. | ||
# Restoring these files from a GitHub Actions cache might cause problems for future builds. | ||
run: | | ||
rm -f ~/.gradle/caches/modules-2/modules-2.lock | ||
rm -f ~/.gradle/caches/modules-2/gc.properties |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
FROM eclipse-temurin:17-jdk | ||
|
||
ARG JAR_FILE=admin/build/libs/*.jar | ||
|
||
COPY ${JAR_FILE} app.jar | ||
|
||
ENTRYPOINT ["java", "-jar", "/app.jar"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
FROM eclipse-temurin:17-jdk | ||
|
||
ARG JAR_FILE=api/build/libs/*.jar | ||
|
||
COPY ${JAR_FILE} app.jar | ||
|
||
ENTRYPOINT ["java", "-jar", "/app.jar"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
26 changes: 26 additions & 0 deletions
26
api/src/main/java/org/yapp/domain/block/application/DirectBlockService.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
package org.yapp.domain.block.application; | ||
|
||
import lombok.RequiredArgsConstructor; | ||
import org.springframework.stereotype.Service; | ||
import org.yapp.application.AuthenticationService; | ||
import org.yapp.domain.block.DirectBlock; | ||
import org.yapp.domain.block.dao.DirectBlockRepository; | ||
|
||
@Service | ||
@RequiredArgsConstructor | ||
public class DirectBlockService { | ||
|
||
private final DirectBlockRepository directBlockRepository; | ||
private final AuthenticationService authenticationService; | ||
|
||
public DirectBlock blockUser(Long blockId) { | ||
Long userId = authenticationService.getUserId(); | ||
return directBlockRepository.save(new DirectBlock(userId, blockId)); | ||
} | ||
|
||
public boolean checkBlock(Long userId, Long partnerId) { | ||
return directBlockRepository.existsDirectBlockByBlockingUserIdAndBlockedUserId(userId, | ||
partnerId); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
10 changes: 10 additions & 0 deletions
10
api/src/main/java/org/yapp/domain/block/dao/DirectBlockRepository.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
package org.yapp.domain.block.dao; | ||
|
||
import org.springframework.data.jpa.repository.JpaRepository; | ||
import org.yapp.domain.block.DirectBlock; | ||
|
||
public interface DirectBlockRepository extends JpaRepository<DirectBlock, Long> { | ||
|
||
boolean existsDirectBlockByBlockingUserIdAndBlockedUserId(Long blockingUserId, | ||
Long blockedUserId); | ||
} |
Oops, something went wrong.