Skip to content

Commit

Permalink
Merge branch 'dev' into feat/delete-account
Browse files Browse the repository at this point in the history
  • Loading branch information
chjcode authored Oct 6, 2024
2 parents fb0fc84 + 2e401ff commit 0458ce6
Show file tree
Hide file tree
Showing 40 changed files with 662 additions and 283 deletions.
98 changes: 0 additions & 98 deletions .github/workflows/build-push-deploy.yml

This file was deleted.

40 changes: 40 additions & 0 deletions .github/workflows/build-push.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: Build and Deploy to Docker Hub

on:
push:
branches: [ "release", "dev" ]

jobs:
build:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2

- name: Set up JDK 17
uses: actions/setup-java@v2
with:
java-version: '17'
distribution: 'temurin'

- name: Build with Gradle
run: ./gradlew build --daemon --parallel

- name: Login to Docker Hub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKER_HUB_USERNAME }}
password: ${{ secrets.DOCKER_HUB_PASSWORD }}

- name: Set Docker repository
run: |
if [[ "${{ github.ref }}" == "refs/heads/release" ]]; then
echo "DOCKER_REPO=yeseulhong/grass-diary-release" >> $GITHUB_ENV
elif [[ "${{ github.ref }}" == "refs/heads/dev" ]]; then
echo "DOCKER_REPO=yeseulhong/grass-diary-dev" >> $GITHUB_ENV
fi
- name: Build and Push Docker Image
run: |
docker buildx create --use
docker buildx build --platform linux/arm64,linux/amd64 -t ${{ env.DOCKER_REPO }}:latest --push .
122 changes: 61 additions & 61 deletions .github/workflows/code-review.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,77 +11,77 @@ jobs:
runs-on: ubuntu-latest

steps:
- name: Check out repository
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Check out repository
uses: actions/checkout@v2
with:
fetch-depth: 0

- name: Set Server Info
run: |
echo "REVIEW_API_URL=${{ secrets.REVIEW_API_URL }}" >> $GITHUB_ENV
- name: Set Server Info
run: |
echo "REVIEW_API_URL=${{ secrets.REVIEW_API_URL }}" >> $GITHUB_ENV
# - name: Debug REVIEW_API_URL
# run: echo "REVIEW_API_URL=$REVIEW_API_URL"

# - name: API calling for CodeReview
# id: api_call
# run: |
# if [ -z "$REVIEW_API_URL" ]; then
# echo "REVIEW_API_URL is not set"
# exit 1
# fi
# REVIEW_RESPONSE=$(curl -X POST $REVIEW_API_URL)
# echo "Review Response: $REVIEW_RESPONSE"
# echo "REVIEW_RESPONSE=$REVIEW_RESPONSE" >> $GITHUB_ENV
# - name: Debug REVIEW_API_URL
# run: echo "REVIEW_API_URL=$REVIEW_API_URL"

- name: Get Git Diff
id: git_diff
run: |
git fetch origin
git diff --unified=3 ${{ github.event.pull_request.base.sha }} ${{ github.event.pull_request.head.sha }} > diff.txt
DIFF_CONTENT=$(cat diff.txt)
echo "Diff content length: $(wc -c < diff.txt)"
echo "DIFF_CONTENT<<EOF" >> $GITHUB_ENV
echo "$DIFF_CONTENT" >> $GITHUB_ENV
echo "EOF" >> $GITHUB_ENV
echo "Diff added to GITHUB_ENV"
# - name: API calling for CodeReview
# id: api_call
# run: |
# if [ -z "$REVIEW_API_URL" ]; then
# echo "REVIEW_API_URL is not set"
# exit 1
# fi
# REVIEW_RESPONSE=$(curl -X POST $REVIEW_API_URL)
# echo "Review Response: $REVIEW_RESPONSE"
# echo "REVIEW_RESPONSE=$REVIEW_RESPONSE" >> $GITHUB_ENV

- name: API calling for CodeReview
id: api_call
run: |
ESCAPED_DIFF=$(echo "$DIFF_CONTENT" | jq -sRr @json)
REQUEST_BODY=$(jq -n \
--arg model "${{ secrets.REVIEW_MODEL_NAME }}" \
--arg prompt "Review the following code changes and provide feedback:$ESCAPED_DIFF" \
'{model: $model, prompt: $prompt, stream: false}')
FULL_RESPONSE=$(curl -X POST ${REVIEW_API_URL} \
-H "Content-Type: application/json" \
-d "$REQUEST_BODY")
REVIEW_RESPONSE=$(echo $FULL_RESPONSE | jq -r '.response')
echo "Review Response: $REVIEW_RESPONSE"
echo "REVIEW_RESPONSE<<EOF" >> $GITHUB_ENV
echo "$REVIEW_RESPONSE" >> $GITHUB_ENV
echo "EOF" >> $GITHUB_ENV
- name: Get Git Diff
id: git_diff
run: |
git fetch origin
git diff --unified=3 ${{ github.event.pull_request.base.sha }} ${{ github.event.pull_request.head.sha }} > diff.txt
DIFF_CONTENT=$(cat diff.txt)
echo "Diff content length: $(wc -c < diff.txt)"
echo "DIFF_CONTENT<<EOF" >> $GITHUB_ENV
echo "$DIFF_CONTENT" >> $GITHUB_ENV
echo "EOF" >> $GITHUB_ENV
echo "Diff added to GITHUB_ENV"
- name: Debug output
run: |
echo "DIFF_CONTENT:"
echo "$DIFF_CONTENT"
echo "REVIEW_RESPONSE:"
echo "$REVIEW_RESPONSE"
- name: API calling for CodeReview
id: api_call
run: |
ESCAPED_DIFF=$(echo "$DIFF_CONTENT" | jq -sRr @json)
REQUEST_BODY=$(jq -n \
--arg model "${{ secrets.REVIEW_MODEL_NAME }}" \
--arg prompt "Review the following code changes and provide feedback:$ESCAPED_DIFF" \
'{model: $model, prompt: $prompt, stream: false}')
FULL_RESPONSE=$(curl -X POST ${REVIEW_API_URL} \
-H "Content-Type: application/json" \
-d "$REQUEST_BODY")
REVIEW_RESPONSE=$(echo $FULL_RESPONSE | jq -r '.response')
echo "Review Response: $REVIEW_RESPONSE"
echo "REVIEW_RESPONSE<<EOF" >> $GITHUB_ENV
echo "$REVIEW_RESPONSE" >> $GITHUB_ENV
echo "EOF" >> $GITHUB_ENV
- name: Add review to pull request
uses: actions/github-script@v6
env:
DIFF_CONTENT: ${{ env.DIFF_CONTENT }}
with:
github-token: ${{ secrets.REVIEW_BOT_TOKEN }}
script: |
- name: Debug output
run: |
echo "DIFF_CONTENT:"
echo "$DIFF_CONTENT"
echo "REVIEW_RESPONSE:"
echo "$REVIEW_RESPONSE"
- name: Add review to pull request
uses: actions/github-script@v6
env:
DIFF_CONTENT: ${{ env.DIFF_CONTENT }}
with:
github-token: ${{ secrets.REVIEW_BOT_TOKEN }}
script: |
const diff = process.env.DIFF_CONTENT;
const response = process.env.REVIEW_RESPONSE;
github.rest.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: `${response}`
});
});
71 changes: 0 additions & 71 deletions k8s/deployment.yaml

This file was deleted.

30 changes: 30 additions & 0 deletions k8s/dev/deployment.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: spring-boot-app
namespace: grass-diary-backend-dev
spec:
replicas: 2
selector:
matchLabels:
app: spring-boot-app
template:
metadata:
labels:
app: spring-boot-app
spec:
containers:
- name: spring-boot-app
image: yeseulhong/grass-diary-dev:latest
imagePullPolicy: Always
ports:
- containerPort: 8080
envFrom:
- secretRef:
name: google-secrets
- secretRef:
name: jwt-secrets
- secretRef:
name: db-secrets
- secretRef:
name: s3-secrets
Loading

0 comments on commit 0458ce6

Please sign in to comment.