@@ -56,20 +56,51 @@ jobs:
5656 id : checkout
5757 uses : actions/checkout@v5
5858
59+ - name : Setup Node.js
60+ uses : actions/setup-node@v4
61+ with :
62+ node-version-file : .node-version
63+
64+ - name : Start Mock Inference Server
65+ id : mock-server
66+ run : |
67+ node script/mock-inference-server.mjs &
68+ echo "pid=$!" >> $GITHUB_OUTPUT
69+ # Wait for server to be ready
70+ for i in {1..10}; do
71+ if curl -s http://localhost:3456/health > /dev/null; then
72+ echo "Mock server is ready"
73+ break
74+ fi
75+ sleep 1
76+ done
77+
5978 - name : Test Local Action
6079 id : test-action
61- continue-on-error : true
6280 uses : ./
6381 with :
6482 prompt : hello
83+ endpoint : http://localhost:3456
6584 env :
6685 GITHUB_TOKEN : ${{ github.token }}
6786
6887 - name : Print Output
6988 id : output
70- continue-on-error : true
7189 run : echo "${{ steps.test-action.outputs.response }}"
7290
91+ - name : Verify Output
92+ run : |
93+ response="${{ steps.test-action.outputs.response }}"
94+ if [[ -z "$response" ]]; then
95+ echo "Error: No response received"
96+ exit 1
97+ fi
98+ echo "Response received: $response"
99+
100+ - name : Stop Mock Server
101+ if : always()
102+ run : kill ${{ steps.mock-server.outputs.pid }} || true
103+
73104 test-action-prompt-file :
74105 name : GitHub Actions Test with Prompt File
75106 runs-on : ubuntu-latest
@@ -79,6 +110,25 @@ jobs:
79110 id : checkout
80111 uses : actions/checkout@v5
81112
113+ - name : Setup Node.js
114+ uses : actions/setup-node@v4
115+ with :
116+ node-version-file : .node-version
117+
118+ - name : Start Mock Inference Server
119+ id : mock-server
120+ run : |
121+ node script/mock-inference-server.mjs &
122+ echo "pid=$!" >> $GITHUB_OUTPUT
123+ # Wait for server to be ready
124+ for i in {1..10}; do
125+ if curl -s http://localhost:3456/health > /dev/null; then
126+ echo "Mock server is ready"
127+ break
128+ fi
129+ sleep 1
130+ done
131+
82132 - name : Create Prompt File
83133 run : echo "hello" > prompt.txt
84134
@@ -87,16 +137,33 @@ jobs:
87137
88138 - name : Test Local Action with Prompt File
89139 id : test-action-prompt-file
90- continue-on-error : true
91140 uses : ./
92141 with :
93142 prompt-file : prompt.txt
94143 system-prompt-file : system-prompt.txt
144+ endpoint : http://localhost:3456
95145 env :
96146 GITHUB_TOKEN : ${{ github.token }}
97147
98148 - name : Print Output
99- continue-on-error : true
100149 run : |
101150 echo "Response saved to: ${{ steps.test-action-prompt-file.outputs.response-file }}"
102151 cat "${{ steps.test-action-prompt-file.outputs.response-file }}"
152+
153+ - name : Verify Output
154+ run : |
155+ response_file="${{ steps.test-action-prompt-file.outputs.response-file }}"
156+ if [[ ! -f "$response_file" ]]; then
157+ echo "Error: Response file not found"
158+ exit 1
159+ fi
160+ content=$(cat "$response_file")
161+ if [[ -z "$content" ]]; then
162+ echo "Error: Response file is empty"
163+ exit 1
164+ fi
165+ echo "Response file content: $content"
166+
167+ - name : Stop Mock Server
168+ if : always()
169+ run : kill ${{ steps.mock-server.outputs.pid }} || true
0 commit comments