feat(lib): add keepdims
arg to normalize
#858
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
# 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 uv | |
uses: astral-sh/setup-uv@v3 | |
with: | |
enable-cache: true | |
- name: Setup Python ${{ matrix.pyversion }} | |
run: uv python install ${{ 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 | |
run: uv sync --locked --no-dev --extra tests | |
- name: Run tests | |
run: uv run pytest | |
- name: Upload to codecov.io | |
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.10', '3.11', '3.12'] | |
runs-on: ${{ matrix.os }} | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Setup Python | |
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 | |
cargo-tarpaulin: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Setup Python | |
uses: actions/setup-python@v5 | |
- name: Install NumPy | |
run: pip install numpy | |
- name: Install Rust | |
uses: dtolnay/rust-toolchain@stable | |
- uses: taiki-e/install-action@v2 | |
with: | |
tool: cargo-tarpaulin@0.31.2 | |
- name: Generate code coverage | |
run: cargo tarpaulin --verbose --timeout 120 --out xml | |
- name: Upload to codecov.io | |
uses: codecov/codecov-action@v4 | |
with: | |
token: ${{ secrets.DIFFERT_CODECOV_TOKEN }} | |
fail_ci_if_error: true | |
python-benchmark: | |
runs-on: ubuntu-latest | |
permissions: | |
pull-requests: write | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- uses: actions/setup-python@v5 | |
id: setup-python | |
with: | |
cache: pip | |
cache-dependency-path: uv.lock | |
- name: Setup uv | |
uses: astral-sh/setup-uv@v3 | |
- name: Install Rust | |
uses: dtolnay/rust-toolchain@stable | |
with: | |
components: llvm-tools | |
- name: Cache Rust | |
uses: Swatinem/rust-cache@v2 | |
- name: Install dependencies | |
run: uv pip install -r pyproject.toml --extra tests --python '${{ steps.setup-python.outputs.python-path }}' | |
- name: Build differt-core for profiling | |
run: | | |
rm -f python/differt_core/*.so | |
pip install -e . --config-settings=build-args='--profile profiling' | |
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: pytest --dist=no -n0 --benchmark-enable differt/tests/benchmarks | |
- name: Merge PGO data | |
run: rustup run stable bash -c '$RUSTUP_HOME/toolchains/$RUSTUP_TOOLCHAIN/lib/rustlib/${{ env.RUST_HOST }}/bin/llvm-profdata merge -o ${{ github.workspace }}/merged.profdata ${{ github.workspace }}/profdata' | |
- name: Build differt-core for benchmarking | |
run: | | |
rm -f python/differt_core/*.so | |
pip install -e . --config-settings=build-args='--profile profiling' | |
working-directory: differt-core | |
env: | |
RUSTFLAGS: -Cprofile-use=${{ github.workspace }}/merged.profdata | |
- name: Run CodSpeed benchmarks | |
uses: CodSpeedHQ/action@v3 | |
with: | |
run: pytest differt/tests/benchmarks --codspeed | |
rust-benchmark: | |
runs-on: ubuntu-latest | |
permissions: | |
pull-requests: write | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Setup Python | |
uses: actions/setup-python@v5 | |
- name: Install NumPy | |
run: pip install "numpy<2" | |
- name: Install Rust | |
uses: dtolnay/rust-toolchain@stable | |
- name: Cache Rust | |
uses: Swatinem/rust-cache@v2 | |
- name: Run Benchmarks | |
run: cargo bench | |
linkcheck-docs: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Setup uv | |
uses: astral-sh/setup-uv@v3 | |
with: | |
enable-cache: true | |
- name: Install dependencies | |
run: uv sync --locked --no-dev --extra docs | |
- name: Install Just | |
uses: taiki-e/install-action@just | |
- name: Check links in documentation | |
run: just docs/linkcheck |