From d74fd150360303460753b1ebdd2d07043a90b7b5 Mon Sep 17 00:00:00 2001 From: Mathis HERRIOT <197931332+0x485254@users.noreply.github.com> Date: Wed, 14 Jan 2026 23:51:07 +0100 Subject: [PATCH 1/2] ci(workflows): enhance workflows with matrix builds and caching optimizations Refactor GitHub Actions workflows to introduce matrix builds for `backend`, `frontend`, and `documentation` components. Upgrade actions versions, add pull request triggers, and improve caching with pnpm store integration. Adjust Node.js version to 20 and enforce `--frozen-lockfile` for dependency installation. --- .gitea/workflows/backend-tests.yml | 20 +++++++++-- .gitea/workflows/deploy.yml | 56 ++++++++++++++++-------------- .gitea/workflows/lint.yml | 36 ++++++++++++------- 3 files changed, 70 insertions(+), 42 deletions(-) diff --git a/.gitea/workflows/backend-tests.yml b/.gitea/workflows/backend-tests.yml index e0a3cdb..930abfb 100644 --- a/.gitea/workflows/backend-tests.yml +++ b/.gitea/workflows/backend-tests.yml @@ -1,8 +1,12 @@ name: Backend Tests + on: push: paths: - 'backend/**' + pull_request: + paths: + - 'backend/**' jobs: test: @@ -14,9 +18,19 @@ jobs: version: 9 - uses: actions/setup-node@v4 with: - node-version: 22 - cache: 'pnpm' + node-version: 20 + - name: Get pnpm store directory + id: pnpm-cache + shell: bash + run: | + echo "STORE_PATH=$(pnpm store path --silent)" >> "${GITEA_OUTPUT:-$GITHUB_OUTPUT}" + - uses: actions/cache@v4 + with: + path: ${{ steps.pnpm-cache.outputs.STORE_PATH }} + key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }} + restore-keys: | + ${{ runner.os }}-pnpm-store- - name: Install dependencies - run: pnpm install + run: pnpm install --frozen-lockfile - name: Run Backend Tests run: pnpm -F @memegoat/backend test diff --git a/.gitea/workflows/deploy.yml b/.gitea/workflows/deploy.yml index 5a3b938..fcd4620 100644 --- a/.gitea/workflows/deploy.yml +++ b/.gitea/workflows/deploy.yml @@ -1,61 +1,63 @@ name: Deploy to Production + on: push: branches: - prod jobs: - deploy: + validate: + name: Validate Build & Lint runs-on: ubuntu-latest + strategy: + matrix: + component: [backend, frontend, documentation] steps: - name: Checkout code - uses: actions/checkout@v3 + uses: actions/checkout@v4 + + - name: Install pnpm + uses: pnpm/action-setup@v4 + with: + version: 9 - name: Setup Node.js - uses: actions/setup-node@v3 + uses: actions/setup-node@v4 with: node-version: 20 - - name: Install pnpm - uses: pnpm/action-setup@v2 - with: - version: 8 - - name: Get pnpm store directory + id: pnpm-cache shell: bash run: | - echo "STORE_PATH=$(pnpm store path --silent)" >> $GITEA_ENV + echo "STORE_PATH=$(pnpm store path --silent)" >> "${GITEA_OUTPUT:-$GITHUB_OUTPUT}" - name: Setup pnpm cache - uses: actions/cache@v3 + uses: actions/cache@v4 with: - path: ${{ env.STORE_PATH }} + path: ${{ steps.pnpm-cache.outputs.STORE_PATH }} key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }} restore-keys: | ${{ runner.os }}-pnpm-store- - name: Install dependencies - run: pnpm install + run: pnpm install --frozen-lockfile - - name: Lint - Backend - run: pnpm run lint:back + - name: Lint ${{ matrix.component }} + run: pnpm -F @memegoat/${{ matrix.component }} lint - - name: Build - Backend - run: pnpm run build:back + - name: Build ${{ matrix.component }} + run: pnpm -F @memegoat/${{ matrix.component }} build env: NEXT_PUBLIC_API_URL: ${{ secrets.NEXT_PUBLIC_API_URL }} - - name: Lint - Frontend - run: pnpm run lint:front - - - name: Build - Frontend - run: pnpm run build:front - - - name: Lint - Documentation - run: pnpm run lint:docs - - - name: Build - Documentation - run: pnpm run build:docs + deploy: + name: Deploy to Production + needs: validate + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v4 - name: Deploy with Docker Compose run: | diff --git a/.gitea/workflows/lint.yml b/.gitea/workflows/lint.yml index e6bd4da..5e23b16 100644 --- a/.gitea/workflows/lint.yml +++ b/.gitea/workflows/lint.yml @@ -1,14 +1,23 @@ name: Lint + on: push: paths: - 'frontend/**' - 'backend/**' - 'documentation/**' + pull_request: + paths: + - 'frontend/**' + - 'backend/**' + - 'documentation/**' jobs: lint: runs-on: ubuntu-latest + strategy: + matrix: + component: [backend, frontend, documentation] steps: - uses: actions/checkout@v4 - uses: pnpm/action-setup@v4 @@ -16,16 +25,19 @@ jobs: version: 9 - uses: actions/setup-node@v4 with: - node-version: 22 - cache: 'pnpm' + node-version: 20 + - name: Get pnpm store directory + id: pnpm-cache + shell: bash + run: | + echo "STORE_PATH=$(pnpm store path --silent)" >> "${GITEA_OUTPUT:-$GITHUB_OUTPUT}" + - uses: actions/cache@v4 + with: + path: ${{ steps.pnpm-cache.outputs.STORE_PATH }} + key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }} + restore-keys: | + ${{ runner.os }}-pnpm-store- - name: Install dependencies - run: pnpm install - - name: Lint Frontend - if: success() || failure() - run: pnpm -F @memegoat/frontend lint - - name: Lint Backend - if: success() || failure() - run: pnpm -F @memegoat/backend lint - - name: Lint Documentation - if: success() || failure() - run: pnpm -F @bypass/documentation lint + run: pnpm install --frozen-lockfile + - name: Lint ${{ matrix.component }} + run: pnpm -F @memegoat/${{ matrix.component }} lint From 7048c2731e97a54c9a4ee97204c8aefa08dd1265 Mon Sep 17 00:00:00 2001 From: Mathis HERRIOT <197931332+0x485254@users.noreply.github.com> Date: Wed, 14 Jan 2026 23:51:24 +0100 Subject: [PATCH 2/2] fix(media): correct route param handling in media controller Adjust `@Get` decorator route pattern to properly handle file keys with special characters. --- backend/src/media/media.controller.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/backend/src/media/media.controller.ts b/backend/src/media/media.controller.ts index dddd313..b32e53e 100644 --- a/backend/src/media/media.controller.ts +++ b/backend/src/media/media.controller.ts @@ -6,7 +6,7 @@ import { S3Service } from "../s3/s3.service"; export class MediaController { constructor(private readonly s3Service: S3Service) {} - @Get(":key(*)") + @Get("*key") async getFile(@Param("key") key: string, @Res() res: Response) { try { const stats = await this.s3Service.getFileInfo(key);