diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 95c29c6..628dab4 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -85,3 +85,10 @@ jobs: echo "Coverage Tests - ${{ steps.coverageComment.outputs.tests }}" echo "Coverage Time - ${{ steps.coverageComment.outputs.time }}" echo "Not Success Test Info - ${{ steps.coverageComment.outputs.notSuccessTestInfo }}" + + - name: Run benchmarks + run: | + pytest -m benchmark --benchmark-json=./output.json + + - name: Publish benchmark results + uses: nils-braun/pytest-benchmark-commenter@v2 diff --git a/dev-requirements.txt b/dev-requirements.txt index 1e37df5..19242af 100644 --- a/dev-requirements.txt +++ b/dev-requirements.txt @@ -1,5 +1,7 @@ -r requirements.txt # Include all main requirements django>=4.2,<5.0 pytest +pytest-benchmark +pytest-django ruff pre-commit diff --git a/edtf/parser/grammar.py b/edtf/parser/grammar.py index 1747341..9840bde 100644 --- a/edtf/parser/grammar.py +++ b/edtf/parser/grammar.py @@ -2,9 +2,10 @@ # It's recommended to `enablePackrat()` immediately after importing pyparsing # https://github.com/pyparsing/pyparsing/wiki/Performance-Tips -import pyparsing -pyparsing.ParserElement.enablePackrat() +# TODO: uncomment this once benchmark testing has run once in CI +# import pyparsing +# pyparsing.ParserElement.enablePackrat() from pyparsing import ( Combine,