From 710b4179da9c4eeec4301ce6c6f1dcd749c07024 Mon Sep 17 00:00:00 2001 From: Nuno Campos Date: Wed, 11 Sep 2024 12:14:06 -0700 Subject: [PATCH] Add ci job --- .github/workflows/bench.yml | 61 +++++++++++++++++++++++++++++++++++++ 1 file changed, 61 insertions(+) create mode 100644 .github/workflows/bench.yml diff --git a/.github/workflows/bench.yml b/.github/workflows/bench.yml new file mode 100644 index 000000000..721f8a258 --- /dev/null +++ b/.github/workflows/bench.yml @@ -0,0 +1,61 @@ +name: bench + +on: + pull_request: + paths: + - "libs/**" + +env: + POETRY_VERSION: "1.7.1" + +jobs: + baseline: + runs-on: ubuntu-latest + working-directory: libs/langgraph + name: "bench/baseline" + steps: + - uses: actions/checkout@v4 + ref: main + - name: Set up Python 3.11 + Poetry ${{ env.POETRY_VERSION }} + if: steps.changed-files.outputs.all + uses: "./.github/actions/poetry_setup" + with: + python-version: "3.11" + poetry-version: ${{ env.POETRY_VERSION }} + cache-key: bench + - name: Install dependencies + run: poetry install --with dev + - name: Run benchmarks + run: make bench + - name: Upload benchmark baseline + uses: actions/upload-artifact@v4 + with: + name: bench-baseline.json + path: out/bench.json + compare: + runs_on: ubuntu-latest + working-directory: libs/langgraph + name: "bench/compare" + needs: [baseline] + steps: + - uses: actions/checkout@v4 + - name: Set up Python 3.11 + Poetry ${{ env.POETRY_VERSION }} + if: steps.changed-files.outputs.all + uses: "./.github/actions/poetry_setup" + with: + python-version: "3.11" + poetry-version: ${{ env.POETRY_VERSION }} + cache-key: bench + - name: Install dependencies + run: poetry install --with dev + - name: Run benchmarks + run: make bench + - name: Download benchmark baseline + uses: actions/download-artifact@v4 + with: + name: bench-baseline.json + path: out + - name: Compare benchmarks + run: poetry run pyperf compare_to out/bench-baseline.json out/bench.json --table --group-by-speed >> $GITHUB_OUTPUT + - name: Annotation + run: echo "::notice file=libs/langgraph/bench/__main__.py::$GITHUB_OUTPUT"