diff --git a/.github/workflows/api-gate-deploy.yml b/.github/workflows/api-gate-deploy.yml index 66fe7b39..cca72f5a 100644 --- a/.github/workflows/api-gate-deploy.yml +++ b/.github/workflows/api-gate-deploy.yml @@ -1,103 +1,103 @@ -name: Gateway-Deploy - -on: - pull_request: - branches: - - deploy - types: - - closed - paths: - - "gateway/**" - -# push: -# branches: [WB-115-api-server] # master branch에 PR을 보낼 때 실행 - -jobs: - deploy: - runs-on: ubuntu-latest - - # services: - # redis: - # image: redis:6.x - # ports: - # - 6379:6379 - steps: - - - name: Checkout code - uses: actions/checkout@v3 - - - name: Check if the pull request was merged - id: check_pr_merged - run: | - # Check if the PR was merged - if [[ "${{ github.event.pull_request.merged }}" == "true" ]]; then - echo "pr_merged=true" >> $GITHUB_ENV - else - echo "pr_merged=false" >> $GITHUB_ENV - fi - - - name: Run some action if the PR was merged - if: env.pr_merged == 'true' - run: | - echo "The pull request was merged. Running additional actions..." - - - uses: actions/checkout@v2 - - - name: Set up JDK 17 - uses: actions/setup-java@v1 - with: - java-version: 17 - - - name: 💾 Cache Gradle & Spring - uses: actions/cache@v3 - with: - path: | - ~/.gradle/caches - ~/.gradle/wrapper - key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }} - restore-keys: | - ${{ runner.os }}-gradle- - - - name: Set YML - run: | - cd gateway - ls -l - mkdir -p src/main/resources - echo "${{ secrets.SSL_KEYSTORE }}" | base64 --decode > src/main/resources/keystore.p12 - find src - - # Gradle wrapper 파일 실행 권한주기 - - name: Grant execute permission for gradlew - run: chmod +x gradlew - - - name: 🔧 Build Spring server - run: | - chmod +x ./gradlew - ./gradlew clean gateway:build - - - name: Docker build - run: | - cd /home/runner/work/Team5-WatermelonClap-BE/Team5-WatermelonClap-BE/gateway - docker login -u ${{secrets.DOCKER_USERNAME}} -p ${{secrets.DOCKER_PASSWORD}} - docker build --no-cache --platform linux/arm64 -t app . - - docker tag app ${{secrets.DOCKER_USERNAME}}/watermelon-api-gateway:latest - docker push ${{secrets.DOCKER_USERNAME}}/watermelon-api-gateway:latest - - - - name: deploy in aws - uses: appleboy/ssh-action@master - with: - key: ${{secrets.SSH_KEY}} - host: ${{secrets.GATEWAY_SSH_HOST}} - username: ${{secrets.SSH_USER}} - script: | - docker pull ${{ secrets.DOCKER_USERNAME }}/watermelon-api-gateway:latest - docker tag ${{ secrets.DOCKER_USERNAME }}/watermelon-api-gateway:latest watermelon-api-gateway:latest - docker stop $(docker ps -a -q) - docker run -i -d --log-driver=awslogs --log-opt awslogs-region=ap-northeast-2 --log-opt awslogs-group=watermelon-cloudwatch --log-opt awslogs-stream=watermelon-gateway -p 8080:8080 watermelon-api-gateway:latest - docker rm $(docker ps --filter 'status=exited' -a -q) - # 실행 중이지 않으 모든 컨테인 삭제 - docker image prune -a -f - # 사용하지않은 모든 이미지 삭제 - +#name: Gateway-Deploy +# +#on: +# pull_request: +# branches: +# - deploy +# types: +# - closed +# paths: +# - "gateway/**" +# +## push: +## branches: [WB-115-api-server] # master branch에 PR을 보낼 때 실행 +# +#jobs: +# deploy: +# runs-on: ubuntu-latest +# +# # services: +# # redis: +# # image: redis:6.x +# # ports: +# # - 6379:6379 +# steps: +# +# - name: Checkout code +# uses: actions/checkout@v3 +# +# - name: Check if the pull request was merged +# id: check_pr_merged +# run: | +# # Check if the PR was merged +# if [[ "${{ github.event.pull_request.merged }}" == "true" ]]; then +# echo "pr_merged=true" >> $GITHUB_ENV +# else +# echo "pr_merged=false" >> $GITHUB_ENV +# fi +# +# - name: Run some action if the PR was merged +# if: env.pr_merged == 'true' +# run: | +# echo "The pull request was merged. Running additional actions..." +# +# - uses: actions/checkout@v2 +# +# - name: Set up JDK 17 +# uses: actions/setup-java@v1 +# with: +# java-version: 17 +# +# - name: 💾 Cache Gradle & Spring +# uses: actions/cache@v3 +# with: +# path: | +# ~/.gradle/caches +# ~/.gradle/wrapper +# key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }} +# restore-keys: | +# ${{ runner.os }}-gradle- +# +# - name: Set YML +# run: | +# cd gateway +# ls -l +# mkdir -p src/main/resources +# echo "${{ secrets.SSL_KEYSTORE }}" | base64 --decode > src/main/resources/keystore.p12 +# find src +# +# # Gradle wrapper 파일 실행 권한주기 +# - name: Grant execute permission for gradlew +# run: chmod +x gradlew +# +# - name: 🔧 Build Spring server +# run: | +# chmod +x ./gradlew +# ./gradlew clean gateway:build +# +# - name: Docker build +# run: | +# cd /home/runner/work/Team5-WatermelonClap-BE/Team5-WatermelonClap-BE/gateway +# docker login -u ${{secrets.DOCKER_USERNAME}} -p ${{secrets.DOCKER_PASSWORD}} +# docker build --no-cache --platform linux/arm64 -t app . +# +# docker tag app ${{secrets.DOCKER_USERNAME}}/watermelon-api-gateway:latest +# docker push ${{secrets.DOCKER_USERNAME}}/watermelon-api-gateway:latest +# +# +# - name: deploy in aws +# uses: appleboy/ssh-action@master +# with: +# key: ${{secrets.SSH_KEY}} +# host: ${{secrets.GATEWAY_SSH_HOST}} +# username: ${{secrets.SSH_USER}} +# script: | +# docker pull ${{ secrets.DOCKER_USERNAME }}/watermelon-api-gateway:latest +# docker tag ${{ secrets.DOCKER_USERNAME }}/watermelon-api-gateway:latest watermelon-api-gateway:latest +# docker stop $(docker ps -a -q) +# docker run -i -d --log-driver=awslogs --log-opt awslogs-region=ap-northeast-2 --log-opt awslogs-group=watermelon-cloudwatch --log-opt awslogs-stream=watermelon-gateway -p 8080:8080 watermelon-api-gateway:latest +# docker rm $(docker ps --filter 'status=exited' -a -q) +# # 실행 중이지 않으 모든 컨테인 삭제 +# docker image prune -a -f +# # 사용하지않은 모든 이미지 삭제 +# diff --git a/.github/workflows/api-lottery-ci.yml b/.github/workflows/api-lottery-ci.yml index 9410aafc..73164d9a 100644 --- a/.github/workflows/api-lottery-ci.yml +++ b/.github/workflows/api-lottery-ci.yml @@ -1,90 +1,90 @@ -name: Lottery-Test - -on: - pull_request: - branches: [dev] # master branch에 PR을 보낼 때 실행 - paths: - - "lottery/**" - - "common/**" - -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 & Spring - uses: actions/cache@v3 - with: - path: | - ~/.gradle/caches - ~/.gradle/wrapper - key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }} - restore-keys: | - ${{ runner.os }}-gradle- - - - name: Set YML - run: | - cd common - ls -l - mkdir -p src/main/resources - echo "${{ secrets.APPLICATION_LOCAL}}" | base64 --decode > src/main/resources/application-local.yml - echo "${{ secrets.APPLICATION_LOCAL_DB }}" | base64 --decode > src/main/resources/application-local-db.yml - echo "${{ secrets.APPLICATION_LOCAL_TOKEN }}" | base64 --decode > src/main/resources/application-local-token.yml - - echo "${{ secrets.DEPLOY }}" | base64 --decode > src/main/resources/application-deploy.yml - echo "${{ secrets.DEPLOY_DB }}" | base64 --decode > src/main/resources/application-deploy-db.yml - echo "${{ secrets.DEPLOY_JWT_TOKEN }}" | base64 --decode > src/main/resources/application-deploy-token.yml - echo "${{ secrets.FIREBASE }}" | base64 --decode > src/main/resources/firebase.json - find src - cd .. - - # Gradle wrapper 파일 실행 권한주기 - - name: Grant execute permission for gradlew - run: chmod +x gradlew - - # 테스트 수행 - - name: Test - run: | - ./gradlew --info lottery:test - - - name: List files to be uploaded - run: | - echo "Files in lottery/build/generated-snippets/:" - ls -la lottery/build/generated-snippets/ - - # 스웨거 소스 업로드 - - name: Configure AWS credentials - uses: aws-actions/configure-aws-credentials@v3 - with: - aws-access-key-id: ${{ secrets.AWS_S3_ACCESS_KEY_ID }} - aws-secret-access-key: ${{ secrets.AWS_S3_SECRET_ACCESS_KEY }} - aws-region: 'ap-northeast-2' - - - name: Upload files to S3 - run: | - aws s3 cp lottery/build/generated-snippets/ s3://watermelon-s3-bucket/snippets/ --recursive - - # 테스트 후 Result를 보기위해 Publish Unit Test Results step 추가 - - name: Publish Unit Test Results - uses: EnricoMi/publish-unit-test-result-action@v1 - if: ${{ always() }} # 테스트가 실패하여도 Report를 보기 위해 `always`로 설정 - continue-on-error: true # 이 단계가 실패해도 다음 단계로 넘어감 - with: - files: lottery/build/test-results/**/*.xml - - - name: JaCoCo Report - uses: Madrapps/jacoco-report@v1.6.1 - continue-on-error: true # 이 단계가 실패해도 다음 단계로 넘어감 - with: - paths: lottery/build/reports/jacoco/test/jacocoTestReport.xml - token: ${{ secrets.GITHUB_TOKEN }} - title: "테스트 커버리지 측정" - min-coverage-overall: 70 - min-coverage-changed-files: 50 \ No newline at end of file +#name: Lottery-Test +# +#on: +# pull_request: +# branches: [dev] # master branch에 PR을 보낼 때 실행 +# paths: +# - "lottery/**" +# - "common/**" +# +#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 & Spring +# uses: actions/cache@v3 +# with: +# path: | +# ~/.gradle/caches +# ~/.gradle/wrapper +# key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }} +# restore-keys: | +# ${{ runner.os }}-gradle- +# +# - name: Set YML +# run: | +# cd common +# ls -l +# mkdir -p src/main/resources +# echo "${{ secrets.APPLICATION_LOCAL}}" | base64 --decode > src/main/resources/application-local.yml +# echo "${{ secrets.APPLICATION_LOCAL_DB }}" | base64 --decode > src/main/resources/application-local-db.yml +# echo "${{ secrets.APPLICATION_LOCAL_TOKEN }}" | base64 --decode > src/main/resources/application-local-token.yml +# +# echo "${{ secrets.DEPLOY }}" | base64 --decode > src/main/resources/application-deploy.yml +# echo "${{ secrets.DEPLOY_DB }}" | base64 --decode > src/main/resources/application-deploy-db.yml +# echo "${{ secrets.DEPLOY_JWT_TOKEN }}" | base64 --decode > src/main/resources/application-deploy-token.yml +# echo "${{ secrets.FIREBASE }}" | base64 --decode > src/main/resources/firebase.json +# find src +# cd .. +# +# # Gradle wrapper 파일 실행 권한주기 +# - name: Grant execute permission for gradlew +# run: chmod +x gradlew +# +# # 테스트 수행 +# - name: Test +# run: | +# ./gradlew --info lottery:test +# +# - name: List files to be uploaded +# run: | +# echo "Files in lottery/build/generated-snippets/:" +# ls -la lottery/build/generated-snippets/ +# +# # 스웨거 소스 업로드 +# - name: Configure AWS credentials +# uses: aws-actions/configure-aws-credentials@v3 +# with: +# aws-access-key-id: ${{ secrets.AWS_S3_ACCESS_KEY_ID }} +# aws-secret-access-key: ${{ secrets.AWS_S3_SECRET_ACCESS_KEY }} +# aws-region: 'ap-northeast-2' +# +# - name: Upload files to S3 +# run: | +# aws s3 cp lottery/build/generated-snippets/ s3://watermelon-s3-bucket/snippets/ --recursive +# +# # 테스트 후 Result를 보기위해 Publish Unit Test Results step 추가 +# - name: Publish Unit Test Results +# uses: EnricoMi/publish-unit-test-result-action@v1 +# if: ${{ always() }} # 테스트가 실패하여도 Report를 보기 위해 `always`로 설정 +# continue-on-error: true # 이 단계가 실패해도 다음 단계로 넘어감 +# with: +# files: lottery/build/test-results/**/*.xml +# +# - name: JaCoCo Report +# uses: Madrapps/jacoco-report@v1.6.1 +# continue-on-error: true # 이 단계가 실패해도 다음 단계로 넘어감 +# with: +# paths: lottery/build/reports/jacoco/test/jacocoTestReport.xml +# token: ${{ secrets.GITHUB_TOKEN }} +# title: "테스트 커버리지 측정" +# min-coverage-overall: 70 +# min-coverage-changed-files: 50 \ No newline at end of file diff --git a/.github/workflows/api-lottery-deploy.yml b/.github/workflows/api-lottery-deploy.yml index 9a2c772e..918f8476 100644 --- a/.github/workflows/api-lottery-deploy.yml +++ b/.github/workflows/api-lottery-deploy.yml @@ -1,106 +1,106 @@ -name: Lottery-Deploy - -on: - pull_request: - branches: - - deploy - types: - - closed - paths: - - "lottery/**" - - "common/**" - -jobs: - test: - runs-on: ubuntu-latest - - steps: - - name: Checkout code - uses: actions/checkout@v3 - - - name: Check if the pull request was merged - id: check_pr_merged - run: | - # Check if the PR was merged - if [[ "${{ github.event.pull_request.merged }}" == "true" ]]; then - echo "pr_merged=true" >> $GITHUB_ENV - else - echo "pr_merged=false" >> $GITHUB_ENV - fi - - - name: Run some action if the PR was merged - if: env.pr_merged == 'true' - run: | - echo "The pull request was merged. Running additional actions..." - - - uses: actions/checkout@v2 - - - name: Set up JDK 17 - uses: actions/setup-java@v1 - with: - java-version: 17 - - - name: 💾 Cache Gradle & Spring - uses: actions/cache@v3 - with: - path: | - ~/.gradle/caches - ~/.gradle/wrapper - key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }} - restore-keys: | - ${{ runner.os }}-gradle- - - - name: Set YML - run: | - cd common - ls -l - mkdir -p src/main/resources - echo "${{ secrets.APPLICATION_LOCAL}}" | base64 --decode > src/main/resources/application-local.yml - echo "${{ secrets.APPLICATION_LOCAL_DB }}" | base64 --decode > src/main/resources/application-local-db.yml - echo "${{ secrets.APPLICATION_LOCAL_TOKEN }}" | base64 --decode > src/main/resources/application-local-token.yml - - echo "${{ secrets.DEPLOY }}" | base64 --decode > src/main/resources/application-deploy.yml - echo "${{ secrets.DEPLOY_DB }}" | base64 --decode > src/main/resources/application-deploy-db.yml - echo "${{ secrets.DEPLOY_JWT_TOKEN }}" | base64 --decode > src/main/resources/application-deploy-token.yml - echo "${{ secrets.FIREBASE }}" | base64 --decode > src/main/resources/firebase.json - find src - cd .. - - # Gradle wrapper 파일 실행 권한주기 - - name: Grant execute permission for gradlew - run: chmod +x gradlew - - # 애플리케이션을 Build 한다. - - name: 🔧 Build Spring server - run: | - chmod +x ./gradlew - ./gradlew clean lottery:build - - # 도커로 빌드한다. - - name: Docker build - run: | - cd /home/runner/work/Team5-WatermelonClap-BE/Team5-WatermelonClap-BE/lottery - docker login -u ${{secrets.DOCKER_USERNAME}} -p ${{secrets.DOCKER_PASSWORD}} - docker build --no-cache --platform linux/arm64/v8 -t app . - - docker tag app ${{secrets.DOCKER_USERNAME}}/watermelon-api-lottery:latest - docker push ${{secrets.DOCKER_USERNAME}}/watermelon-api-lottery:latest - - # aws 에 업로드한다. - - name: deploy in aws - uses: appleboy/ssh-action@master - with: - key: ${{secrets.SSH_KEY}} - host: ${{secrets.SSH_API_LOTTERY_HOST}} - username: ${{secrets.SSH_USER}} - script: | - docker pull ${{ secrets.DOCKER_USERNAME }}/watermelon-api-lottery:latest - docker tag ${{ secrets.DOCKER_USERNAME }}/watermelon-api-lottery:latest watermelon-api-lottery:latest - docker stop $(docker ps -a -q) - - docker run -i -d --log-driver=awslogs --log-opt awslogs-region=ap-northeast-2 --log-opt awslogs-group=watermelon-cloudwatch --log-opt awslogs-stream=watermelon-lottery -p 8091:8091 watermelon-api-lottery:latest - - docker rm $(docker ps --filter 'status=exited' -a -q) - # 실행 중이지 않으 모든 컨테인 삭제 - docker image prune -a -f - # 사용하지않은 모든 이미지 삭제 \ No newline at end of file +#name: Lottery-Deploy +# +#on: +# pull_request: +# branches: +# - deploy +# types: +# - closed +# paths: +# - "lottery/**" +# - "common/**" +# +#jobs: +# test: +# runs-on: ubuntu-latest +# +# steps: +# - name: Checkout code +# uses: actions/checkout@v3 +# +# - name: Check if the pull request was merged +# id: check_pr_merged +# run: | +# # Check if the PR was merged +# if [[ "${{ github.event.pull_request.merged }}" == "true" ]]; then +# echo "pr_merged=true" >> $GITHUB_ENV +# else +# echo "pr_merged=false" >> $GITHUB_ENV +# fi +# +# - name: Run some action if the PR was merged +# if: env.pr_merged == 'true' +# run: | +# echo "The pull request was merged. Running additional actions..." +# +# - uses: actions/checkout@v2 +# +# - name: Set up JDK 17 +# uses: actions/setup-java@v1 +# with: +# java-version: 17 +# +# - name: 💾 Cache Gradle & Spring +# uses: actions/cache@v3 +# with: +# path: | +# ~/.gradle/caches +# ~/.gradle/wrapper +# key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }} +# restore-keys: | +# ${{ runner.os }}-gradle- +# +# - name: Set YML +# run: | +# cd common +# ls -l +# mkdir -p src/main/resources +# echo "${{ secrets.APPLICATION_LOCAL}}" | base64 --decode > src/main/resources/application-local.yml +# echo "${{ secrets.APPLICATION_LOCAL_DB }}" | base64 --decode > src/main/resources/application-local-db.yml +# echo "${{ secrets.APPLICATION_LOCAL_TOKEN }}" | base64 --decode > src/main/resources/application-local-token.yml +# +# echo "${{ secrets.DEPLOY }}" | base64 --decode > src/main/resources/application-deploy.yml +# echo "${{ secrets.DEPLOY_DB }}" | base64 --decode > src/main/resources/application-deploy-db.yml +# echo "${{ secrets.DEPLOY_JWT_TOKEN }}" | base64 --decode > src/main/resources/application-deploy-token.yml +# echo "${{ secrets.FIREBASE }}" | base64 --decode > src/main/resources/firebase.json +# find src +# cd .. +# +# # Gradle wrapper 파일 실행 권한주기 +# - name: Grant execute permission for gradlew +# run: chmod +x gradlew +# +# # 애플리케이션을 Build 한다. +# - name: 🔧 Build Spring server +# run: | +# chmod +x ./gradlew +# ./gradlew clean lottery:build +# +# # 도커로 빌드한다. +# - name: Docker build +# run: | +# cd /home/runner/work/Team5-WatermelonClap-BE/Team5-WatermelonClap-BE/lottery +# docker login -u ${{secrets.DOCKER_USERNAME}} -p ${{secrets.DOCKER_PASSWORD}} +# docker build --no-cache --platform linux/arm64/v8 -t app . +# +# docker tag app ${{secrets.DOCKER_USERNAME}}/watermelon-api-lottery:latest +# docker push ${{secrets.DOCKER_USERNAME}}/watermelon-api-lottery:latest +# +# # aws 에 업로드한다. +# - name: deploy in aws +# uses: appleboy/ssh-action@master +# with: +# key: ${{secrets.SSH_KEY}} +# host: ${{secrets.SSH_API_LOTTERY_HOST}} +# username: ${{secrets.SSH_USER}} +# script: | +# docker pull ${{ secrets.DOCKER_USERNAME }}/watermelon-api-lottery:latest +# docker tag ${{ secrets.DOCKER_USERNAME }}/watermelon-api-lottery:latest watermelon-api-lottery:latest +# docker stop $(docker ps -a -q) +# +# docker run -i -d --log-driver=awslogs --log-opt awslogs-region=ap-northeast-2 --log-opt awslogs-group=watermelon-cloudwatch --log-opt awslogs-stream=watermelon-lottery -p 8091:8091 watermelon-api-lottery:latest +# +# docker rm $(docker ps --filter 'status=exited' -a -q) +# # 실행 중이지 않으 모든 컨테인 삭제 +# docker image prune -a -f +# # 사용하지않은 모든 이미지 삭제 \ No newline at end of file diff --git a/.github/workflows/api-order-ci.yml b/.github/workflows/api-order-ci.yml index eb7b64a7..fa9edc0c 100644 --- a/.github/workflows/api-order-ci.yml +++ b/.github/workflows/api-order-ci.yml @@ -1,89 +1,89 @@ -name: Order-Test - -on: - pull_request: - branches: [dev] # master branch에 PR을 보낼 때 실행 - paths: - - "order/**" - - "common/**" - -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 & Spring - uses: actions/cache@v3 - with: - path: | - ~/.gradle/caches - ~/.gradle/wrapper - key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }} - restore-keys: | - ${{ runner.os }}-gradle- - - - name: Set YML - run: | - cd common - ls -l - mkdir -p src/main/resources - echo "${{ secrets.APPLICATION_LOCAL}}" | base64 --decode > src/main/resources/application-local.yml - echo "${{ secrets.APPLICATION_LOCAL_DB }}" | base64 --decode > src/main/resources/application-local-db.yml - echo "${{ secrets.APPLICATION_LOCAL_TOKEN }}" | base64 --decode > src/main/resources/application-local-token.yml - - echo "${{ secrets.DEPLOY }}" | base64 --decode > src/main/resources/application-deploy.yml - echo "${{ secrets.DEPLOY_DB }}" | base64 --decode > src/main/resources/application-deploy-db.yml - echo "${{ secrets.DEPLOY_JWT_TOKEN }}" | base64 --decode > src/main/resources/application-deploy-token.yml - echo "${{ secrets.FIREBASE }}" | base64 --decode > src/main/resources/firebase.json - find src - cd .. - - # Gradle wrapper 파일 실행 권한주기 - - name: Grant execute permission for gradlew - run: chmod +x gradlew - - # 테스트 후 스웨어 문서를 생성한다. - - name: Test - run: ./gradlew --info order:test - - - name: List files to be uploaded - run: | - echo "Files in order/build/generated-snippets/:" - ls -la order/build/generated-snippets/ - - # 스웨거 소스 업로드 - - name: Configure AWS credentials - uses: aws-actions/configure-aws-credentials@v3 - with: - aws-access-key-id: ${{ secrets.AWS_S3_ACCESS_KEY_ID }} - aws-secret-access-key: ${{ secrets.AWS_S3_SECRET_ACCESS_KEY }} - aws-region: 'ap-northeast-2' - - - name: Upload files to S3 - run: | - aws s3 cp order/build/generated-snippets/ s3://watermelon-s3-bucket/snippets/ --recursive - - # 테스트 후 Result를 보기위해 Publish Unit Test Results step 추가 - - name: Publish Unit Test Results - uses: EnricoMi/publish-unit-test-result-action@v1 - if: ${{ always() }} # 테스트가 실패하여도 Report를 보기 위해 `always`로 설정 - continue-on-error: true # 이 단계가 실패해도 다음 단계로 넘어감 - with: - files: order/build/test-results/**/*.xml - - - name: JaCoCo Report - uses: Madrapps/jacoco-report@v1.6.1 - continue-on-error: true # 이 단계가 실패해도 다음 단계로 넘어감 - with: - paths: order/build/reports/jacoco/test/jacocoTestReport.xml - token: ${{ secrets.GITHUB_TOKEN }} - title: "테스트 커버리지 측정" - min-coverage-overall: 70 - min-coverage-changed-files: 50 \ No newline at end of file +#name: Order-Test +# +#on: +# pull_request: +# branches: [dev] # master branch에 PR을 보낼 때 실행 +# paths: +# - "order/**" +# - "common/**" +# +#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 & Spring +# uses: actions/cache@v3 +# with: +# path: | +# ~/.gradle/caches +# ~/.gradle/wrapper +# key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }} +# restore-keys: | +# ${{ runner.os }}-gradle- +# +# - name: Set YML +# run: | +# cd common +# ls -l +# mkdir -p src/main/resources +# echo "${{ secrets.APPLICATION_LOCAL}}" | base64 --decode > src/main/resources/application-local.yml +# echo "${{ secrets.APPLICATION_LOCAL_DB }}" | base64 --decode > src/main/resources/application-local-db.yml +# echo "${{ secrets.APPLICATION_LOCAL_TOKEN }}" | base64 --decode > src/main/resources/application-local-token.yml +# +# echo "${{ secrets.DEPLOY }}" | base64 --decode > src/main/resources/application-deploy.yml +# echo "${{ secrets.DEPLOY_DB }}" | base64 --decode > src/main/resources/application-deploy-db.yml +# echo "${{ secrets.DEPLOY_JWT_TOKEN }}" | base64 --decode > src/main/resources/application-deploy-token.yml +# echo "${{ secrets.FIREBASE }}" | base64 --decode > src/main/resources/firebase.json +# find src +# cd .. +# +# # Gradle wrapper 파일 실행 권한주기 +# - name: Grant execute permission for gradlew +# run: chmod +x gradlew +# +# # 테스트 후 스웨어 문서를 생성한다. +# - name: Test +# run: ./gradlew --info order:test +# +# - name: List files to be uploaded +# run: | +# echo "Files in order/build/generated-snippets/:" +# ls -la order/build/generated-snippets/ +# +# # 스웨거 소스 업로드 +# - name: Configure AWS credentials +# uses: aws-actions/configure-aws-credentials@v3 +# with: +# aws-access-key-id: ${{ secrets.AWS_S3_ACCESS_KEY_ID }} +# aws-secret-access-key: ${{ secrets.AWS_S3_SECRET_ACCESS_KEY }} +# aws-region: 'ap-northeast-2' +# +# - name: Upload files to S3 +# run: | +# aws s3 cp order/build/generated-snippets/ s3://watermelon-s3-bucket/snippets/ --recursive +# +# # 테스트 후 Result를 보기위해 Publish Unit Test Results step 추가 +# - name: Publish Unit Test Results +# uses: EnricoMi/publish-unit-test-result-action@v1 +# if: ${{ always() }} # 테스트가 실패하여도 Report를 보기 위해 `always`로 설정 +# continue-on-error: true # 이 단계가 실패해도 다음 단계로 넘어감 +# with: +# files: order/build/test-results/**/*.xml +# +# - name: JaCoCo Report +# uses: Madrapps/jacoco-report@v1.6.1 +# continue-on-error: true # 이 단계가 실패해도 다음 단계로 넘어감 +# with: +# paths: order/build/reports/jacoco/test/jacocoTestReport.xml +# token: ${{ secrets.GITHUB_TOKEN }} +# title: "테스트 커버리지 측정" +# min-coverage-overall: 70 +# min-coverage-changed-files: 50 \ No newline at end of file diff --git a/.github/workflows/api-order-deploy.yml b/.github/workflows/api-order-deploy.yml index 9a0be67c..062e7a4d 100644 --- a/.github/workflows/api-order-deploy.yml +++ b/.github/workflows/api-order-deploy.yml @@ -3,7 +3,7 @@ name: Order-Deploy on: pull_request: branches: - - deploy + - dev types: - closed paths: @@ -18,20 +18,20 @@ jobs: - name: Checkout code uses: actions/checkout@v3 - - name: Check if the pull request was merged - id: check_pr_merged - run: | - # Check if the PR was merged - if [[ "${{ github.event.pull_request.merged }}" == "true" ]]; then - echo "pr_merged=true" >> $GITHUB_ENV - else - echo "pr_merged=false" >> $GITHUB_ENV - fi - - - name: Run some action if the PR was merged - if: env.pr_merged == 'true' - run: | - echo "The pull request was merged. Running additional actions..." +# - name: Check if the pull request was merged +# id: check_pr_merged +# run: | +# # Check if the PR was merged +# if [[ "${{ github.event.pull_request.merged }}" == "true" ]]; then +# echo "pr_merged=true" >> $GITHUB_ENV +# else +# echo "pr_merged=false" >> $GITHUB_ENV +# fi +# +# - name: Run some action if the PR was merged +# if: env.pr_merged == 'true' +# run: | +# echo "The pull request was merged. Running additional actions..." - uses: actions/checkout@v2 @@ -81,7 +81,7 @@ jobs: run: | cd /home/runner/work/Team5-WatermelonClap-BE/Team5-WatermelonClap-BE/order docker login -u ${{secrets.DOCKER_USERNAME}} -p ${{secrets.DOCKER_PASSWORD}} - docker build --no-cache --platform linux/arm64/v8 -t app . + docker build --no-cache --platform linux/amd64/v8 -t app . docker tag app ${{secrets.DOCKER_USERNAME}}/watermelon-api-order:latest docker push ${{secrets.DOCKER_USERNAME}}/watermelon-api-order:latest @@ -92,14 +92,15 @@ jobs: with: key: ${{secrets.SSH_KEY}} host: ${{secrets.SSH_API_ORDER_HOST}} + password: ${{secrets.SSH_API_ORDER_PASSWORD}} username: ${{secrets.SSH_USER}} script: | docker pull ${{ secrets.DOCKER_USERNAME }}/watermelon-api-order:latest docker tag ${{ secrets.DOCKER_USERNAME }}/watermelon-api-order:latest watermelon-api-order:latest docker stop $(docker ps -a -q) - docker run -i -d --log-driver=awslogs --log-opt awslogs-region=ap-northeast-2 --log-opt awslogs-group=watermelon-cloudwatch --log-opt awslogs-stream=watermelon-order -p 8092:8092 watermelon-api-order:latest - + docker run -i -d -p 8092:8092 watermelon-api-order:latest +# --log-driver=awslogs --log-opt awslogs-region=ap-northeast-2 --log-opt awslogs-group=watermelon-cloudwatch --log-opt awslogs-stream=watermelon-order docker rm $(docker ps --filter 'status=exited' -a -q) # 실행 중이지 않으 모든 컨테인 삭제