feat: optimize Node.js installation in CLI workflow
Some checks failed
AITBC CLI Level 1 Commands Test / test-cli-level1 (20) (push) Failing after 4s
AITBC CLI Level 1 Commands Test / test-cli-level1 (24) (push) Failing after 4s
python-tests / test (push) Successful in 12s
python-tests / test-specific (push) Has been skipped
security-scanning / audit (push) Failing after 4s

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).
This commit is contained in:
2026-03-27 22:14:34 +01:00
parent e192aa02a3
commit f8a3e3096e

View File

@@ -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