ci.yml 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141
  1. name: CI
  2. on:
  3. workflow_call:
  4. workflow_dispatch:
  5. push:
  6. branches:
  7. - "**"
  8. tags:
  9. - "v*.*.*"
  10. paths-ignore:
  11. - "**/*.md"
  12. - "**/*.yaml"
  13. pull_request:
  14. branches:
  15. - "**"
  16. paths-ignore:
  17. - "**/*.md"
  18. - "**/*.yaml"
  19. jobs:
  20. golangci-lint-aiproxy:
  21. name: Lint AI Proxy
  22. runs-on: ubuntu-24.04
  23. steps:
  24. - name: Checkout
  25. uses: actions/checkout@v6
  26. - name: Setup Go
  27. uses: actions/setup-go@v6
  28. with:
  29. go-version-file: "core/go.mod"
  30. - name: Go test
  31. working-directory: core
  32. run: |
  33. go test -v -timeout 30s -count=1 ./...
  34. - name: Run Linter
  35. uses: golangci/golangci-lint-action@v9
  36. with:
  37. version: latest
  38. working-directory: core
  39. args: --color=always --path-mode=abs
  40. - name: Run Fix Linter
  41. uses: golangci/golangci-lint-action@v9
  42. if: ${{ failure() }}
  43. with:
  44. install-mode: none
  45. working-directory: core
  46. args: --fix --color=always --path-mode=abs
  47. - name: Auto Fix Diff Content
  48. if: ${{ failure() }}
  49. run: |
  50. if git diff --exit-code --color=always; then
  51. echo "No changes detected after auto-fix"
  52. else
  53. git diff --color=always
  54. exit 1
  55. fi
  56. golangci-lint-mcpservers:
  57. name: Lint MCP Servers
  58. runs-on: ubuntu-24.04
  59. steps:
  60. - name: Checkout
  61. uses: actions/checkout@v6
  62. - name: Setup Go
  63. uses: actions/setup-go@v6
  64. with:
  65. go-version-file: "mcp-servers/go.mod"
  66. - name: Go test
  67. working-directory: mcp-servers
  68. run: |
  69. go test -v -timeout 30s -count=1 ./...
  70. - name: Run Linter
  71. uses: golangci/golangci-lint-action@v9
  72. with:
  73. version: latest
  74. working-directory: mcp-servers
  75. args: --color=always --path-mode=abs
  76. - name: Run Fix Linter
  77. uses: golangci/golangci-lint-action@v9
  78. if: ${{ failure() }}
  79. with:
  80. install-mode: none
  81. working-directory: mcp-servers
  82. args: --fix --color=always --path-mode=abs
  83. - name: Auto Fix Diff Content
  84. if: ${{ failure() }}
  85. run: |
  86. if git diff --exit-code --color=always; then
  87. echo "No changes detected after auto-fix"
  88. else
  89. git diff --color=always
  90. exit 1
  91. fi
  92. golangci-lint-openapimcp:
  93. name: Lint OpneAPI MCP
  94. runs-on: ubuntu-24.04
  95. steps:
  96. - name: Checkout
  97. uses: actions/checkout@v6
  98. - name: Setup Go
  99. uses: actions/setup-go@v6
  100. with:
  101. go-version-file: "openapi-mcp/go.mod"
  102. - name: Run Linter
  103. uses: golangci/golangci-lint-action@v9
  104. with:
  105. version: latest
  106. working-directory: openapi-mcp
  107. args: --color=always --path-mode=abs
  108. - name: Run Fix Linter
  109. uses: golangci/golangci-lint-action@v9
  110. if: ${{ failure() }}
  111. with:
  112. install-mode: none
  113. working-directory: openapi-mcp
  114. args: --fix --color=always --path-mode=abs
  115. - name: Auto Fix Diff Content
  116. if: ${{ failure() }}
  117. run: |
  118. if git diff --exit-code --color=always; then
  119. echo "No changes detected after auto-fix"
  120. else
  121. git diff --color=always
  122. exit 1
  123. fi