[pre-commit.ci] pre-commit autoupdate #84
Workflow file for this run
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
on: | |
pull_request: | |
workflow_dispatch: | |
name: Test code | |
env: | |
JAX_PLATFORM_NAME: cpu | |
jobs: | |
pytest: | |
strategy: | |
fail-fast: false | |
matrix: | |
os: [macos-latest, ubuntu-latest, windows-latest] | |
pyversion: ['3.9', '3.10', '3.11', '3.12'] | |
runs-on: ${{ matrix.os }} | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Install PDM | |
uses: pdm-project/setup-pdm@v3 | |
with: | |
python-version: ${{ matrix.pyversion }} | |
cache: true | |
- name: Install Rust | |
uses: dtolnay/rust-toolchain@stable | |
- name: Install dependencies | |
run: | | |
pdm install -G test,github-action | |
- name: Run Pytest | |
run: | | |
pdm run pytest -Werror -n auto | |
cargo-test: | |
strategy: | |
fail-fast: false | |
matrix: | |
os: [macos-latest, ubuntu-latest, windows-latest] | |
pyversion: ['3.9', '3.10', '3.11', '3.12'] | |
runs-on: ${{ matrix.os }} | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Install PDM | |
uses: pdm-project/setup-pdm@v3 | |
with: | |
python-version: ${{ matrix.pyversion }} | |
cache: true | |
- name: Install Rust | |
uses: dtolnay/rust-toolchain@stable | |
- name: Install dependencies | |
run: | | |
pdm install --no-self | |
- name: Run Cargo test | |
run: | | |
pdm run cargo test | |
python-benchmark: | |
runs-on: ubuntu-latest | |
permissions: | |
pull-requests: write | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Install PDM | |
uses: pdm-project/setup-pdm@v3 | |
with: | |
python-version: '3.11' | |
cache: true | |
- name: Install Rust | |
uses: dtolnay/rust-toolchain@stable | |
- name: Install dependencies | |
run: | | |
pdm install -G test,github-action | |
- name: Run Benchmarks on changes | |
run: pdm run pytest --benchmark-only --benchmark-save=changes | |
- uses: actions/checkout@v4 | |
with: | |
ref: ${{ github.event.pull_request.base.sha }} | |
clean: false | |
- name: Run Benchmarks before changes | |
run: pdm run pytest --benchmark-only --benchmark-save=before | |
- name: Compare benchmarks | |
run: | | |
echo 'results<<EOF' >> $GITHUB_OUTPUT | |
pdm run pytest-benchmark compare before changes >> $GITHUB_OUTPUT | |
echo 'EOF' >> $GITHUB_OUTPUT | |
id: compare | |
- name: Comment PR with benchmarks | |
uses: thollander/actions-comment-pull-request@v2 | |
continue-on-error: true | |
with: | |
message: | | |
Python benchmark results: | |
${{ steps.compare.outputs.results }} | |
comment_tag: python-benchmarks | |
id: comment | |
- name: If PR comment failed, write to PR summary | |
if: steps.comment.outcome != 'success' | |
run: | | |
echo '### Python benchmark results' >> $GITHUB_STEP_SUMMARY | |
echo '${{ steps.compare.outputs.results }}' >> $GITHUB_STEP_SUMMARY | |
rust-benchmark: | |
runs-on: ubuntu-latest | |
permissions: | |
pull-requests: write | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Install PDM | |
uses: pdm-project/setup-pdm@v3 | |
with: | |
python-version: '3.11' | |
cache: true | |
- name: Install Rust | |
uses: dtolnay/rust-toolchain@nightly | |
- name: Install dependencies | |
run: | | |
pdm install --no-self | |
cargo install cargo-benchcmp | |
- name: Run Benchmarks on changes | |
run: pdm run cargo bench > changes | |
- uses: actions/checkout@v4 | |
with: | |
ref: ${{ github.event.pull_request.base.sha }} | |
clean: false | |
- name: Run Benchmarks before changes | |
run: pdm run cargo bench > before | |
- name: Compare benchmarks | |
run: | | |
echo 'results<<EOF' >> $GITHUB_OUTPUT | |
cargo benchcmp before changes >> $GITHUB_OUTPUT | |
echo 'EOF' >> $GITHUB_OUTPUT | |
id: compare | |
- name: Comment PR with benchmarks | |
uses: thollander/actions-comment-pull-request@v2 | |
continue-on-error: true | |
with: | |
message: | | |
Rust benchmark results: | |
${{ steps.compare.outputs.results }} | |
comment_tag: rust-benchmarks | |
id: comment | |
- name: If PR comment failed, write to PR summary | |
if: steps.comment.outcome != 'success' | |
run: | | |
echo '### Rust benchmark results' >> $GITHUB_STEP_SUMMARY | |
echo '${{ steps.compare.outputs.results }}' >> $GITHUB_STEP_SUMMARY |