Skip to content

fix(lib): deprecation warnings and others #508

fix(lib): deprecation warnings and others

fix(lib): deprecation warnings and others #508

Workflow file for this run

# Test code base and upload coverage
name: Test code
on:
pull_request:
push:
branches: [main]
workflow_dispatch:
env:
QT_QPA_PLATFORM: offscreen
DISPLAY: :99
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: Setup Rye
if: matrix.os != 'windows-latest'
env:
RYE_TOOLCHAIN_VERSION: ${{ matrix.pyversion}}
RYE_INSTALL_OPTION: --yes
run: |
curl -sSf https://rye-up.com/get | bash
echo "$HOME/.rye/shims" >> $GITHUB_PATH
# Stolen from https://github.com/bluss/pyproject-local-kernel/blob/2b641290694adc998fb6bceea58d3737523a68b7/.github/workflows/ci.yaml
- name: Install Rye (Windows)
if: matrix.os == 'windows-latest'
shell: bash
run: |
C:/msys64/usr/bin/wget.exe -q 'https://github.com/astral-sh/rye/releases/latest/download/rye-x86_64-windows.exe' -O rye-x86_64-windows.exe
./rye-x86_64-windows.exe self install --toolchain-version ${{ matrix.pyversion }} --modify-path -y
echo "$HOME\\.rye\\shims" >> $GITHUB_PATH
- name: Configure Rye
shell: bash
run: |
rye config --set-bool behavior.use-uv=true
rye pin ${{ matrix.pyversion }}
- name: Install Linux dependencies
if: matrix.os == 'ubuntu-latest'
run: |
sudo apt-get update
sudo apt-get install freeglut3-dev xvfb
sudo apt-get install x11-utils
nohup Xvfb $DISPLAY -screen 0 1400x900x24 -dpi 96 +extension RANDR +render &
- name: Install Mesa (OpenGL on Windows)
if: matrix.os == 'windows-latest'
uses: ssciwr/setup-mesa-dist-win@v2
- name: Install Rust
uses: dtolnay/rust-toolchain@stable
- name: Install dependencies
shell: bash
run: rye sync
- name: Run Pytest
if: matrix.os != 'ubuntu-latest' || matrix.pyversion != '3.12'
shell: bash
run: rye run pytest -n auto
- name: Run pytest and coverage for differt
if: matrix.os == 'ubuntu-latest' && matrix.pyversion == '3.12'
run: rye run pytest --cov-report xml --cov=differt differt
- name: Upload to codecov.io
if: matrix.os == 'ubuntu-latest' && matrix.pyversion == '3.12'
uses: codecov/codecov-action@v4
with:
token: ${{ secrets.DIFFERT_CODECOV_TOKEN }}
fail_ci_if_error: true
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
- uses: actions/setup-python@v5
with:
python-version: ${{ matrix.pyversion }}
- name: Install NumPy
run: pip install numpy
- name: Install Rust
uses: dtolnay/rust-toolchain@stable
- name: Run Cargo test
run: |
cargo test
python-benchmark:
runs-on: ubuntu-latest
permissions:
pull-requests: write
steps:
- name: Checkout repository
uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: '3.11'
cache: pip
cache-dependency-path: requirements-dev.lock
- name: Install Rust
uses: dtolnay/rust-toolchain@stable
with:
components: llvm-tools
- name: Install dependencies
run: pip install -r requirements-dev.lock
- name: Run Benchmarks on changes
run: pytest --benchmark-only --benchmark-save=changes differt-core/tests/benchmarks
- name: Build wheel with profiling profile
uses: PyO3/maturin-action@v1
with:
args: >
--release
--out pgo-wheel
working-directory: differt-core
env:
RUSTFLAGS: -Cprofile-generate=${{ github.workspace }}/profdata
- name: Detect Rust host
run: echo RUST_HOST=$(rustc -Vv | grep host | cut -d ' ' -f 2) >> "$GITHUB_ENV"
shell: bash
- name: Generate profile data
run: |
python -m ensurepip
python -m pip install differt-core --no-index --no-deps --find-links differt-core/pgo-wheel --force-reinstall
pytest --benchmark-only differt-core/tests/benchmarks
rustup run stable bash -c 'echo LLVM_PROFDATA=$RUSTUP_HOME/toolchains/$RUSTUP_TOOLCHAIN/lib/rustlib/${{ env.RUST_HOST }}/bin/llvm-profdata >> "$GITHUB_ENV"'
- name: Merge GO data
run: ${{ env.LLVM_PROFDATA }} merge -o ${{ github.workspace }}/merged.profdata ${{ github.workspace }}/profdata
- name: Build PGO-optimized wheel
uses: PyO3/maturin-action@v1
with:
args: >
--release
--out opt-wheel
working-directory: differt-core
env:
RUSTFLAGS: -Cprofile-use=${{ github.workspace }}/merged.profdata
- name: Run Benchmarks on changes with PGO-optimized wheel
run: |
python -m pip install differt-core --no-index --no-deps --find-links differt-core/opt-wheel --force-reinstall
pytest --benchmark-only --benchmark-save=pgo differt-core/tests/benchmarks
- name: Checkout base branch
uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.base.sha }}
clean: false
- name: Install dependencies (before changes)
run: pip install -r requirements-dev.lock
- name: Build wheel before changes
uses: PyO3/maturin-action@v1
with:
args: >
--release
--out dist
working-directory: differt-core
- name: Run Benchmarks before changes
run: |
python -m pip install differt-core --no-index --no-deps --find-links differt-core/dist --force-reinstall
pytest --benchmark-only --benchmark-save=before differt-core/tests/benchmarks
- name: Compare benchmarks
run: |
echo 'results<<EOF' >> $GITHUB_OUTPUT
pytest-benchmark compare --group-by=group --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: |
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 '```' >> $GITHUB_STEP_SUMMARY
echo '${{ steps.compare.outputs.results }}' >> $GITHUB_STEP_SUMMARY
echo '```' >> $GITHUB_STEP_SUMMARY
rust-benchmark:
runs-on: ubuntu-latest
permissions:
pull-requests: write
steps:
- name: Checkout repository
uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: '3.11'
- name: Install NumPy
run: pip install numpy
- name: Install Rust
uses: dtolnay/rust-toolchain@stable
- uses: taiki-e/install-action@v2
with:
tool: critcmp@0.1.8
- name: Run Benchmarks on changes
run: cargo bench --bench bench_main -- --save-baseline changes
- name: Checkout base branch
uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.base.sha }}
clean: false
- name: Run Benchmarks before changes
run: cargo bench --bench bench_main -- --save-baseline before
- name: Compare benchmarks
run: |
echo 'results<<EOF' >> $GITHUB_OUTPUT
critcmp 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 '```' >> $GITHUB_STEP_SUMMARY
echo '${{ steps.compare.outputs.results }}' >> $GITHUB_STEP_SUMMARY
echo '```' >> $GITHUB_STEP_SUMMARY
linkcheck-docs:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: '3.11'
cache: pip
cache-dependency-path: requirements-dev.lock
- name: Install dependencies
run: pip install -r requirements-dev.lock
- name: Check links in documentation
run: |
cd docs
NB_OFF=1 make linkcheck