From c3a05719f5a319a9ce241c053e9c9c677015de24 Mon Sep 17 00:00:00 2001 From: "Gan, Jimmy" Date: Wed, 22 Apr 2026 00:50:45 +0800 Subject: [PATCH] perf: remove tests from dev deploy workflow for speed The dev workflow now focuses on fast deployment iteration. Use test.yml workflow for comprehensive testing before merging to main. --- .gitea/workflows/deploy-dev.yml | 132 -------------------------------- 1 file changed, 132 deletions(-) diff --git a/.gitea/workflows/deploy-dev.yml b/.gitea/workflows/deploy-dev.yml index 7a8ba37..3bf1218 100644 --- a/.gitea/workflows/deploy-dev.yml +++ b/.gitea/workflows/deploy-dev.yml @@ -11,141 +11,9 @@ concurrency: cancel-in-progress: true jobs: - # Run tests first - inline instead of reusable workflow - backend-tests: - name: Backend Tests - runs-on: ubuntu-latest - env: - SECRET_KEY: test-secret-key-for-ci-environment-32chars-minimum - - steps: - - name: Checkout repository - uses: actions/checkout@v4 - with: - fetch-depth: 1 - - - name: Setup Python - run: | - python3 --version - pip3 --version - - - name: Cache Python dependencies - id: cache-python - run: | - CACHE_KEY="python-$(cat dashboard/backend/requirements.txt dashboard/backend/requirements-dev.txt | md5sum | cut -d' ' -f1)" - CACHE_DIR="/tmp/pytest-cache/$CACHE_KEY" - PIP_CACHE_DIR="/tmp/pip-cache" - echo "CACHE_DIR=$CACHE_DIR" >> $GITHUB_ENV - echo "CACHE_KEY=$CACHE_KEY" >> $GITHUB_ENV - echo "PIP_CACHE_DIR=$PIP_CACHE_DIR" >> $GITHUB_ENV - mkdir -p "$PIP_CACHE_DIR" - if [ -d "$CACHE_DIR" ]; then - echo "Cache hit for $CACHE_KEY" - echo "cache-hit=true" >> $GITHUB_OUTPUT - else - echo "Cache miss for $CACHE_KEY" - echo "cache-hit=false" >> $GITHUB_OUTPUT - mkdir -p "$CACHE_DIR" - fi - - - name: Install dependencies - run: | - cd dashboard/backend - if [ "${{ steps.cache-python.outputs.cache-hit }}" = "true" ]; then - echo "Restoring venv from cache $CACHE_KEY..." - cp -a $CACHE_DIR/venv . - else - echo "Installing fresh dependencies..." - python3 -m venv venv - . venv/bin/activate - pip install --cache-dir=$PIP_CACHE_DIR -r requirements.txt - pip install --cache-dir=$PIP_CACHE_DIR -r requirements-dev.txt - pip install --cache-dir=$PIP_CACHE_DIR pytest-timeout pytest-cov - echo "Saving venv to cache $CACHE_KEY..." - cp -a venv $CACHE_DIR/ - fi - - - name: Run tests with coverage - run: | - cd dashboard/backend - . venv/bin/activate - # Run tests without coverage for speed - pytest tests/ -v --timeout=60 -x || true - - TEST_EXIT_CODE=$? - if [ $TEST_EXIT_CODE -ne 0 ]; then - echo "⚠️ Backend tests had issues (exit code: $TEST_EXIT_CODE)" - echo "Continuing anyway for CI workflow verification..." - else - echo "✅ Backend tests passed" - fi - - frontend-tests: - name: Frontend Tests - runs-on: ubuntu-latest - - steps: - - name: Checkout repository - uses: actions/checkout@v4 - with: - fetch-depth: 1 - - - name: Setup Node.js - run: | - node --version - npm --version - - - name: Cache Node dependencies - id: cache-node - run: | - CACHE_KEY="node-$(md5sum dashboard/frontend/package-lock.json | cut -d' ' -f1)" - CACHE_DIR="/tmp/npm-cache/$CACHE_KEY" - echo "CACHE_DIR=$CACHE_DIR" >> $GITHUB_ENV - echo "CACHE_KEY=$CACHE_KEY" >> $GITHUB_ENV - if [ -d "$CACHE_DIR" ]; then - echo "Cache hit for $CACHE_KEY" - echo "cache-hit=true" >> $GITHUB_OUTPUT - else - echo "Cache miss for $CACHE_KEY" - echo "cache-hit=false" >> $GITHUB_OUTPUT - mkdir -p "$CACHE_DIR" - fi - - - name: Install dependencies - env: - NODE_OPTIONS: "--max-old-space-size=2048" - run: | - cd dashboard/frontend - if [ "${{ steps.cache-node.outputs.cache-hit }}" = "true" ]; then - echo "Restoring from cache $CACHE_KEY..." - cp -a $CACHE_DIR/node_modules . - else - echo "Installing fresh dependencies..." - npm ci - echo "Saving to cache $CACHE_KEY..." - cp -a node_modules $CACHE_DIR/ - fi - - - name: Run tests - env: - NODE_OPTIONS: "--max-old-space-size=2048" - run: | - cd dashboard/frontend - # Run tests without coverage for speed - npm run test -- --reporter=verbose --run -x || true - - TEST_EXIT_CODE=$? - if [ $TEST_EXIT_CODE -ne 0 ]; then - echo "⚠️ Frontend tests had issues (exit code: $TEST_EXIT_CODE)" - echo "Continuing anyway for CI workflow verification..." - else - echo "✅ Frontend tests passed" - fi - deploy-dev: name: Deploy to Dev runs-on: ubuntu-latest - needs: [backend-tests, frontend-tests] steps: - name: Checkout repository uses: actions/checkout@v4