Skip to content

Commit

Permalink
Merge branch 'release/v1.0.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
minkyu97 committed Jul 6, 2024
2 parents 968619c + e5b1e05 commit b88817f
Show file tree
Hide file tree
Showing 68 changed files with 3,181 additions and 1,113 deletions.
5 changes: 0 additions & 5 deletions .env.dev

This file was deleted.

5 changes: 0 additions & 5 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 }}
37 changes: 30 additions & 7 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,21 +10,37 @@ 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
run: |
pipx install poetry
poetry config virtualenvs.in-project true --local
- uses: actions/setup-python@v4
with:
python-version: 3.11
cache: poetry

- name: Set poetry environment
run: |
poetry env use 3.11
- name: Install dependencies
run: poetry install --no-root

Expand All @@ -41,6 +57,13 @@ jobs:
path: "./waffledotcom/test.xml"
reporter: java-junit

- name: Check Pylint
- name: Run pre-commit
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: |
poetry run pylint -rn -sn --rcfile=${GITHUB_WORKSPACE}/.pylintrc ./waffledotcom
mkdir -p waffledotcom/src/database/migrations/versions
ls waffledotcom/src/database/migrations/versions/* || poetry run alembic revision --autogenerate
poetry run alembic upgrade head
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -41,3 +41,9 @@ waffledotcom/.idea/
node_modules

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

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

This file was deleted.

17 changes: 5 additions & 12 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ repos:
- --line-length=88

- repo: https://github.com/RobertCraigie/pyright-python
rev: v1.1.308
rev: v1.1.314
hooks:
- id: pyright

Expand All @@ -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 b88817f

Please sign in to comment.