Skip to content

Commit

Permalink
Merge branch 'develop' into feat/github-test/formatter
Browse files Browse the repository at this point in the history
  • Loading branch information
minkyu97 committed Nov 9, 2023
2 parents eb631e9 + c37ded9 commit bc0a193
Show file tree
Hide file tree
Showing 63 changed files with 1,476 additions and 1,298 deletions.
6 changes: 0 additions & 6 deletions .env.dev

This file was deleted.

6 changes: 0 additions & 6 deletions .env.prod

This file was deleted.

6 changes: 6 additions & 0 deletions .env.test
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
DB_USERNAME=test-user
DB_PASSWORD=password
DB_NAME=testdb
DB_HOST=127.0.0.1
DB_PORT=3307
SLACK_API_TOKEN=""
47 changes: 47 additions & 0 deletions .github/workflows/deploy-dev-manual.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
name: Deploy-dev-manual

on:
workflow_dispatch:
inputs:
branch:
description: 'Branch name'
required: true
default: 'develop'

jobs:
deploy:
name: deploy dev
runs-on: ubuntu-latest

env:
IMAGE_TAG: ${{ github.run_number }}
ECR_REPOSITORY: waffledotcom-dev/waffledotcom-server

steps:
- name: Checkout
uses: actions/checkout@v3
with:
ref: ${{ inputs.branch }}

- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v2
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: ap-northeast-2

- name: Login to Amazon ECR
id: login-ecr
uses: aws-actions/amazon-ecr-login@v1

- name: Build, tag, and push image to ECR to be deployed for K8S
id: build-image-k8s
uses: docker/build-push-action@v4
env:
ECR_REGISTRY: ${{ steps.login-ecr.outputs.registry }}
with:
context: .
push: true
tags: ${{ env.ECR_REGISTRY }}/${{ env.ECR_REPOSITORY }}:${{ env.IMAGE_TAG }}
build-args: |
ENV=dev
5 changes: 0 additions & 5 deletions .github/workflows/deploy-dev.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,3 @@ jobs:
tags: ${{ env.ECR_REGISTRY }}/${{ env.ECR_REPOSITORY }}:${{ env.IMAGE_TAG }}
build-args: |
ENV=dev
DB_HOST=${{ secrets.DB_HOST_DEV }}
DB_PORT=${{ secrets.DB_PORT_DEV }}
DB_NAME=${{ secrets.DB_NAME_DEV }}
DB_USERNAME=${{ secrets.DB_USERNAME_DEV }}
DB_PASSWORD=${{ secrets.DB_PASSWORD_DEV }}
11 changes: 3 additions & 8 deletions .github/workflows/deploy-prod.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,16 @@ name: Deploy-prod

on:
push:
branches: [main]
tags:
- 'v[0-9]+.[0-9]+.[0-9]+*'

jobs:
deploy:
name: deploy prod
runs-on: ubuntu-latest

env:
IMAGE_TAG: ${{ github.run_number }}
IMAGE_TAG: ${{ github.ref_name }}
ECR_REPOSITORY: waffledotcom-prod/waffledotcom-server

steps:
Expand All @@ -28,7 +29,6 @@ jobs:
id: login-ecr
uses: aws-actions/amazon-ecr-login@v1


- name: Build, tag, and push image to ECR to be deployed for K8S
id: build-image-k8s
uses: docker/build-push-action@v4
Expand All @@ -40,8 +40,3 @@ jobs:
tags: ${{ env.ECR_REGISTRY }}/${{ env.ECR_REPOSITORY }}:${{ env.IMAGE_TAG }}
build-args: |
ENV=prod
DB_HOST=${{ secrets.DB_HOST_PROD }}
DB_PORT=${{ secrets.DB_PORT_PROD }}
DB_NAME=${{ secrets.DB_NAME_PROD }}
DB_USERNAME=${{ secrets.DB_USERNAME_PROD }}
DB_PASSWORD=${{ secrets.DB_PASSWORD_PROD }}
24 changes: 24 additions & 0 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,27 @@ jobs:
pytest:
runs-on: ubuntu-latest

services:
mysql:
image: mysql:5.7
env:
MYSQL_USER: test-user
MYSQL_PASSWORD: password
MYSQL_ROOT_PASSWORD: root-password
MYSQL_DATABASE: testdb
ports:
- 3307:3306
options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3

env:
env: test

steps:
- uses: actions/checkout@v3

- name: change mysql charset
run: mysql -h 127.0.0.1 -P 3307 -u root -p'root-password' -e "ALTER DATABASE testdb CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci"

- name: Install poetry
run: pipx install poetry

Expand Down Expand Up @@ -45,3 +63,9 @@ jobs:
run: |
git fetch origin ${{ github.base_ref }}
poetry run pre-commit run --from-ref origin/${{ github.base_ref }} --to-ref HEAD
- name: Run alembic migration test
run: |
mkdir -p waffledotcom/src/database/migrations/versions
ls waffledotcom/src/database/migrations/versions/* || poetry run alembic revision --autogenerate
poetry run alembic upgrade head
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -42,3 +42,8 @@ node_modules

*.local
*.pickle
.DS_Store
/install-pyenv-win.ps1

*.json
*.csv
13 changes: 0 additions & 13 deletions .isort.cfg

This file was deleted.

15 changes: 4 additions & 11 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -33,15 +33,8 @@ repos:
hooks:
- id: isort

- repo: local
- repo: https://github.com/astral-sh/ruff-pre-commit
# Ruff version.
rev: v0.0.291
hooks:
- id: pylint
name: pylint
entry: pylint
language: system
types: [python]
args: [
"-rn", # Only display messages
"-sn", # Don't display the score
"--rcfile=.pylintrc", # Link to your config file
]
- id: ruff
Loading

0 comments on commit bc0a193

Please sign in to comment.