From f8a3e3096e83821ebc514cc4b4b0cfdac0d39f8f Mon Sep 17 00:00:00 2001 From: aitbc1 Date: Fri, 27 Mar 2026 22:14:34 +0100 Subject: [PATCH] feat: optimize Node.js installation in CLI workflow MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit NODE.JS OPTIMIZATION: Use existing installation and improve version management Improvements: ✅ Node.js 24: Uses existing installation (24.13.0) - skips reinstall ✅ Node.js 20: Installs LTS version for stability testing ✅ Version-specific logic: Different handling for each version ✅ Better logging: Clear version information and actions Benefits: - Faster execution for Node.js 24 job (no reinstall needed) - Proper LTS stability testing with Node.js 20 - Clear visibility of which version is being used - Reduced network requests and installation time Rationale: - gitea-runner already has Node.js 24.13.0 installed - Node.js 20 LTS is available via apt repos for stability testing - No need to reinstall Node.js 24 on every workflow run - Optimized for the actual production environment This makes CLI testing faster and more efficient while maintaining both current version testing (24) and LTS stability testing (20). --- .gitea/workflows/cli-level1-tests.yml | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/.gitea/workflows/cli-level1-tests.yml b/.gitea/workflows/cli-level1-tests.yml index f6a7d640..5c10d249 100644 --- a/.gitea/workflows/cli-level1-tests.yml +++ b/.gitea/workflows/cli-level1-tests.yml @@ -48,8 +48,23 @@ jobs: if [ -f "package.json" ]; then echo "✅ Node.js project detected!" echo "=== NODE.JS SETUP ===" - curl -fsSL https://deb.nodesource.com/setup_${{ matrix.node-version }}.x | bash - - apt-get install -y nodejs + echo "Current Node.js version: $(node -v)" + echo "Target Node.js version: ${{ matrix.node-version }}" + + # Node.js version management + if [[ "${{ matrix.node-version }}" == "24" ]]; then + echo "✅ Node.js 24 already installed and current" + echo "Skipping installation - using existing Node.js 24.13.0" + elif [[ "${{ matrix.node-version }}" == "20" ]]; then + echo "Installing Node.js 20 LTS for stability testing..." + curl -fsSL https://deb.nodesource.com/setup_20.x | bash - + apt-get install -y nodejs + echo "Node.js 20 installed: $(node -v)" + else + echo "Installing Node.js ${{ matrix.node-version }}..." + curl -fsSL https://deb.nodesource.com/setup_${{ matrix.node-version }}.x | bash - + apt-get install -y nodejs + fi echo "=== NPM INSTALL ===" npm install --legacy-peer-deps