66 - main
77 - ' build/**'
88 - ' docs/**'
9+ pull_request :
10+ branches :
11+ - main
12+ workflow_dispatch :
913
1014jobs :
1115 unit-tests :
@@ -19,20 +23,19 @@ jobs:
1923 - name : Set up Go
2024 uses : actions/setup-go@v5
2125 with :
22- go-version : ' 1.21.x'
23- cache : true
26+ go-version : ' 1.21'
2427
25- - name : Build
26- run : go build -v ./...
28+ - name : Run unit tests
29+ run : |
30+ go test -parallel 4 -count=1 -v ./tests/...
31+ timeout-minutes : 5
2732
28- - name : Test with coverage
29- env :
30- PILOT_LOG_LEVEL : error
33+ - name : Generate coverage
3134 run : |
3235 mkdir -p coverage
33- go test -short -parallel 4 -count=1 -coverprofile=coverage/coverage.out -covermode=atomic -timeout 10m ./tests/
36+ cd tests && go test -parallel 4 -count=1 -coverprofile=../coverage/coverage.out -covermode=atomic -timeout 30s
37+ cd ..
3438 go tool cover -func=coverage/coverage.out | tail -1 | awk '{print "Total coverage: " $3}'
35- timeout-minutes : 15
3639
3740 - name : Upload coverage
3841 uses : actions/upload-artifact@v4
6063 ./validate.sh
6164
6265 - name : Run integration tests
63- env :
64- PILOT_LOG_LEVEL : error
6566 run : |
6667 cd tests/integration
67- set +e
68- make test 2>&1 | tee /tmp/integration_output.txt
69- TEST_EXIT_CODE=${PIPESTATUS[0]}
70-
71- # Always show test results
72- echo ""
73- echo "=== CLI Test Results ==="
74- if [ -f results/cli_results.txt ]; then
75- grep -E "Test Summary|Passed:|Failed:" results/cli_results.txt
76- fi
77-
78- echo ""
79- echo "=== SDK Test Results ==="
80- if [ -f results/sdk_results.txt ]; then
81- grep -E "Test Summary|Passed:|Failed:" results/sdk_results.txt
82- fi
83-
84- # If tests failed, show failures
85- if [ $TEST_EXIT_CODE -ne 0 ]; then
86- echo "::error::Integration tests failed with exit code $TEST_EXIT_CODE"
87- echo ""
88- echo "=== Failed Tests ==="
89- grep -E "\[FAIL\]" results/*.txt 2>/dev/null || echo "No specific test failures found"
90- exit $TEST_EXIT_CODE
91- fi
68+ make test
9269 timeout-minutes : 10
9370
9471 - name : Upload test results
@@ -123,8 +100,7 @@ jobs:
123100 - name : Check for test failures
124101 if : always()
125102 run : |
126- # Check if any test has non-zero failures
127- if grep -E "Failed: [1-9][0-9]*" tests/integration/results/*.txt 2>/dev/null; then
103+ if grep -q "Failed: [^0]" tests/integration/results/*.txt 2>/dev/null; then
128104 echo "⚠️ Some tests failed"
129105 exit 1
130106 fi
0 commit comments