-
Notifications
You must be signed in to change notification settings - Fork 8
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 #196 from sdp-tech/dev/order
Dev/order
- Loading branch information
Showing
59 changed files
with
1,375 additions
and
1,930 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 |
---|---|---|
@@ -1,67 +1,67 @@ | ||
name: Check code quality, run test code | ||
|
||
on: | ||
pull_request: | ||
branches: | ||
- main | ||
types: | ||
- closed | ||
|
||
jobs: | ||
deploy: | ||
name: Deploy Docker image to ECR and Run docker image in EC2 instance | ||
if: github.event.pull_request.merged == true | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: 코드 Checkout | ||
uses: actions/checkout@v4 | ||
|
||
- name: AWS Credentials 가져오기 | ||
uses: aws-actions/configure-aws-credentials@v4 | ||
with: | ||
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} | ||
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | ||
aws-region: ${{ secrets.AWS_REGION }} | ||
|
||
- name: AWS ECR 로그인 | ||
id: login-ecr | ||
uses: aws-actions/amazon-ecr-login@v2 | ||
|
||
- name: 백엔드 도커 이미지 생성 및 배포 | ||
env: | ||
ECR_REGISTRY: ${{ steps.login-ecr.outputs.registry }} | ||
ECR_REPOSITORY: ${{ secrets.ECR_REPOSITORY_NAME }} | ||
IMAGE_TAG: ${{ github.sha }} | ||
run: | | ||
# 도커 이미지 생성 | ||
docker build -t $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG -t $ECR_REGISTRY/$ECR_REPOSITORY:latest . | ||
# ECR로 도커 이미지 PUSH | ||
docker push $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG | ||
docker push $ECR_REGISTRY/$ECR_REPOSITORY:latest | ||
- name: EC2에 배포 및 백엔드 어플리케이션 실행 | ||
uses: appleboy/ssh-action@master | ||
with: | ||
host: ${{ secrets.EC2_HOST }} | ||
username: ${{ secrets.EC2_USERNAME }} | ||
key: ${{ secrets.EC2_SSH_KEY }} | ||
script: ./deploy.sh | ||
|
||
- name: 배포 결과 확인 | ||
if: always() | ||
uses: appleboy/ssh-action@master | ||
with: | ||
host: ${{ secrets.EC2_HOST }} | ||
username: ${{ secrets.EC2_USERNAME }} | ||
key: ${{ secrets.EC2_SSH_KEY }} | ||
script: | | ||
# 컨테이너 상태 확인 | ||
if docker ps | grep -q "${{ secrets.ECR_REPOSITORY_NAME }}"; then | ||
echo "Container is running successfully" | ||
exit 0 | ||
else | ||
echo "Container is not running" | ||
exit 1 | ||
fi | ||
#name: Check code quality, run test code | ||
# | ||
#on: | ||
# pull_request: | ||
# branches: | ||
# - main | ||
# types: | ||
# - closed | ||
# | ||
#jobs: | ||
# deploy: | ||
# name: Deploy Docker image to ECR and Run docker image in EC2 instance | ||
# if: github.event.pull_request.merged == true | ||
# runs-on: ubuntu-latest | ||
# | ||
# steps: | ||
# - name: 코드 Checkout | ||
# uses: actions/checkout@v4 | ||
# | ||
# - name: AWS Credentials 가져오기 | ||
# uses: aws-actions/configure-aws-credentials@v4 | ||
# with: | ||
# aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} | ||
# aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | ||
# aws-region: ${{ secrets.AWS_REGION }} | ||
# | ||
# - name: AWS ECR 로그인 | ||
# id: login-ecr | ||
# uses: aws-actions/amazon-ecr-login@v2 | ||
# | ||
# - name: 백엔드 도커 이미지 생성 및 배포 | ||
# env: | ||
# ECR_REGISTRY: ${{ steps.login-ecr.outputs.registry }} | ||
# ECR_REPOSITORY: ${{ secrets.ECR_REPOSITORY_NAME }} | ||
# IMAGE_TAG: ${{ github.sha }} | ||
# run: | | ||
# # 도커 이미지 생성 | ||
# docker build -t $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG -t $ECR_REGISTRY/$ECR_REPOSITORY:latest . | ||
# | ||
# # ECR로 도커 이미지 PUSH | ||
# docker push $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG | ||
# docker push $ECR_REGISTRY/$ECR_REPOSITORY:latest | ||
# | ||
# - name: EC2에 배포 및 백엔드 어플리케이션 실행 | ||
# uses: appleboy/ssh-action@master | ||
# with: | ||
# host: ${{ secrets.EC2_HOST }} | ||
# username: ${{ secrets.EC2_USERNAME }} | ||
# key: ${{ secrets.EC2_SSH_KEY }} | ||
# script: ./deploy.sh | ||
# | ||
# - name: 배포 결과 확인 | ||
# if: always() | ||
# uses: appleboy/ssh-action@master | ||
# with: | ||
# host: ${{ secrets.EC2_HOST }} | ||
# username: ${{ secrets.EC2_USERNAME }} | ||
# key: ${{ secrets.EC2_SSH_KEY }} | ||
# script: | | ||
# # 컨테이너 상태 확인 | ||
# if docker ps | grep -q "${{ secrets.ECR_REPOSITORY_NAME }}"; then | ||
# echo "Container is running successfully" | ||
# exit 0 | ||
# else | ||
# echo "Container is not running" | ||
# exit 1 | ||
# fi |
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 |
---|---|---|
@@ -1,69 +1,70 @@ | ||
name: Integration Test | ||
|
||
on: | ||
pull_request: | ||
branches: | ||
- main | ||
types: | ||
- opened | ||
- reopened | ||
- synchronize | ||
|
||
jobs: | ||
test: | ||
name: Django API Test | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: 캐시 무효화 | ||
uses: actions/cache@v4 | ||
with: | ||
path: | | ||
~/.cache/pypoetry | ||
~/.cache/pip | ||
key: ${{ runner.os }}-poetry-${{ github.run_id }} | ||
restore-keys: | | ||
${{ runner.os }}-poetry- | ||
- name: 코드 Checkout | ||
uses: actions/checkout@v4 | ||
|
||
- uses: actions/setup-python@v3 | ||
with: | ||
python-version: "3.12" | ||
|
||
- name: Poetry 설치 | ||
run: | | ||
curl -sSL https://install.python-poetry.org | python3 - | ||
export PATH="$HOME/.local/bin:$PATH" | ||
- name: 의존성 설치 | ||
run: | | ||
poetry install --no-root | ||
shell: bash | ||
|
||
- name: 코드 스타일 검사 (isort) | ||
run: | | ||
poetry run isort . --check-only | ||
- name: 코드 스타일 검사 (black) | ||
run: | | ||
poetry run black . --check | ||
- name: 임시 데이터베이스 Migration | ||
env: | ||
DJANGO_SETTINGS_MODULE: "config.settings" | ||
DJANGO_DEBUG_MODE: true | ||
UPCY_SECRET_KEY: "test123123123123123123123" # 진짜 SECRET 키 아닙니다. | ||
run: | | ||
poetry run python manage.py migrate | ||
- name: Django 테스트 실행 | ||
env: | ||
DJANGO_SETTINGS_MODULE: "config.settings" | ||
DJANGO_DEBUG_MODE: true | ||
UPCY_SECRET_KEY: "test123123123123123123123" # 진짜 SECRET 키 아닙니다. | ||
run: | | ||
poetry run python manage.py test users.tests.user_tests # User 모듈 테스트 실행 | ||
poetry run python manage.py test users.tests.reformer_tests # Reformer 모듈 테스트 실행 | ||
poetry run python manage.py test # 그 이외 모듈 테스트 실행 | ||
#name: Integration Test | ||
# | ||
#on: | ||
# pull_request: | ||
# branches: | ||
# - main | ||
# types: | ||
# - opened | ||
# - reopened | ||
# - synchronize | ||
# | ||
#jobs: | ||
# test: | ||
# name: Django API Test | ||
# runs-on: ubuntu-latest | ||
# | ||
# steps: | ||
# - name: 캐시 무효화 | ||
# uses: actions/cache@v4 | ||
# with: | ||
# path: | | ||
# ~/.cache/pypoetry | ||
# ~/.cache/pip | ||
# key: ${{ runner.os }}-poetry-${{ github.run_id }} | ||
# restore-keys: | | ||
# ${{ runner.os }}-poetry- | ||
# | ||
# - name: 코드 Checkout | ||
# uses: actions/checkout@v4 | ||
# | ||
# - uses: actions/setup-python@v3 | ||
# with: | ||
# python-version: "3.12" | ||
# | ||
# - name: Poetry 설치 | ||
# run: | | ||
# curl -sSL https://install.python-poetry.org | python3 - | ||
# export PATH="$HOME/.local/bin:$PATH" | ||
# | ||
# - name: 의존성 설치 | ||
# run: | | ||
# poetry install --no-root | ||
# shell: bash | ||
# | ||
# - name: 코드 스타일 검사 (isort) | ||
# run: | | ||
# poetry run isort . --check-only | ||
# | ||
# - name: 코드 스타일 검사 (black) | ||
# run: | | ||
# poetry run black . --check | ||
# | ||
# - name: 임시 데이터베이스 Migration | ||
# env: | ||
# DJANGO_SETTINGS_MODULE: "config.settings" | ||
# DJANGO_DEBUG_MODE: true | ||
# UPCY_SECRET_KEY: "test123123123123123123123" # 진짜 SECRET 키 아닙니다. | ||
# run: | | ||
# poetry run python manage.py migrate | ||
# | ||
# - name: Django 테스트 실행 | ||
# env: | ||
# DJANGO_SETTINGS_MODULE: "config.settings" | ||
# DJANGO_DEBUG_MODE: true | ||
# UPCY_SECRET_KEY: "test123123123123123123123" # 진짜 SECRET 키 아닙니다. | ||
# run: | | ||
# poetry run python manage.py test users.tests.user_tests # User 모듈 테스트 실행 | ||
# poetry run python manage.py test users.tests.reformer_tests # Reformer 모듈 테스트 실행 | ||
# poetry run python manage.py test market # Market, Service 테스트 실행 | ||
# poetry run python manage.py test order # Order 모듈 테스트 실행 |
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 |
---|---|---|
|
@@ -161,5 +161,4 @@ media | |
products/photo/ | ||
services/photo/ | ||
users/profile/ | ||
.idea | ||
services/photo/ | ||
.idea |
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
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
File renamed without changes.
Oops, something went wrong.