Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/main' into t1147-upgrade-prisma-…
Browse files Browse the repository at this point in the history
…v6-new
  • Loading branch information
jimin9038 committed Jan 12, 2025
2 parents c1e5656 + 792d79a commit 045561c
Show file tree
Hide file tree
Showing 187 changed files with 12,719 additions and 4,180 deletions.
8 changes: 0 additions & 8 deletions .eslintignore

This file was deleted.

72 changes: 0 additions & 72 deletions .eslintrc.js

This file was deleted.

32 changes: 30 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -129,8 +129,9 @@ jobs:
with:
install: 'no'

- name: Install dev dependencies
run: pnpm install --dev
# NOTE: eslint-config-next 에서 next 모듈을 찾지 못하는 에러를 해결하기 위해 프론트엔드 의존성을 설치합니다.
- name: Install root and frontend dependencies
run: pnpm install -w --filter frontend

- name: Set up Go
uses: actions/setup-go@v5
Expand Down Expand Up @@ -208,3 +209,30 @@ jobs:
- name: Test
if: steps.filter.outputs.backend == 'true'
run: pnpm --filter="@codedang/backend" test

test-iris:
name: Test Iris
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4

- name: Check if source code has changed
uses: dorny/paths-filter@v3
id: filter
with:
filters: |
iris:
- 'apps/iris/**'
- name: Set up Go
if: steps.filter.outputs.iris == 'true'
uses: actions/setup-go@v5
with:
go-version-file: apps/iris/go.mod
cache-dependency-path: apps/iris/go.sum

- name: Test (Go)
if: steps.filter.outputs.iris == 'true'
run: go test ./...
working-directory: ./apps/iris
90 changes: 90 additions & 0 deletions .github/workflows/rc-build-image.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
name: RC - CD - Build Images

on:
workflow_dispatch:

env:
AWS_REGION: ap-northeast-2
ECS_CLUSTER: Codedang-Api

permissions: # permissions to the job (for the OpenID Connection)
id-token: write
contents: read

jobs:
build-client-api:
name: Build client-api image
runs-on: ubuntu-latest
steps:
- name: Setup Docker Buildx
uses: docker/setup-buildx-action@v3

- uses: aws-actions/configure-aws-credentials@v4
with:
role-to-assume: ${{ secrets.AWS_ROLE_FOR_ECR_PUSH_RC }}
aws-region: ${{ env.AWS_REGION }}

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

- name: Build and push image
uses: docker/build-push-action@v6
with:
file: ./apps/backend/Dockerfile
push: true
build-args: |
target=client
app_env=production
tags: ${{ steps.login-ecr.outputs.registry }}/codedang-client-api:latest

build-admin-api:
name: Build admin-api image
runs-on: ubuntu-latest
steps:
- name: Setup Docker Buildx
uses: docker/setup-buildx-action@v3

- uses: aws-actions/configure-aws-credentials@v4
with:
role-to-assume: ${{ secrets.AWS_ROLE_FOR_ECR_PUSH_RC }}
aws-region: ${{ env.AWS_REGION }}

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

- name: Build and push image
uses: docker/build-push-action@v6
with:
file: ./apps/backend/Dockerfile
push: true
build-args: |
target=admin
app_env=production
tags: ${{ steps.login-ecr.outputs.registry }}/codedang-admin-api:latest

build-iris:
name: Build iris Docker image
runs-on: ubuntu-latest
steps:
- name: Setup Docker Buildx
uses: docker/setup-buildx-action@v3

- uses: aws-actions/configure-aws-credentials@v4
with:
role-to-assume: ${{ secrets.AWS_ROLE_FOR_ECR_PUSH_RC }}
aws-region: ${{ env.AWS_REGION }}

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

- name: Build and push image (iris)
uses: docker/build-push-action@v6
with:
push: true
context: '{{defaultContext}}:apps/iris'
build-args: |
app_env=production
tags: ${{ steps.login-ecr.outputs.registry }}/codedang-iris:latest
66 changes: 66 additions & 0 deletions .github/workflows/rc-deploy-target.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
name: RC - Deploy - Target

on:
workflow_dispatch:
inputs:
terraform_project:
description: 'Select Terraform Project to Deploy'
required: true
type: choice
options:
- 'network'
- 'storage'
- 'codedang'

env:
AWS_REGION: ap-northeast-2
ECS_CLUSTER: Codedang-Api

permissions: # permissions to the job (for the OpenID Connection)
id-token: write
contents: read

jobs:
rc-deploy-target-project:
name: RC - Deploy Terraform targeted Project
runs-on: ubuntu-latest
environment: production
defaults:
run:
shell: bash

steps:
- uses: actions/checkout@v4

- uses: aws-actions/configure-aws-credentials@v4
with:
role-to-assume: ${{ secrets.AWS_ROLE_FOR_DEPLOY_RC }}
aws-region: ${{ env.AWS_REGION }}

- uses: hashicorp/setup-terraform@v3
with:
terraform_version: 1.5.2

- name: Create Terraform variable file
working-directory: ./apps/infra/rc/${{ github.event.inputs.terraform_project }}
run: |
echo "$TFVARS_RC" >> terraform.tfvars
echo "$OAUTH_GITHUB" >> terraform.tfvars
echo "$OAUTH_KAKAO" >> terraform.tfvars
echo 'env = "rc"' >> terraform.tfvars
env:
TFVARS_RC: ${{ secrets.TFVARS_RC }}
OAUTH_GITHUB: ${{ secrets.OAUTH_GITHUB }}
OAUTH_KAKAO: ${{ secrets.OAUTH_KAKAO }}

- name: Terraform Init
working-directory: ./apps/infra/rc/${{ github.event.inputs.terraform_project }}
run: terraform init -backend-config="bucket=codedang-tf-state-rc"

- name: Terraform Plan
working-directory: ./apps/infra/rc/${{ github.event.inputs.terraform_project }}
run: terraform plan -input=false -out=plan.out

- name: Terraform Apply
working-directory: ./apps/infra/rc/${{ github.event.inputs.terraform_project }}
run: terraform apply -input=false plan.out
Loading

0 comments on commit 045561c

Please sign in to comment.