Skip to content

Commit

Permalink
Merge branch 'main' into feature/#294
Browse files Browse the repository at this point in the history
  • Loading branch information
kunsanglee authored Aug 23, 2024
2 parents e582476 + d577a0e commit 1b9bc3d
Show file tree
Hide file tree
Showing 468 changed files with 55,030 additions and 0 deletions.
72 changes: 72 additions & 0 deletions .github/workflows/backend-dev.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
name: backend-push

on:
push:
branches: [ "be-dev" ]

jobs:
build:
runs-on: [ self-hosted, backend-dev ]

defaults:
run:
shell: bash
working-directory: ./server

permissions:
contents: read

steps:
- name: CheckOut
uses: actions/checkout@v4
with:
token: ${{secrets.CONFIG_SUBMODULE_TOKEN}}
submodules: true

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

- name: Setup Gradle
uses: gradle/actions/setup-gradle@417ae3ccd767c252f5661f1ace9f835f9654f2b5 # v3.1.0

- name: Grant execute permission for gradlew
run: chmod +x gradlew

- name: Test with Gradle Wrapper
run: ./gradlew clean build

- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}

- name: Set up Docker BuildX
uses: docker/setup-buildx-action@v3

- name: Build and push
run: |
docker buildx build --platform linux/arm64 -t \
${{ secrets.DOCKER_USERNAME }}/${{ secrets.DOCKER_IMAGE_BE_DEV }} --push .
deploy:
needs: build
runs-on: [ self-hosted, backend-dev ]
steps:
- name: Docker remove
run: |
CONTAINER_IDS=$(sudo docker ps -qa)
if [ -n "$CONTAINER_IDS" ]; then
sudo docker rm -f $CONTAINER_IDS
else
echo "No running containers found."
fi
- name: Docker Image pull
run: sudo docker pull ${{ secrets.DOCKER_USERNAME }}/${{ secrets.DOCKER_IMAGE_BE_DEV }}

- name: Docker run
run: sudo docker run -d -p 8080:8080 -e SPRING_PROFILES_ACTIVE=dev -v log-volume:/app/logs --name haengdong-backend ${{ secrets.DOCKER_USERNAME }}/${{ secrets.DOCKER_IMAGE_BE_DEV }}
74 changes: 74 additions & 0 deletions .github/workflows/backend-prod.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
name: backend-push

on:
push:
branches: [ "main" ]
paths:
- 'server/**'

jobs:
build:
runs-on: ubuntu-latest

defaults:
run:
shell: bash
working-directory: ./server

permissions:
contents: read

steps:
- name: CheckOut
uses: actions/checkout@v4
with:
token: ${{secrets.CONFIG_SUBMODULE_TOKEN}}
submodules: true

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

- name: Setup Gradle
uses: gradle/actions/setup-gradle@417ae3ccd767c252f5661f1ace9f835f9654f2b5 # v3.1.0

- name: Grant execute permission for gradlew
run: chmod +x gradlew

- name: Test with Gradle Wrapper
run: ./gradlew clean build

- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}

- name: Set up Docker BuildX
uses: docker/setup-buildx-action@v3

- name: Build and push
run: |
docker buildx build --platform linux/arm64 -t \
${{ secrets.DOCKER_USERNAME }}/${{ secrets.DOCKER_IMAGE_BE_PROD }} --push .
deploy:
needs: build
runs-on: [ self-hosted, backend-prod ]
steps:
- name: Docker remove
run: |
CONTAINER_IDS=$(sudo docker ps -qa)
if [ -n "$CONTAINER_IDS" ]; then
sudo docker rm -f $CONTAINER_IDS
else
echo "No running containers found."
fi
- name: Docker Image pull
run: sudo docker pull ${{ secrets.DOCKER_USERNAME }}/${{ secrets.DOCKER_IMAGE_BE_PROD }}

- name: Docker run
run: sudo docker run -d -p 8080:8080 -e SPRING_PROFILES_ACTIVE=prod -v log-volume:/app/logs --name haengdong-backend ${{ secrets.DOCKER_USERNAME }}/${{ secrets.DOCKER_IMAGE_BE_PROD }}
44 changes: 44 additions & 0 deletions .github/workflows/backend-pull-request.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
name: backend-pull-request

on:
pull_request:
branches: [ "main", "be-dev" ]

jobs:
build:
runs-on: [ ubuntu-latest ]

defaults:
run:
working-directory: ./server

steps:
- name: CheckOut
uses: actions/checkout@v4

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

- name: Setup Gradle
uses: gradle/actions/setup-gradle@417ae3ccd767c252f5661f1ace9f835f9654f2b5 # v3.1.0

- name: Grant execute permission for gradlew
run: chmod +x gradlew

- name: Test with Gradle Wrapper
run: ./gradlew clean build

- name: publish unit test results
uses: EnricoMi/publish-unit-test-result-action@v2
if: always()
with:
files: server/build/test-results/test/TEST-*.xml

- name: add comments to a pull request
uses: mikepenz/action-junit-report@v3
if: always()
with:
report_paths: server/build/test-results/test/TEST-*.xml
54 changes: 54 additions & 0 deletions .github/workflows/design-pull-request.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
name: Storybook Deployment

on:
pull_request:
branches:
- fe-dev
paths:
- 'HDesign/**'

jobs:
chromatic:
name: Run Chromatic
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: '20.15.1'

- name: Cache dependencies
id: cache
uses: actions/cache@v3
with:
path: '**/node_modules'
key: ${{ runner.os }}-npm-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-npm-
- name: Install dependencies
if: steps.cache.outputs.cache-hit != 'true'
run: |
cd HDesign
npm install
- name: Run lint
run: npm run lint
working-directory: ./HDesign

- name: Run Chromatic
uses: chromaui/action@latest
id: publish_chromatic
with:
workingDir: HDesign
projectToken: ${{ secrets.CHROMATIC_PROJECT_TOKEN }}

- name: Comment on PR
uses: thollander/actions-comment-pull-request@v2
with:
message: 'πŸš€ **storybook**: ${{ steps.publish_chromatic.outputs.storybookUrl }}'
49 changes: 49 additions & 0 deletions .github/workflows/frontend-pull-request.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
name: frontend-pull-request

on:
pull_request:
types: [opened, synchronize]
branches: [main, fe-dev]
paths:
- 'client/**'

jobs:
test:
runs-on: ubuntu-latest

defaults:
run:
shell: bash
working-directory: ./client

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: '20.15.1'

- name: Install dependencies
working-directory: ./client
run: npm install

- name: Run lint
working-directory: ./client
run: npm run lint

- name: Run test
working-directory: ./client
run: npm run test

- name: Cypress test
run: npm run dev &
env:
CI: true

- name: Wait for the server to start
run: sleep 3

- name: Run Cypress tests
run: npm run cypress-run
33 changes: 33 additions & 0 deletions .github/workflows/pr-issue-close.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: Close Issue on PR Merge

on:
pull_request:
types: [closed]

jobs:
close-issue:
if: github.event.pull_request.merged == true
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v3

- name: Extract issue number from PR body
id: extract_issue
run: |
# Fetch PR body
PR_BODY=$(curl -s -H "Authorization: token ${{ secrets.CONFIG_SUBMODULE_TOKEN }}" \
"https://api.github.com/repos/${{ github.repository }}/issues/${{ github.event.pull_request.number }}" \
| jq -r '.body')
# Extract issue number from PR body using regex (customize if needed)
ISSUE_NUMBER=$(echo "$PR_BODY" | grep -oP '#\d+' | head -1 | sed 's/#//')
echo "ISSUE_NUMBER=$ISSUE_NUMBER" >> $GITHUB_ENV
- name: Close associated issue
if: env.ISSUE_NUMBER != ''
run: |
echo "Closing issue #${{ env.ISSUE_NUMBER }}"
curl -s -X PATCH -H "Authorization: token ${{ secrets.CONFIG_SUBMODULE_TOKEN }}" \
-H "Accept: application/vnd.github.v3+json" \
-d '{"state": "closed"}' \
"https://api.github.com/repos/${{ github.repository }}/issues/${{ env.ISSUE_NUMBER }}"
4 changes: 4 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
[submodule "server/src/main/resources/config"]
branch = main
path = server/src/main/resources/config
url = https://github.com/woowacourse-teams/2024-haeng-dong-config.git
12 changes: 12 additions & 0 deletions HDesign/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
logs
*.log
npm-debug.log*

node_modules
dist

.env

storybook-static
*storybook.log
.DS_Store
7 changes: 7 additions & 0 deletions HDesign/.npmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
node_modules/
src/
tsconfig.json
.storybook/
.eslintrc.json
.prettierrc
webpack.config.js
2 changes: 2 additions & 0 deletions HDesign/.npmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
engine-strict = true
legacy-peer-deps = true
12 changes: 12 additions & 0 deletions HDesign/.prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"singleQuote": true,
"trailingComma": "all",
"printWidth": 120,
"tabWidth": 2,
"semi": true,
"arrowParens": "avoid",
"endOfLine": "auto",
"jsxSingleQuote": false,
"bracketSpacing": false,
"proseWrap": "preserve"
}
Loading

0 comments on commit 1b9bc3d

Please sign in to comment.