From 68783ce04073a3cd80ce4e22720b5459e34bfbc2 Mon Sep 17 00:00:00 2001 From: Daniel Date: Sun, 8 Mar 2026 16:35:48 +0100 Subject: [PATCH] =?UTF-8?q?CI:=20Electron-Build=20beschleunigt=20(~5min=20?= =?UTF-8?q?=E2=86=92=20~2min)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Custom Image electron-builder:latest (Mono + Docker CLI vorinstalliert) - pull_policy: if-not-present (lokales Image, kein Registry-Pull) - GitLab CI Cache für node_modules - npm/Electron Cache-Verzeichnisse in /cache/ - npm ci --prefer-offline nutzt Cache wenn vorhanden - before_script entfällt komplett (kein apt-get, kein curl) Co-Authored-By: Claude Opus 4.6 --- .gitlab-ci.yml | 24 +++++++++++++++++------- 1 file changed, 17 insertions(+), 7 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 738862d..642086f 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -69,7 +69,9 @@ docker-build: electron-build: stage: deploy - image: electronuserland/builder:wine + image: + name: electron-builder:latest + pull_policy: if-not-present needs: [deploy] rules: - if: $CI_COMMIT_BRANCH == "main" @@ -80,15 +82,21 @@ electron-build: allow_failure: true variables: CONTAINER_NAME: "gaming-hub" - before_script: - - apt-get update && apt-get install -y --no-install-recommends mono-devel && rm -rf /var/lib/apt/lists/* - - curl -fsSL https://download.docker.com/linux/static/stable/x86_64/docker-27.5.1.tgz | tar xzv --strip-components=1 -C /usr/local/bin docker/docker + ELECTRON_CACHE: "/cache/electron" + electron_config_cache: "/cache/electron" + npm_config_cache: "/cache/npm" + cache: + key: electron-deps-${CI_COMMIT_REF_SLUG} + paths: + - electron/node_modules/ + policy: pull-push script: - | VERSION=$(cat VERSION 2>/dev/null || echo "0.0.0") echo "[Electron] Building v${VERSION} for Windows..." - echo "[Electron] Wine: $(wine --version 2>/dev/null || echo 'not found')" - echo "[Electron] Mono: $(mono --version 2>/dev/null | head -1 || echo 'not found')" + + # Cache-Verzeichnisse sicherstellen + mkdir -p "$ELECTRON_CACHE" "$npm_config_cache" cd electron node -e " @@ -96,7 +104,9 @@ electron-build: pkg.version = '${VERSION}'; require('fs').writeFileSync('package.json', JSON.stringify(pkg, null, 2) + '\n'); " - npm ci --no-audit --no-fund + + # npm ci mit Cache — prefer-offline nutzt Cache wenn vorhanden + npm ci --no-audit --no-fund --prefer-offline npx electron-forge make --platform win32 --arch x64 # --- Deploy directly (no artifact upload needed) ---