1010
1111jobs :
1212 build-test :
13- name : Install, Build and Test
13+ name : Build and Start Check
1414 runs-on : ubuntu-latest
1515
1616 steps :
@@ -23,31 +23,34 @@ jobs:
2323 go-version : ' 1.22'
2424 cache-dependency-path : go.mod
2525
26- - name : Cache Go modules
27- uses : actions/cache@v4
28- with :
29- path : |
30- ~/.cache/go-build
31- ~/go/pkg/mod
32- key : ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
33- restore-keys : |
34- ${{ runner.os }}-go-
35-
3626 - name : Download dependencies
3727 run : go mod download
3828
39- - name : Run Go Tests
40- run : go test -v -race -coverprofile=coverage.out ./...
41-
4229 - name : Build Go Application
4330 run : go build -v -o ./app ./cmd/gateway
4431
45- - name : Upload Test Coverage
46- if : always()
47- uses : actions/upload-artifact@v4
48- with :
49- name : api-gateway-coverage
50- path : coverage.out
32+ - name : Verify config.yaml exists
33+ run : |
34+ if [ ! -f config.yaml ]; then
35+ echo "Error: config.yaml not found!"
36+ exit 1
37+ fi
38+ echo "✓ config.yaml found"
39+
40+ - name : Start Gateway (smoke test)
41+ run : |
42+ echo "Starting API Gateway with config.yaml..."
43+ timeout 5s ./app || code=$?
44+ if [ ${code:-0} -eq 124 ]; then
45+ echo "✓ Gateway started successfully (terminated after 5s)"
46+ exit 0
47+ elif [ ${code:-0} -eq 0 ]; then
48+ echo "✓ Gateway started and stopped cleanly"
49+ exit 0
50+ else
51+ echo "✗ Gateway failed to start (exit code: ${code})"
52+ exit 1
53+ fi
5154
5255 - name : Upload Build Artifact
5356 if : success()
0 commit comments