diff --git a/.dockerignore b/.dockerignore index 9aedf20f..658835f6 100644 --- a/.dockerignore +++ b/.dockerignore @@ -1,5 +1,6 @@ node_modules .next +!.next/cache .git .DS_Store .env diff --git a/.gitea/workflows/deploy.yml b/.gitea/workflows/deploy.yml index 3e80aaa4..114e2e6d 100644 --- a/.gitea/workflows/deploy.yml +++ b/.gitea/workflows/deploy.yml @@ -9,10 +9,9 @@ on: workflow_dispatch: inputs: skip_long_checks: - description: 'Lange Tests / Scans ΓΌberspringen? (Hotfix / Eilt!)' + description: 'Skip tests? (true/false)' required: false - type: boolean - default: false + default: 'false' concurrency: group: ${{ github.workflow }} @@ -137,22 +136,27 @@ jobs: - name: Install dependencies run: npm ci - - name: πŸ” Lint & Typecheck + - name: πŸ§ͺ Run Checks in Parallel if: github.event.inputs.skip_long_checks != 'true' run: | - npm run lint - npm run typecheck + npm run lint & + LINT_PID=$! + npm run typecheck & + TYPE_PID=$! + npm run test & + TEST_PID=$! - - name: πŸ§ͺ Test - if: github.event.inputs.skip_long_checks != 'true' - run: npm run test + # Wait for all and fail if any fail + wait $LINT_PID || exit 1 + wait $TYPE_PID || exit 1 + wait $TEST_PID || exit 1 # ────────────────────────────────────────────────────────────────────────────── # JOB 3: Build & Push Docker Image # ────────────────────────────────────────────────────────────────────────────── build: name: πŸ—οΈ Build & Push - needs: [prepare, qa] + needs: prepare runs-on: docker steps: - name: Checkout repository @@ -162,6 +166,15 @@ jobs: run: | echo "${{ secrets.REGISTRY_PASS }}" | docker login registry.infra.mintel.me -u "${{ secrets.REGISTRY_USER }}" --password-stdin + - name: πŸ“¦ Restore Next.js cache + uses: actions/cache@v4 + with: + path: .next/cache + key: ${{ runner.os }}-nextjs-${{ hashFiles('**/package-lock.json') }}-${{ hashFiles('**/*.js', '**/*.jsx', '**/*.ts', '**/*.tsx') }} + restore-keys: | + ${{ runner.os }}-nextjs-${{ hashFiles('**/package-lock.json') }}- + ${{ runner.os }}-nextjs- + - name: πŸ—οΈ Docker Image bauen & pushen env: IMAGE_TAG: ${{ needs.prepare.outputs.image_tag }} @@ -184,12 +197,19 @@ jobs: --cache-to type=registry,ref=registry.infra.mintel.me/mintel/klz-cables.com:buildcache,mode=max \ --push . + - name: πŸ“¦ Save Next.js cache + uses: actions/cache/save@v4 + if: always() + with: + path: .next/cache + key: ${{ runner.os }}-nextjs-${{ hashFiles('**/package-lock.json') }}-${{ hashFiles('**/*.js', '**/*.jsx', '**/*.ts', '**/*.tsx') }} + # ────────────────────────────────────────────────────────────────────────────── # JOB 4: Deploy via SSH # ────────────────────────────────────────────────────────────────────────────── deploy: name: πŸš€ Deploy - needs: [prepare, build] + needs: [prepare, build, qa] runs-on: docker env: TARGET: ${{ needs.prepare.outputs.target }}