Improve CI workflow for local testing compatibility
Some checks failed
CI/CD Pipeline / backend-lint (push) Failing after 45s
CI/CD Pipeline / backend-build (push) Has been skipped
CI/CD Pipeline / frontend-lint (push) Successful in 1m38s
CI/CD Pipeline / frontend-build (push) Failing after 35s
CI/CD Pipeline / e2e-test (push) Has been skipped

- 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
This commit is contained in:
Damir Mukimov 2025-12-26 15:28:12 +01:00
parent ff9417168c
commit 7a93ae04f7
No known key found for this signature in database
GPG Key ID: 42996CC7C73BC750

View File

@ -25,11 +25,16 @@ jobs:
with: with:
node-version: '24' node-version: '24'
- name: Enable Corepack (for Yarn) - name: Enable Corepack (for Yarn)
uses: actions/setup-node@v4 run: |
with: # Check if we're in act environment
node-version: '24' if [ -n "$ACT" ] || [ -d "/root/.cache/act" ]; then
- name: Enable Corepack (for Yarn) echo "⚠ Detected 'act' local runner - Node.js may not be fully available"
run: corepack enable 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 - name: Install dependencies
working-directory: bugulma/frontend working-directory: bugulma/frontend
run: yarn install --immutable run: yarn install --immutable
@ -101,7 +106,6 @@ jobs:
echo "⚠ Detected 'act' local runner environment" echo "⚠ Detected 'act' local runner environment"
echo "⚠ This workflow is designed for real CI runners (GitHub Actions/Gitea Actions)" 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 "⚠ 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 echo "SKIP_POSTGRESQL=true" >> $GITHUB_ENV
exit 0 exit 0
fi fi
@ -254,29 +258,8 @@ jobs:
if [ "$SKIP_POSTGRESQL" = "true" ]; then if [ "$SKIP_POSTGRESQL" = "true" ]; then
echo "⚠ PostgreSQL was skipped (local runner environment)" echo "⚠ PostgreSQL was skipped (local runner environment)"
echo "⚠ Running only non-database tests..." 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 # 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 \ $TEST_CMD \
./internal/geospatial/... \ ./internal/geospatial/... \
./internal/financial/... \ ./internal/financial/... \
@ -376,4 +359,4 @@ jobs:
run: yarn install --immutable run: yarn install --immutable
- name: Run E2E tests - name: Run E2E tests
working-directory: bugulma/frontend working-directory: bugulma/frontend
run: yarn test:e2e --headed=false run: yarn test:e2e --headed=false