diff --git a/.github/workflows/benchmarks.yaml b/.github/workflows/benchmarks.yaml index a6f54d58..bce10887 100644 --- a/.github/workflows/benchmarks.yaml +++ b/.github/workflows/benchmarks.yaml @@ -139,25 +139,11 @@ jobs: - name: Upload artifact id: upload-artifact - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v4 with: name: benchmarks-debug path: ./benchmarks/benchmark-results - - name: Fetch Artifact ID - id: fetch-artifact-id - uses: actions/github-script@v6 - with: - script: | - const run_id = ${{ github.run_id }}; - const artifacts = await github.rest.actions.listWorkflowRunArtifacts({ - owner: context.repo.owner, - repo: context.repo.repo, - run_id: run_id, - }); - const artifact = artifacts.data.artifacts.find(artifact => artifact.name === 'benchmarks-debug'); - return artifact.id; - - name: Comment on PR with benchmark results and download link uses: actions/github-script@v6 with: @@ -165,12 +151,12 @@ jobs: const fs = require('fs'); const summaryPath = './benchmarks/benchmark-results/summary.md'; const contents = fs.readFileSync(summaryPath, 'utf8'); - const artifactID = ${{ steps.fetch-artifact-id.outputs.result }}; + const artifactID = ${{ steps.upload-artifact.outputs.artifact-id }}; const downloadURL = `https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}/artifacts/${artifactID}`; github.rest.issues.updateComment({ comment_id: ${{ env.BENCHMARKS_COMMENT_ID }}, owner: context.repo.owner, repo: context.repo.repo, - body: '[Finished benchmarks](https://github.com/${{github.repository}}/actions/runs/${{github.run_id}})\n\n' + contents + '\n\n[Download Artifacts](' + downloadURL + ')' + body: '[Finished benchmarks](https://github.com/${{github.repository}}/actions/runs/${{github.run_id}})\n\n' + contents + '\n\n[Download artifacts](' + downloadURL + ')' }) diff --git a/benchmarks.json b/benchmarks.json index bff51cbb..c1e3fcdf 100644 --- a/benchmarks.json +++ b/benchmarks.json @@ -13,8 +13,8 @@ "autotx/tests/agents/token/research/test_research_and_swap.py::test_auto_tx_research_swap_and_send_governance_token": "70.00", "autotx/tests/agents/token/research/test_research.py::test_price_change_information": "90.00", "autotx/tests/agents/token/research/test_research.py::test_get_top_5_tokens_from_base": "90.00", - "autotx/tests/agents/token/test_swap.py::test_auto_tx_swap_multiple": "90.00", - "autotx/tests/agents/token/test_swap_and_send.py::test_auto_tx_swap_and_send_complex": "20.00", + "autotx/tests/agents/token/test_swap.py::test_auto_tx_swap_multiple": "100.00", + "autotx/tests/agents/token/test_swap_and_send.py::test_auto_tx_swap_and_send_complex": "100.00", "autotx/tests/agents/token/test_swap.py::test_auto_tx_swap_with_non_default_token": "100.00", "autotx/tests/agents/token/research/test_research.py::test_get_top_5_most_traded_tokens_from_l1": "70.00", "autotx/tests/agents/token/research/test_research.py::test_get_token_exchanges": "90.00", diff --git a/benchmarks.py b/benchmarks.py index c879b744..b3038fad 100644 --- a/benchmarks.py +++ b/benchmarks.py @@ -67,6 +67,9 @@ def run_test(test_name, iterations, avg_time_across_tests, completed_tests, rema def print_summary_table(test_path: str, iterations: int, tests_results: dict, total_run_time: float, output_dir: str, total_benchmarks: dict): """Prints a summary table of all tests in markdown format to the console and a file, including total success percentage.""" + # Sort test results + tests_results = sorted(tests_results, key=lambda x: x['name']) + # Calculate total passes and fails total_passes = sum(result['passes'] for result in tests_results) total_fails = sum(result['fails'] for result in tests_results)