From 9165b2a7d79f24e4ae0085be5b26e3d888377bc5 Mon Sep 17 00:00:00 2001 From: Seungwan Yoo Date: Wed, 5 Mar 2025 12:47:41 +0900 Subject: [PATCH 1/2] =?UTF-8?q?infra:=20CI=20workflow=20=EC=BA=90=EC=8B=B1?= =?UTF-8?q?=20=EB=8F=84=EC=9E=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/ci.yml | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index ab9ea63..d738575 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -18,8 +18,26 @@ jobs: java-version: '21' cache: gradle + - name: Cache Gradle packages + uses: actions/cache@v3 + with: + path: | + ~/.gradle/caches + ~/.gradle/wrapper + key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }} + restore-keys: | + ${{ runner.os }}-gradle- + + - name: Cache Gradle Build + uses: actions/cache@v3 + with: + path: build + key: ${{ runner.os }}-gradle-build-${{ github.sha }} + restore-keys: | + ${{ runner.os }}-gradle-build- + - name: Grant execute permission for gradlew run: chmod +x gradlew - name: Build with Gradle - run: ./gradlew clean build + run: ./gradlew clean build --build-cache From a323f165e6e13eb2fe74ab6452ec6472d38be2a8 Mon Sep 17 00:00:00 2001 From: Seungwan Yoo Date: Wed, 5 Mar 2025 12:47:56 +0900 Subject: [PATCH 2/2] =?UTF-8?q?infra:=20CI/CD=20workflow=20=EC=BA=90?= =?UTF-8?q?=EC=8B=B1=20=EB=8F=84=EC=9E=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/cicd.yml | 36 +++++++++++++++++++++++++++++++++++- 1 file changed, 35 insertions(+), 1 deletion(-) diff --git a/.github/workflows/cicd.yml b/.github/workflows/cicd.yml index ddb1362..dd54767 100644 --- a/.github/workflows/cicd.yml +++ b/.github/workflows/cicd.yml @@ -11,12 +11,40 @@ jobs: - name: Checkout code uses: actions/checkout@v4.1.7 + - name: Set up JDK 21 + uses: actions/setup-java@v4.2.2 + with: + distribution: 'temurin' + java-version: '21' + cache: gradle + + - name: Cache Gradle packages + uses: actions/cache@v3 + with: + path: | + ~/.gradle/caches + ~/.gradle/wrapper + key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }} + restore-keys: | + ${{ runner.os }}-gradle- + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + - name: Log in to Docker Hub uses: docker/login-action@v3.3.0 with: username: ${{ secrets.DOCKER_USERNAME }} password: ${{ secrets.DOCKER_PASSWORD }} + - name: Cache Docker layers + uses: actions/cache@v3 + with: + path: /tmp/.buildx-cache + key: ${{ runner.os }}-buildx-${{ github.sha }} + restore-keys: | + ${{ runner.os }}-buildx- + - name: Build and Push Docker image if: github.ref == 'refs/heads/main' uses: docker/build-push-action@v6.7.0 @@ -26,11 +54,17 @@ jobs: push: true tags: ${{ secrets.DOCKER_USERNAME }}/${{ secrets.PROD_IMAGE_NAME }}:latest platforms: linux/amd64 + cache-from: type=local,src=/tmp/.buildx-cache + cache-to: type=local,dest=/tmp/.buildx-cache-new,mode=max + + - name: Move cache + run: | + rm -rf /tmp/.buildx-cache + mv /tmp/.buildx-cache-new /tmp/.buildx-cache deploy: runs-on: ubuntu-latest needs: build - steps: - name: SSH to Server and Deploy if: github.ref == 'refs/heads/main'