test-agents.yml 7.0 KB

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