improve code quality (Run ID: openSVM_zup_issue_1_44a73718) #44
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: gRPC Tests | |
| on: | |
| push: | |
| branches: [ main ] | |
| pull_request: | |
| branches: [ main ] | |
| workflow_dispatch: # Allow manual triggers | |
| jobs: | |
| test: | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 10 # Set overall job timeout | |
| steps: | |
| - uses: actions/checkout@v4 | |
| # Cache Docker layers | |
| - name: Cache Docker layers | |
| uses: actions/cache@v3 | |
| with: | |
| path: /tmp/.buildx-cache | |
| key: ${{ runner.os }}-buildx-${{ github.sha }} | |
| restore-keys: | | |
| ${{ runner.os }}-buildx- | |
| - name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@v3 | |
| with: | |
| buildkitd-flags: --debug | |
| - name: Make scripts executable | |
| run: | | |
| chmod +x scripts/run_grpc_tests_local.sh | |
| chmod +x scripts/run_grpc_tests.sh | |
| chmod +x scripts/test.sh | |
| - name: Network validation | |
| run: | | |
| echo "=== Network Configuration ===" | |
| ip addr | |
| netstat -tulpn || true | |
| ss -tulpn || true | |
| - name: Build and run tests | |
| timeout-minutes: 5 # Set specific step timeout | |
| run: | | |
| # Enable debug output | |
| set -x | |
| # Create logs directory | |
| mkdir -p logs | |
| # Build the test image with cache | |
| docker build \ | |
| --cache-from=type=local,src=/tmp/.buildx-cache \ | |
| --cache-to=type=local,dest=/tmp/.buildx-cache-new \ | |
| -t opensvm-grpc-test \ | |
| -f Dockerfile.test \ | |
| --progress=plain \ | |
| . | |
| # Create docker network | |
| docker network create grpc-test-net || true | |
| # Run tests with resource limits and timeout | |
| docker run \ | |
| --rm \ | |
| --memory=2g \ | |
| --cpus=2 \ | |
| --name opensvm-grpc-test \ | |
| --network grpc-test-net \ | |
| -e RUST_BACKTRACE=1 \ | |
| -e ZIG_DEBUG_LOG=debug \ | |
| -e TEST_PORT=8089 \ | |
| -p 8089:8089 \ | |
| -v "$(pwd)/logs:/app/logs" \ | |
| -v "$(pwd)/zig-cache:/app/zig-cache" \ | |
| opensvm-grpc-test \ | |
| bash -c "timeout 45s strace -f ./scripts/run_grpc_tests_local.sh 2>&1 | tee logs/strace.log" | |
| # Cleanup network | |
| docker network rm grpc-test-net || true | |
| # Move cache | |
| rm -rf /tmp/.buildx-cache | |
| mv /tmp/.buildx-cache-new /tmp/.buildx-cache | |
| - name: Upload test logs | |
| if: always() # Upload logs even if tests fail | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: test-logs | |
| path: | | |
| logs/ | |
| zig-out/ | |
| zig-cache/ | |
| /tmp/.buildx-cache |