Skip to content

Commit

Permalink
CI/CD 파이프라인 구축 (#19)
Browse files Browse the repository at this point in the history
* feat: ci workflow 작성

* feat: cd workflow 작성

* fix: mysql actions step 삭제

* fix: docker image 태그 제거

* fix: cd 파이프라인 trigger 브랜치명 수정(develop->dev)
  • Loading branch information
jinlee1703 authored Mar 26, 2024
1 parent 0d5adfe commit 1b41db4
Show file tree
Hide file tree
Showing 3 changed files with 117 additions and 0 deletions.
68 changes: 68 additions & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
name: Continuous Deployment

on:
push:
branches: [ "dev" ]
workflow_dispatch:
inputs:
logLevel:
description: 'Log level'
required: true
default: 'warning'
type: choice
options:
- info
- warning
- debug
tags:
description: 'Test scenario tags'
required: false
type: boolean
environment:
description: 'Environment to run tests against'
type: environment
required: false

permissions:
contents: read

jobs:
deployment:
runs-on: ubuntu-20.04

steps:
# 1. Compare branch 코드 내려 받기
- name: Checkout PR
uses: actions/checkout@v3
with:
ref: ${{ github.event.push.base_ref }}

# 2. 자바 환경 설정
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
java-version: '17'
distribution: 'temurin'

# 3. Docker 이미지 build 및 push
- name: docker build and push
run: |
docker login -u ${{ secrets.DOCKER_USERNAME }} -p ${{ secrets.DOCKER_PASSWORD }}
docker build -t jinlee1703/pennyway-was .
docker push jinlee1703/pennyway-was
# 4. AWS SSM을 통한 Run-Command (Docker 이미지 pull 후 docker-compose를 통한 실행)
- name: AWS SSM Send-Command
uses: peterkimzz/aws-ssm-send-command@master
id: ssm
with:
aws-region: ${{ secrets.AWS_REGION }}
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
instance-ids: ${{ secrets.AWS_DEV_INSTANCE_ID }}
working-directory: /home/ubuntu
command: |
docker login -u ${{ secrets.DOCKER_USERNAME }} -p ${{ secrets.DOCKER_PASSWORD }}
docker system prune -a -f
docker pull jinlee1703/pennyway-was
docker-compose up -d
49 changes: 49 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
name: Continuous Integration

on:
pull_request:
branches: [ "dev" ]
workflow_dispatch:
inputs:
logLevel:
description: 'Log level'
required: true
default: 'warning'
type: choice
options:
- info
- warning
- debug
tags:
description: 'Test scenario tags'
required: false
type: boolean
environment:
description: 'Environment to run tests against'
type: environment
required: false

permissions:
contents: read

jobs:
testing:
runs-on: ubuntu-20.04

steps:
# 1. Compare branch 코드 내려 받기
- name: Checkout PR
uses: actions/checkout@v3
with:
ref: ${{ github.event.pull_request.head.ref }}

# 2. 자바 환경 설정
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
java-version: '17'
distribution: 'temurin'

# 3. Gradle Test 실행
- name: Test with Gradle
run: ./gradlew --info test
Empty file modified gradlew
100644 → 100755
Empty file.

0 comments on commit 1b41db4

Please sign in to comment.