From fc3d871c8bdb09f4db6bf60860da4a0ef1eb7b92 Mon Sep 17 00:00:00 2001 From: Ricardo Campos Date: Mon, 15 Jun 2026 13:20:44 -0300 Subject: [PATCH] feat: add caching to workflows --- .github/workflows/build-server-candidate.yml | 8 ++++++++ .github/workflows/ci-main-backend.yml | 8 ++++++++ .github/workflows/ci-pr-backend.yml | 16 ++++++++++++++++ .github/workflows/ci-pr-frontend.yml | 10 ++++++---- 4 files changed, 38 insertions(+), 4 deletions(-) diff --git a/.github/workflows/build-server-candidate.yml b/.github/workflows/build-server-candidate.yml index 827d200..9ca309c 100644 --- a/.github/workflows/build-server-candidate.yml +++ b/.github/workflows/build-server-candidate.yml @@ -18,6 +18,14 @@ jobs: fetch-depth: 0 ref: ${{ github.ref }} + - name: Cache Maven dependencies + uses: actions/cache@v3 + with: + path: ~/.m2/repository + key: ${{ runner.os }}-maven-${{ hashFiles('**/server/pom.xml') }} + restore-keys: | + ${{ runner.os }}-maven- + - name: Set lowercase repo name id: repo run: echo "name=${GITHUB_REPOSITORY,,}" >> $GITHUB_OUTPUT diff --git a/.github/workflows/ci-main-backend.yml b/.github/workflows/ci-main-backend.yml index 193ba8e..c34c628 100644 --- a/.github/workflows/ci-main-backend.yml +++ b/.github/workflows/ci-main-backend.yml @@ -25,6 +25,14 @@ jobs: with: fetch-depth: 0 + - name: Cache Maven dependencies + uses: actions/cache@v3 + with: + path: ~/.m2/repository + key: ${{ runner.os }}-maven-${{ hashFiles('**/server/pom.xml') }} + restore-keys: | + ${{ runner.os }}-maven- + - name: Set lowercase repo name id: repo run: echo "name=${GITHUB_REPOSITORY,,}" >> $GITHUB_OUTPUT diff --git a/.github/workflows/ci-pr-backend.yml b/.github/workflows/ci-pr-backend.yml index d4920b8..84714d1 100644 --- a/.github/workflows/ci-pr-backend.yml +++ b/.github/workflows/ci-pr-backend.yml @@ -26,6 +26,14 @@ jobs: with: fetch-depth: 0 + - name: Cache Maven dependencies + uses: actions/cache@v3 + with: + path: ~/.m2/repository + key: ${{ runner.os }}-maven-${{ hashFiles('**/server/pom.xml') }} + restore-keys: | + ${{ runner.os }}-maven- + - name: Run Check Style working-directory: ./server run: ./mvnw --no-transfer-progress checkstyle:check -Dcheckstyle.skip=false @@ -53,6 +61,14 @@ jobs: with: fetch-depth: 0 + - name: Cache Maven dependencies + uses: actions/cache@v3 + with: + path: ~/.m2/repository + key: ${{ runner.os }}-maven-${{ hashFiles('**/server/pom.xml') }} + restore-keys: | + ${{ runner.os }}-maven- + - name: Set lowercase repo name id: repo run: echo "name=${GITHUB_REPOSITORY,,}" >> $GITHUB_OUTPUT diff --git a/.github/workflows/ci-pr-frontend.yml b/.github/workflows/ci-pr-frontend.yml index bb83ade..67bacf0 100644 --- a/.github/workflows/ci-pr-frontend.yml +++ b/.github/workflows/ci-pr-frontend.yml @@ -31,11 +31,13 @@ jobs: with: fetch-depth: 0 - - name: Set up Node.js - uses: actions/setup-node@v4 + - name: Cache npm dependencies + uses: actions/cache@v3 with: - node-version: '20' - cache: 'npm' + path: ~/.npm + key: ${{ runner.os }}-npm-${{ hashFiles('**/client/package-lock.json') }} + restore-keys: | + ${{ runner.os }}-npm- - name: Install dependencies run: npm install