Update benchmark.yml #29
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: benchmark | |
on: | |
workflow_dispatch: | |
pull_request: | |
branches: | |
- main | |
jobs: | |
do-benchmark: | |
if: github.event.pull_request.merged == false | |
name: Benchmark runner | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout folder to get test files | |
uses: actions/checkout@v3 | |
if: github.event_name == 'pull_request' | |
with: | |
fetch-depth: 0 | |
repository: ${{ github.event.pull_request.head.repo.full_name }} | |
ref: ${{ github.event.pull_request.head.ref }} | |
- uses: actions/checkout@v3 | |
if: github.event_name == 'push' | |
with: | |
fetch-depth: 0 | |
- name: Rename checked out topojson package | |
run: mv topojson do_later_topojson | |
- name: Set up Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: "3.10" | |
- name: Install test dependencies | |
run: | | |
python -m pip install geopandas numpy fire altair vl-convert-python | |
- name: Install latest topojson version from pypi | |
run: python -m pip install topojson | |
- name: Benchmark last released version! | |
run: python tests/benchmark_compute.py --version=last-released | |
- name: Install main repo topojson from git | |
run: python -m pip install git+https://github.com/mattijn/topojson.git --upgrade | |
- name: Benchmark version in github main! | |
run: python tests/benchmark_compute.py --version=main | |
- name: Rename moved topojson package | |
run: mv do_later_topojson topojson | |
- name: Benchmark this PR! | |
run: python tests/benchmark_compute.py --version=PR | |
- name: Create visz from benchmark results! | |
run: python tests/benchmark_visz.py | |
- uses: iterative/setup-cml@v2 | |
- name: Generate benchmart as report | |
env: | |
repo_token: ${{ secrets.GITHUB_TOKEN }} | |
run: | | |
cat <<EOF > benchmark.md | |
#### Benchmark result | |
![benchmark](./tests/benchmark_chart.svg) | |
The changes in this PR are timed against 3 files and are compared to the latest released version on PyPi and the main branch of the repository. | |
EOF | |
cml comment create --publish --pr=false benchmark.md |