Skip to content

Commit

Permalink
optimize: workflow test unit
Browse files Browse the repository at this point in the history
Signed-off-by: MicroOps <[email protected]>
  • Loading branch information
MicroOps-cn committed Oct 22, 2024
1 parent cf555ff commit 0cd535c
Showing 1 changed file with 28 additions and 1 deletion.
29 changes: 28 additions & 1 deletion .github/workflows/github-actions-build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,31 @@ jobs:
with:
node-version: 20
- run: make ui
- run: make test idas
- run: make test idas
- name: "Test init command"
run: dist/idas --config examples/simple.yaml init
- name: "Test migrate command"
run: dist/idas --config examples/simple.yaml migrate
- name: "Test config display"
run: dist/idas --config examples/simple.yaml --config.display
- name: Start service
run: | # 启动一个监听端口的进程,例如一个简单的 HTTP 服务器
dist/idas --config examples/simple.yaml
echo $! > server.pid
shell: bash
- name: Wait for service to start
run: sleep 5
- name: "Test login action"
run: |
errorCode=$(curl http://192.168.100.65:8081/api/v1/user/login -H 'Content-Type: application/json' -d '{"username":"admin","password":"idas","type":"normal"}'|jq ".errorCode" -r)
if [ "$errorCode" != "E0004" ]; then
echo "Login result code is not E0004"
exit 1
fi
shell: bash
- name: Stop service
if: always()
run: | # 停止服务
kill $(cat server.pid)
rm server.pid
shell: bash

0 comments on commit 0cd535c

Please sign in to comment.