eval-runner.yml 6.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158
  1. name: Run Evaluation
  2. on:
  3. pull_request:
  4. types: [labeled]
  5. workflow_dispatch:
  6. inputs:
  7. reason:
  8. description: "Reason for manual trigger"
  9. required: true
  10. default: ""
  11. env:
  12. N_PROCESSES: 32 # Global configuration for number of parallel processes for evaluation
  13. jobs:
  14. run-evaluation:
  15. if: github.event.label.name == 'eval-this' || github.event_name != 'pull_request'
  16. runs-on: ubuntu-latest
  17. permissions:
  18. contents: "read"
  19. id-token: "write"
  20. pull-requests: "write"
  21. issues: "write"
  22. strategy:
  23. matrix:
  24. python-version: ["3.12"]
  25. steps:
  26. - name: Checkout repository
  27. uses: actions/checkout@v4
  28. - name: Install poetry via pipx
  29. run: pipx install poetry
  30. - name: Set up Python
  31. uses: actions/setup-python@v5
  32. with:
  33. python-version: ${{ matrix.python-version }}
  34. cache: "poetry"
  35. - name: Comment on PR if 'eval-this' label is present
  36. if: github.event_name == 'pull_request' && github.event.label.name == 'eval-this'
  37. uses: KeisukeYamashita/create-comment@v1
  38. with:
  39. unique: false
  40. comment: |
  41. Hi! I started running the evaluation on your PR. You will receive a comment with the results shortly.
  42. - name: Install Python dependencies using Poetry
  43. run: poetry install
  44. - name: Configure config.toml for evaluation
  45. env:
  46. DEEPSEEK_API_KEY: ${{ secrets.DEEPSEEK_LLM_API_KEY }}
  47. run: |
  48. echo "[llm.eval]" > config.toml
  49. echo "model = \"deepseek/deepseek-chat\"" >> config.toml
  50. echo "api_key = \"$DEEPSEEK_API_KEY\"" >> config.toml
  51. echo "temperature = 0.0" >> config.toml
  52. - name: Run integration test evaluation
  53. env:
  54. ALLHANDS_API_KEY: ${{ secrets.ALLHANDS_EVAL_RUNTIME_API_KEY }}
  55. RUNTIME: remote
  56. SANDBOX_REMOTE_RUNTIME_API_URL: https://runtime.eval.all-hands.dev
  57. EVAL_DOCKER_IMAGE_PREFIX: us-central1-docker.pkg.dev/evaluation-092424/swe-bench-images
  58. run: |
  59. poetry run ./evaluation/integration_tests/scripts/run_infer.sh llm.eval HEAD CodeActAgent '' $N_PROCESSES
  60. # get evaluation report
  61. REPORT_FILE=$(find evaluation/evaluation_outputs/outputs/integration_tests/CodeActAgent/deepseek-chat_maxiter_10_N* -name "report.md" -type f | head -n 1)
  62. echo "REPORT_FILE: $REPORT_FILE"
  63. echo "INTEGRATION_TEST_REPORT<<EOF" >> $GITHUB_ENV
  64. cat $REPORT_FILE >> $GITHUB_ENV
  65. echo >> $GITHUB_ENV
  66. echo "EOF" >> $GITHUB_ENV
  67. - name: Run SWE-Bench evaluation
  68. env:
  69. ALLHANDS_API_KEY: ${{ secrets.ALLHANDS_EVAL_RUNTIME_API_KEY }}
  70. RUNTIME: remote
  71. SANDBOX_REMOTE_RUNTIME_API_URL: https://runtime.eval.all-hands.dev
  72. EVAL_DOCKER_IMAGE_PREFIX: us-central1-docker.pkg.dev/evaluation-092424/swe-bench-images
  73. run: |
  74. poetry run ./evaluation/swe_bench/scripts/run_infer.sh llm.eval HEAD CodeActAgent 300 30 $N_PROCESSES "princeton-nlp/SWE-bench_Lite" test
  75. OUTPUT_FOLDER=$(find evaluation/evaluation_outputs/outputs/princeton-nlp__SWE-bench_Lite-test/CodeActAgent -name "deepseek-chat_maxiter_50_N_*-no-hint-run_1" -type d | head -n 1)
  76. echo "OUTPUT_FOLDER for SWE-bench evaluation: $OUTPUT_FOLDER"
  77. poetry run ./evaluation/swe_bench/scripts/eval_infer_remote.sh $OUTPUT_FOLDER/output.jsonl $N_PROCESSES "princeton-nlp/SWE-bench_Lite" test
  78. poetry run ./evaluation/swe_bench/scripts/eval/summarize_outputs.py $OUTPUT_FOLDER/output.jsonl > summarize_outputs.log 2>&1
  79. echo "SWEBENCH_REPORT<<EOF" >> $GITHUB_ENV
  80. cat summarize_outputs.log >> $GITHUB_ENV
  81. echo "EOF" >> $GITHUB_ENV
  82. - name: Create tar.gz of evaluation outputs
  83. run: |
  84. TIMESTAMP=$(date +'%y-%m-%d-%H-%M')
  85. tar -czvf evaluation_outputs_${TIMESTAMP}.tar.gz evaluation/evaluation_outputs/outputs
  86. - name: Upload evaluation results as artifact
  87. uses: actions/upload-artifact@v4
  88. id: upload_results_artifact
  89. with:
  90. name: evaluation-outputs
  91. path: evaluation_outputs_*.tar.gz
  92. - name: Get artifact URL
  93. run: echo "ARTIFACT_URL=${{ steps.upload_results_artifact.outputs.artifact-url }}" >> $GITHUB_ENV
  94. - name: Authenticate to Google Cloud
  95. uses: 'google-github-actions/auth@v2'
  96. with:
  97. credentials_json: ${{ secrets.GCP_RESEARCH_OBJECT_CREATOR_SA_KEY }}
  98. - name: Set timestamp and trigger reason
  99. run: |
  100. echo "TIMESTAMP=$(date +'%Y-%m-%d-%H-%M')" >> $GITHUB_ENV
  101. if [[ "${{ github.event_name }}" == "pull_request" ]]; then
  102. echo "TRIGGER_REASON=pr-${{ github.event.pull_request.number }}" >> $GITHUB_ENV
  103. elif [[ "${{ github.event_name }}" == "schedule" ]]; then
  104. echo "TRIGGER_REASON=schedule" >> $GITHUB_ENV
  105. else
  106. echo "TRIGGER_REASON=manual-${{ github.event.inputs.reason }}" >> $GITHUB_ENV
  107. fi
  108. - name: Upload evaluation results to Google Cloud Storage
  109. uses: 'google-github-actions/upload-cloud-storage@v2'
  110. with:
  111. path: 'evaluation/evaluation_outputs/outputs'
  112. destination: 'openhands-oss-eval-results/${{ env.TIMESTAMP }}-${{ env.TRIGGER_REASON }}'
  113. - name: Comment with evaluation results and artifact link
  114. id: create_comment
  115. uses: KeisukeYamashita/create-comment@v1
  116. with:
  117. number: ${{ github.event_name == 'pull_request' && github.event.pull_request.number || 4504 }}
  118. unique: false
  119. comment: |
  120. Trigger by: ${{ github.event_name == 'pull_request' && format('Pull Request (eval-this label on PR #{0})', github.event.pull_request.number) || github.event_name == 'schedule' && 'Daily Schedule' || format('Manual Trigger: {0}', github.event.inputs.reason) }}
  121. Commit: ${{ github.sha }}
  122. **SWE-Bench Evaluation Report**
  123. ${{ env.SWEBENCH_REPORT }}
  124. ---
  125. **Integration Tests Evaluation Report**
  126. ${{ env.INTEGRATION_TEST_REPORT }}
  127. ---
  128. You can download the full evaluation outputs [here](${{ env.ARTIFACT_URL }}).
  129. - name: Post to a Slack channel
  130. id: slack
  131. uses: slackapi/slack-github-action@v1.27.0
  132. with:
  133. channel-id: 'C07SVQSCR6F'
  134. slack-message: "*Evaluation Trigger:* ${{ github.event_name == 'pull_request' && format('Pull Request (eval-this label on PR #{0})', github.event.pull_request.number) || github.event_name == 'schedule' && 'Daily Schedule' || format('Manual Trigger: {0}', github.event.inputs.reason) }}\n\nLink to summary: [here](https://github.com/${{ github.repository }}/issues/${{ github.event_name == 'pull_request' && github.event.pull_request.number || 4504 }}#issuecomment-${{ steps.create_comment.outputs.comment-id }})"
  135. env:
  136. SLACK_BOT_TOKEN: ${{ secrets.EVAL_NOTIF_SLACK_BOT_TOKEN }}