From 7a93ae04f77993d37c02f5ab38985cb8ff910667 Mon Sep 17 00:00:00 2001 From: Damir Mukimov Date: Fri, 26 Dec 2025 15:28:12 +0100 Subject: [PATCH] Improve CI workflow for local testing compatibility - Add checks to detect 'act' local runner environment and conditionally skip Corepack setup - Enhance output messages to inform users about limitations in local testing scenarios - Refactor test execution to clarify which tests are run when PostgreSQL is skipped --- .gitea/workflows/ci.yml | 41 ++++++++++++----------------------------- 1 file changed, 12 insertions(+), 29 deletions(-) diff --git a/.gitea/workflows/ci.yml b/.gitea/workflows/ci.yml index 90ea77b..bb2e678 100644 --- a/.gitea/workflows/ci.yml +++ b/.gitea/workflows/ci.yml @@ -25,11 +25,16 @@ jobs: with: node-version: '24' - name: Enable Corepack (for Yarn) - uses: actions/setup-node@v4 - with: - node-version: '24' - - name: Enable Corepack (for Yarn) - run: corepack enable + run: | + # Check if we're in act environment + if [ -n "$ACT" ] || [ -d "/root/.cache/act" ]; then + echo "⚠ Detected 'act' local runner - Node.js may not be fully available" + echo "⚠ Corepack setup may be limited in this environment" + # Skip corepack in act environment as Node.js path may be wrong + echo "✅ Skipping Corepack setup for local runner" + else + corepack enable + fi - name: Install dependencies working-directory: bugulma/frontend run: yarn install --immutable @@ -101,7 +106,6 @@ jobs: echo "⚠ Detected 'act' local runner environment" echo "⚠ This workflow is designed for real CI runners (GitHub Actions/Gitea Actions)" echo "⚠ For local testing, use Docker Compose or install PostgreSQL locally" - echo "⚠ Skipping PostgreSQL installation - tests will fail but workflow structure is correct" echo "SKIP_POSTGRESQL=true" >> $GITHUB_ENV exit 0 fi @@ -254,29 +258,8 @@ jobs: if [ "$SKIP_POSTGRESQL" = "true" ]; then echo "⚠ PostgreSQL was skipped (local runner environment)" echo "⚠ Running only non-database tests..." - echo "⚠ For full testing, use real CI runners or Docker Compose locally" - - # Check if CGO is available for race detector - CGO_AVAILABLE="${{ steps.cgo-setup.outputs.cgo_available || '0' }}" - - # Build test command - TEST_CMD="go test -v" - - # Add race detector if CGO is available - if [ "$CGO_AVAILABLE" = "1" ] && command -v gcc &> /dev/null; then - echo "Running tests with race detector..." - TEST_CMD="$TEST_CMD -race" - export CGO_ENABLED=1 - else - echo "Running tests without race detector (CGO not available)..." - export CGO_ENABLED=0 - fi - - # Add coverage - TEST_CMD="$TEST_CMD -coverprofile=coverage.out" - # Run only non-database dependent tests - echo "Running geospatial, financial, graph, and utility tests..." + # These packages don't require database: geospatial, financial, graph, matching/plugins, middleware, pkg $TEST_CMD \ ./internal/geospatial/... \ ./internal/financial/... \ @@ -376,4 +359,4 @@ jobs: run: yarn install --immutable - name: Run E2E tests working-directory: bugulma/frontend - run: yarn test:e2e --headed=false + run: yarn test:e2e --headed=false \ No newline at end of file