test-agents.yml 7.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251
  1. name: Test Agents
  2. on:
  3. pull_request:
  4. branches: [ main, dev ]
  5. paths:
  6. - '.opencode/**'
  7. - 'evals/**'
  8. - '.github/workflows/test-agents.yml'
  9. push:
  10. branches: [ main ]
  11. workflow_dispatch:
  12. jobs:
  13. test-openagent:
  14. name: Test OpenAgent
  15. runs-on: ubuntu-latest
  16. timeout-minutes: 10
  17. steps:
  18. - name: Checkout code
  19. uses: actions/checkout@v4
  20. - name: Setup Node.js
  21. uses: actions/setup-node@v4
  22. with:
  23. node-version: '20'
  24. cache: 'npm'
  25. cache-dependency-path: 'evals/framework/package-lock.json'
  26. - name: Install OpenCode CLI
  27. run: |
  28. curl -fsSL https://raw.githubusercontent.com/OpenAgentsInc/opencode/main/install.sh | bash
  29. echo "$HOME/.opencode/bin" >> $GITHUB_PATH
  30. - name: Verify OpenCode installation
  31. run: |
  32. export PATH="$HOME/.opencode/bin:$PATH"
  33. opencode --version
  34. - name: Install dependencies
  35. working-directory: evals/framework
  36. run: npm install
  37. - name: Build framework
  38. working-directory: evals/framework
  39. run: npm run build
  40. - name: Run OpenAgent smoke test
  41. run: |
  42. export PATH="$HOME/.opencode/bin:$PATH"
  43. npm run test:ci:openagent
  44. env:
  45. CI: true
  46. - name: Upload test results
  47. if: always()
  48. uses: actions/upload-artifact@v4
  49. with:
  50. name: openagent-results
  51. path: evals/results/
  52. retention-days: 30
  53. test-opencoder:
  54. name: Test OpenCoder
  55. runs-on: ubuntu-latest
  56. timeout-minutes: 10
  57. steps:
  58. - name: Checkout code
  59. uses: actions/checkout@v4
  60. - name: Setup Node.js
  61. uses: actions/setup-node@v4
  62. with:
  63. node-version: '20'
  64. cache: 'npm'
  65. cache-dependency-path: 'evals/framework/package-lock.json'
  66. - name: Install OpenCode CLI
  67. run: |
  68. curl -fsSL https://raw.githubusercontent.com/OpenAgentsInc/opencode/main/install.sh | bash
  69. echo "$HOME/.opencode/bin" >> $GITHUB_PATH
  70. - name: Verify OpenCode installation
  71. run: |
  72. export PATH="$HOME/.opencode/bin:$PATH"
  73. opencode --version
  74. - name: Install dependencies
  75. working-directory: evals/framework
  76. run: npm install
  77. - name: Build framework
  78. working-directory: evals/framework
  79. run: npm run build
  80. - name: Run OpenCoder smoke test
  81. run: |
  82. export PATH="$HOME/.opencode/bin:$PATH"
  83. npm run test:ci:opencoder
  84. env:
  85. CI: true
  86. - name: Upload test results
  87. if: always()
  88. uses: actions/upload-artifact@v4
  89. with:
  90. name: opencoder-results
  91. path: evals/results/
  92. retention-days: 30
  93. report-results:
  94. name: Report Test Results
  95. runs-on: ubuntu-latest
  96. needs: [test-openagent, test-opencoder]
  97. if: always()
  98. steps:
  99. - name: Download OpenAgent results
  100. uses: actions/download-artifact@v4
  101. with:
  102. name: openagent-results
  103. path: results/openagent
  104. continue-on-error: true
  105. - name: Download OpenCoder results
  106. uses: actions/download-artifact@v4
  107. with:
  108. name: opencoder-results
  109. path: results/opencoder
  110. continue-on-error: true
  111. - name: Display results summary
  112. run: |
  113. echo "## Test Results Summary" >> $GITHUB_STEP_SUMMARY
  114. echo "" >> $GITHUB_STEP_SUMMARY
  115. if [ -f results/openagent/latest.json ]; then
  116. echo "### OpenAgent" >> $GITHUB_STEP_SUMMARY
  117. cat results/openagent/latest.json | jq -r '"- Passed: \(.passed)\n- Failed: \(.failed)\n- Total: \(.total)"' >> $GITHUB_STEP_SUMMARY
  118. fi
  119. if [ -f results/opencoder/latest.json ]; then
  120. echo "" >> $GITHUB_STEP_SUMMARY
  121. echo "### OpenCoder" >> $GITHUB_STEP_SUMMARY
  122. cat results/opencoder/latest.json | jq -r '"- Passed: \(.passed)\n- Failed: \(.failed)\n- Total: \(.total)"' >> $GITHUB_STEP_SUMMARY
  123. fi
  124. auto-version-bump:
  125. name: Auto Version Bump
  126. runs-on: ubuntu-latest
  127. needs: [test-openagent, test-opencoder]
  128. if: github.event_name == 'push' && github.ref == 'refs/heads/main'
  129. steps:
  130. - name: Checkout code
  131. uses: actions/checkout@v4
  132. with:
  133. fetch-depth: 0
  134. token: ${{ secrets.GITHUB_TOKEN }}
  135. - name: Setup Node.js
  136. uses: actions/setup-node@v4
  137. with:
  138. node-version: '20'
  139. - name: Configure Git
  140. run: |
  141. git config user.name "github-actions[bot]"
  142. git config user.email "github-actions[bot]@users.noreply.github.com"
  143. - name: Determine version bump type
  144. id: bump-type
  145. run: |
  146. # Get the last commit message
  147. COMMIT_MSG=$(git log -1 --pretty=%B)
  148. # Determine bump type from commit message
  149. if echo "$COMMIT_MSG" | grep -qiE "^(feat|feature)\(.*\)!:|^BREAKING CHANGE:|^[a-z]+!:"; then
  150. echo "type=major" >> $GITHUB_OUTPUT
  151. echo "Detected BREAKING CHANGE - bumping major version"
  152. elif echo "$COMMIT_MSG" | grep -qiE "^(feat|feature)(\(.*\))?:"; then
  153. echo "type=minor" >> $GITHUB_OUTPUT
  154. echo "Detected feature - bumping minor version"
  155. elif echo "$COMMIT_MSG" | grep -qiE "^(fix|bugfix)(\(.*\))?:"; then
  156. echo "type=patch" >> $GITHUB_OUTPUT
  157. echo "Detected fix - bumping patch version"
  158. elif echo "$COMMIT_MSG" | grep -qiE "^\[alpha\]"; then
  159. echo "type=alpha" >> $GITHUB_OUTPUT
  160. echo "Detected [alpha] tag - bumping alpha version"
  161. elif echo "$COMMIT_MSG" | grep -qiE "^\[beta\]"; then
  162. echo "type=beta" >> $GITHUB_OUTPUT
  163. echo "Detected [beta] tag - bumping beta version"
  164. elif echo "$COMMIT_MSG" | grep -qiE "^\[rc\]"; then
  165. echo "type=rc" >> $GITHUB_OUTPUT
  166. echo "Detected [rc] tag - bumping rc version"
  167. else
  168. echo "type=minor" >> $GITHUB_OUTPUT
  169. echo "No specific type detected - defaulting to minor version bump"
  170. fi
  171. - name: Bump version
  172. run: |
  173. BUMP_TYPE="${{ steps.bump-type.outputs.type }}"
  174. # Get current version
  175. CURRENT_VERSION=$(cat VERSION)
  176. echo "Current version: $CURRENT_VERSION"
  177. # Bump version in package.json
  178. npm run version:bump:$BUMP_TYPE
  179. # Get new version
  180. NEW_VERSION=$(cat VERSION)
  181. echo "New version: $NEW_VERSION"
  182. # Update CHANGELOG.md
  183. DATE=$(date +%Y-%m-%d)
  184. COMMIT_MSG=$(git log -1 --pretty=%B)
  185. # Create changelog entry
  186. cat > /tmp/changelog_entry.md << EOF
  187. ## [$NEW_VERSION] - $DATE
  188. ### Changes
  189. - $COMMIT_MSG
  190. EOF
  191. # Prepend to CHANGELOG.md (after the header)
  192. if [ -f CHANGELOG.md ]; then
  193. # Insert after the first occurrence of "## ["
  194. awk '/^## \[/ && !found {print; system("cat /tmp/changelog_entry.md"); found=1; next} 1' CHANGELOG.md > /tmp/changelog_new.md
  195. mv /tmp/changelog_new.md CHANGELOG.md
  196. fi
  197. - name: Commit version bump
  198. run: |
  199. NEW_VERSION=$(cat VERSION)
  200. git add VERSION package.json CHANGELOG.md
  201. git commit -m "chore: bump version to v$NEW_VERSION [skip ci]"
  202. git tag "v$NEW_VERSION"
  203. - name: Push changes
  204. run: |
  205. git push origin main --tags
  206. env:
  207. GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
  208. # Test comment