Skip to content

Commit

Permalink
add workflows for pytest-benchmark
Browse files Browse the repository at this point in the history
  • Loading branch information
rhysd committed Nov 17, 2019
1 parent 895f92f commit 1e4ebf2
Show file tree
Hide file tree
Showing 4 changed files with 58 additions and 3 deletions.
27 changes: 27 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,33 @@ jobs:
tool: 'benchmarkjs'
output-file-path: examples/benchmarkjs/output.txt
- run: echo 'TODO Verify result here!'
pytest-benchmark:
name: Run Pytest benchmark example
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- uses: actions/setup-node@v1
- uses: actions/setup-python@v1
- uses: actions/cache@v1
with:
path: node_modules
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-node-
- run: npm install
- run: npm run build
- name: Run benchmark
run: |
cd examples/pytest
pip install -r requirements.txt
pytest bench.py --benchmark-json output.json
- name: Store benchmark result
uses: ./
with:
name: Python Benchmark with pytest-benchmark
tool: 'pytest'
output-file-path: examples/pytest/output.json
- run: echo 'TODO Verify result here!'
unit-tests:
name: Run unit tests
runs-on: ubuntu-latest
Expand Down
27 changes: 27 additions & 0 deletions .github/workflows/pytest.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: Python Example with pytest-benchmark
on:
push:
branches:
- master

jobs:
benchmark:
name: Run pytest-benchmark benchmark example
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- uses: actions/setup-python@v1
- name: Run benchmark
run: |
cd examples/pytest
pip install -r requirements.txt
pytest bench.py --benchmark-json output.json
- name: Store benchmark result
uses: rhysd/github-action-benchmark@v1
with:
name: Python Benchmark with pytest-benchmark
tool: 'pytest'
output-file-path: examples/pytest/output.json
# Use personal access token instead of GITHUB_TOKEN due to https://github.community/t5/GitHub-Actions/Github-action-not-triggering-gh-pages-upon-push/td-p/26869/highlight/false
github-token: ${{ secrets.PERSONAL_GITHUB_TOKEN }}
auto-push: true
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ are in [.github/workflows/](./.github/workflows) directory. Workflow actions are
- Rust: [![Rust Example Workflow][rust-badge]](https://github.com/rhysd/github-action-benchmark/actions?query=workflow%3A%22Rust+Example%22)
- Go: [![Go Example Workflow][go-badge]](https://github.com/rhysd/github-action-benchmark/actions?query=workflow%3A%22Go+Example%22)
- JavaScript: [![JavaScript Example Workflow][benchmarkjs-badge]](https://github.com/rhysd/github-action-benchmark/actions?query=workflow%3A%22Benchmark.js+Example%22)
- Python (pytest-benchmark): [![Pytest Example Workflow][TODO]](TODO)
- Python (pytest-benchmark): [![Pytest Example Workflow][pytest-benchmark-badge]](https://github.com/rhysd/github-action-benchmark/actions?query=workflow%3A%22Python+Example+with+pytest-benchmark%22)

All benchmark charts from above workflows are gathered in GitHub pages:

Expand Down Expand Up @@ -267,6 +267,7 @@ For example, `rhysd/github-action-benchmark@v1` means the latest version of `1.x
[rust-badge]: https://github.com/rhysd/github-action-benchmark/workflows/Rust%20Example/badge.svg
[go-badge]: https://github.com/rhysd/github-action-benchmark/workflows/Go%20Example/badge.svg
[benchmarkjs-badge]: https://github.com/rhysd/github-action-benchmark/workflows/Benchmark.js%20Example/badge.svg
[pytest-benchmark-badge]: https://github.com/rhysd/github-action-benchmark/workflows/Python%20Example%20with%20pytest-benchmark/badge.svg
[github-action]: https://github.com/features/actions
[cargo-bench]: https://doc.rust-lang.org/cargo/commands/cargo-bench.html
[benchmarkjs]: https://benchmarkjs.com/
Expand Down
4 changes: 2 additions & 2 deletions examples/pytest/README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
Python example for benchmarking with [pytest-benchmark][tool]
=============================================================

- [Workflow for this example](TODO)
- [Action log of this example](TODO)
- [Workflow for this example](../../.github/workflows/pytest.yml)
- [Action log of this example](https://github.com/rhysd/github-action-benchmark/actions?query=workflow%3A%22Python+Example+with+pytest-benchmark%22)
- [Benchmark results on GitHub pages](https://rhysd.github.io/github-action-benchmark/dev/bench/)

This directory shows how to use [`github-action-benchmark`](https://github.com/rhysd/github-action-benchmark)
Expand Down

0 comments on commit 1e4ebf2

Please sign in to comment.