Skip to content

Commit b88817f

Browse files
committed
Merge branch 'release/v1.0.0'
2 parents 968619c + e5b1e05 commit b88817f

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

68 files changed

+3181
-1113
lines changed

.env.dev

Lines changed: 0 additions & 5 deletions
This file was deleted.

.env.prod

Lines changed: 0 additions & 5 deletions
This file was deleted.

.env.test

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
DB_USERNAME=test-user
2+
DB_PASSWORD=password
3+
DB_NAME=testdb
4+
DB_HOST=127.0.0.1
5+
DB_PORT=3307
6+
SLACK_API_TOKEN=""
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
name: Deploy-dev-manual
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
branch:
7+
description: 'Branch name'
8+
required: true
9+
default: 'develop'
10+
11+
jobs:
12+
deploy:
13+
name: deploy dev
14+
runs-on: ubuntu-latest
15+
16+
env:
17+
IMAGE_TAG: ${{ github.run_number }}
18+
ECR_REPOSITORY: waffledotcom-dev/waffledotcom-server
19+
20+
steps:
21+
- name: Checkout
22+
uses: actions/checkout@v3
23+
with:
24+
ref: ${{ inputs.branch }}
25+
26+
- name: Configure AWS credentials
27+
uses: aws-actions/configure-aws-credentials@v2
28+
with:
29+
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
30+
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
31+
aws-region: ap-northeast-2
32+
33+
- name: Login to Amazon ECR
34+
id: login-ecr
35+
uses: aws-actions/amazon-ecr-login@v1
36+
37+
- name: Build, tag, and push image to ECR to be deployed for K8S
38+
id: build-image-k8s
39+
uses: docker/build-push-action@v4
40+
env:
41+
ECR_REGISTRY: ${{ steps.login-ecr.outputs.registry }}
42+
with:
43+
context: .
44+
push: true
45+
tags: ${{ env.ECR_REGISTRY }}/${{ env.ECR_REPOSITORY }}:${{ env.IMAGE_TAG }}
46+
build-args: |
47+
ENV=dev

.github/workflows/deploy-dev.yaml

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,3 @@ jobs:
3939
tags: ${{ env.ECR_REGISTRY }}/${{ env.ECR_REPOSITORY }}:${{ env.IMAGE_TAG }}
4040
build-args: |
4141
ENV=dev
42-
DB_HOST=${{ secrets.DB_HOST_DEV }}
43-
DB_PORT=${{ secrets.DB_PORT_DEV }}
44-
DB_NAME=${{ secrets.DB_NAME_DEV }}
45-
DB_USERNAME=${{ secrets.DB_USERNAME_DEV }}
46-
DB_PASSWORD=${{ secrets.DB_PASSWORD_DEV }}

.github/workflows/deploy-prod.yaml

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,16 @@ name: Deploy-prod
22

33
on:
44
push:
5-
branches: [main]
5+
tags:
6+
- 'v[0-9]+.[0-9]+.[0-9]+*'
67

78
jobs:
89
deploy:
910
name: deploy prod
1011
runs-on: ubuntu-latest
1112

1213
env:
13-
IMAGE_TAG: ${{ github.run_number }}
14+
IMAGE_TAG: ${{ github.ref_name }}
1415
ECR_REPOSITORY: waffledotcom-prod/waffledotcom-server
1516

1617
steps:
@@ -28,7 +29,6 @@ jobs:
2829
id: login-ecr
2930
uses: aws-actions/amazon-ecr-login@v1
3031

31-
3232
- name: Build, tag, and push image to ECR to be deployed for K8S
3333
id: build-image-k8s
3434
uses: docker/build-push-action@v4
@@ -40,8 +40,3 @@ jobs:
4040
tags: ${{ env.ECR_REGISTRY }}/${{ env.ECR_REPOSITORY }}:${{ env.IMAGE_TAG }}
4141
build-args: |
4242
ENV=prod
43-
DB_HOST=${{ secrets.DB_HOST_PROD }}
44-
DB_PORT=${{ secrets.DB_PORT_PROD }}
45-
DB_NAME=${{ secrets.DB_NAME_PROD }}
46-
DB_USERNAME=${{ secrets.DB_USERNAME_PROD }}
47-
DB_PASSWORD=${{ secrets.DB_PASSWORD_PROD }}

.github/workflows/test.yaml

Lines changed: 30 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,21 +10,37 @@ jobs:
1010
pytest:
1111
runs-on: ubuntu-latest
1212

13+
services:
14+
mysql:
15+
image: mysql:5.7
16+
env:
17+
MYSQL_USER: test-user
18+
MYSQL_PASSWORD: password
19+
MYSQL_ROOT_PASSWORD: root-password
20+
MYSQL_DATABASE: testdb
21+
ports:
22+
- 3307:3306
23+
options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3
24+
25+
env:
26+
env: test
27+
1328
steps:
1429
- uses: actions/checkout@v3
1530

31+
- name: change mysql charset
32+
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"
33+
1634
- name: Install poetry
17-
run: pipx install poetry
35+
run: |
36+
pipx install poetry
37+
poetry config virtualenvs.in-project true --local
1838
1939
- uses: actions/setup-python@v4
2040
with:
2141
python-version: 3.11
2242
cache: poetry
2343

24-
- name: Set poetry environment
25-
run: |
26-
poetry env use 3.11
27-
2844
- name: Install dependencies
2945
run: poetry install --no-root
3046

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

44-
- name: Check Pylint
60+
- name: Run pre-commit
61+
run: |
62+
git fetch origin ${{ github.base_ref }}
63+
poetry run pre-commit run --from-ref origin/${{ github.base_ref }} --to-ref HEAD
64+
65+
- name: Run alembic migration test
4566
run: |
46-
poetry run pylint -rn -sn --rcfile=${GITHUB_WORKSPACE}/.pylintrc ./waffledotcom
67+
mkdir -p waffledotcom/src/database/migrations/versions
68+
ls waffledotcom/src/database/migrations/versions/* || poetry run alembic revision --autogenerate
69+
poetry run alembic upgrade head

.gitignore

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,3 +41,9 @@ waffledotcom/.idea/
4141
node_modules
4242

4343
*.local
44+
*.pickle
45+
.DS_Store
46+
/install-pyenv-win.ps1
47+
48+
*.json
49+
*.csv

.isort.cfg

Lines changed: 0 additions & 13 deletions
This file was deleted.

.pre-commit-config.yaml

Lines changed: 5 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ repos:
1818
- --line-length=88
1919

2020
- repo: https://github.com/RobertCraigie/pyright-python
21-
rev: v1.1.308
21+
rev: v1.1.314
2222
hooks:
2323
- id: pyright
2424

@@ -33,15 +33,8 @@ repos:
3333
hooks:
3434
- id: isort
3535

36-
- repo: local
36+
- repo: https://github.com/astral-sh/ruff-pre-commit
37+
# Ruff version.
38+
rev: v0.0.291
3739
hooks:
38-
- id: pylint
39-
name: pylint
40-
entry: pylint
41-
language: system
42-
types: [python]
43-
args: [
44-
"-rn", # Only display messages
45-
"-sn", # Don't display the score
46-
"--rcfile=.pylintrc", # Link to your config file
47-
]
40+
- id: ruff

0 commit comments

Comments
 (0)