[pre-commit.ci] pre-commit autoupdate #371
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 Python code | |
jobs: | |
pytest: | |
strategy: | |
fail-fast: false | |
matrix: | |
os: [macos-latest, ubuntu-latest] | |
pyversion: ['3.9', '3.10', '3.11', '3.12'] | |
runs-on: ${{ matrix.os }} | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Setup Rye | |
env: | |
RYE_TOOLCHAIN_VERSION: ${{ matrix.pyversion}} | |
RYE_INSTALL_OPTION: --yes | |
run: | | |
curl -sSf https://rye.astral.sh/get | bash | |
echo "$HOME/.rye/shims" >> $GITHUB_PATH | |
- name: Configure Rye | |
run: | | |
rye config --set-bool behavior.use-uv=true | |
rye pin ${{ matrix.pyversion }} | |
- name: Install Differt2D | |
run: rye sync | |
- name: Run Pytest | |
run: rye run pytest | |
- name: Upload to codecov.io | |
uses: codecov/codecov-action@v4 | |
with: | |
token: ${{ secrets.CODECOV_TOKEN }} | |
fail_ci_if_error: true | |
benchmark: | |
runs-on: ubuntu-latest | |
permissions: | |
pull-requests: write | |
env: | |
JAX_PLATFORM_NAME: cpu | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Setup Rye | |
env: | |
RYE_TOOLCHAIN_VERSION: '3.11' | |
RYE_INSTALL_OPTION: --yes | |
run: | | |
curl -sSf https://rye.astral.sh/get | bash | |
echo "$HOME/.rye/shims" >> $GITHUB_PATH | |
- name: Configure Rye | |
run: | | |
rye config --set-bool behavior.use-uv=true | |
rye pin '3.11' | |
- name: Install Differt2D (on changes) | |
run: rye sync --reset -f | |
- name: Run Benchmarks on changes | |
run: rye run pytest --benchmark-only --benchmark-save=changes tests/benchmarks | |
- uses: actions/checkout@v4 | |
with: | |
ref: ${{ github.event.pull_request.base.sha }} | |
clean: false | |
- name: Install Differt2D (before changes) | |
run: rye sync --reset -f | |
- name: Run Benchmarks before changes | |
run: rye run pytest --benchmark-only --benchmark-save=before tests/benchmarks | |
- name: Compare benchmarks | |
run: | | |
echo 'results<<EOF' >> $GITHUB_OUTPUT | |
rye run pytest-benchmark compare --group-by=name --columns="mean,stddev,ops" >> $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: | | |
Benchmark results: | |
``` | |
${{ steps.compare.outputs.results }} | |
``` | |
comment_tag: benchmarks | |
id: comment | |
- name: If PR comment failed, write to PR summary | |
if: steps.comment.outcome != 'success' | |
run: | | |
echo '### Benchmark results' >> $GITHUB_STEP_SUMMARY | |
echo '```' >> $GITHUB_STEP_SUMMARY | |
echo '${{ steps.compare.outputs.results }}' >> $GITHUB_STEP_SUMMARY | |
echo '```' >> $GITHUB_STEP_SUMMARY | |
markdown-link-check: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Check links | |
uses: gaurav-nelson/github-action-markdown-link-check@v1 | |
with: | |
use-quiet-mode: yes | |
use-verbose-mode: yes | |
config-file: .mdlc.json |