Skip to content

draft for testing

draft for testing #25

Workflow file for this run

name: tests
on:
push:
branches: master
pull_request:
concurrency: # https://stackoverflow.com/questions/66335225#comment133398800_72408109
group: ${{ github.workflow }}-${{ github.ref || github.run_id }}
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
jobs:
rust_impl:
name: rust-impl-${{ matrix.python-version }}-${{ matrix.rust-toolchain }}-${{ matrix.platform.name }}
runs-on: ${{ matrix.platform.os }}
strategy:
matrix:
# Keep in sync with:
# - dists.yml
# - the c_impl tests below
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]
rust-toolchain: [stable, beta, nightly]
platform: [
{ os: "ubuntu-latest", python-architecture: "x64", rust-target: "x86_64-unknown-linux-gnu", name: "ubuntu-x64" },
{ os: "macos-13", python-architecture: "x64", rust-target: "x86_64-apple-darwin", name: "macos-x64" },
# disabled for now ref https://github.com/actions/setup-python/issues/855#issuecomment-2196137381
# { os: "macos-14", python-architecture: "x64", rust-target: "aarch64-apple-darwin", name: "macos-arm64" },
{ os: "windows-latest", python-architecture: "x86", rust-target: "i686-pc-windows-msvc", name: "windows-x86" },
{ os: "windows-latest", python-architecture: "x64", rust-target: "x86_64-pc-windows-msvc", name: "windows-x64" },
]
fail-fast: false
env:
CARGO_BUILD_TARGET: ${{ matrix.platform.rust-target }}
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
architecture: ${{ matrix.platform.python-architecture }}
- run: python tests/python_info.py
- name: Set up Rust
uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ matrix.rust-toolchain }}
target: ${{ matrix.platform.rust-target }}
# We use numpy to test the error case of trying to hash a strided buffer.
- name: Install pytest and numpy
run: pip install pytest numpy
- name: Build and install the blake3 module
run: pip install .
- name: Run pytest
if: ${{ matrix.platform.rust-target != 'aarch64-apple-darwin' }}
run: python -u -m pytest --verbose
c_impl:
name: c-impl-${{ matrix.python-version }}-${{ matrix.platform.name }}
runs-on: ${{ matrix.platform.os }}
strategy:
matrix:
# Keep in sync with:
# - dists.yml
# - the rust_impl tests above
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]
platform: [
# This list should be kept in sync with dists.yml.
{ os: "ubuntu-latest", python-architecture: "x64", name: "ubuntu-x64" },
{ os: "macos-13", python-architecture: "x64", name: "macos-x64" },
# disabled for now ref https://github.com/actions/setup-python/issues/855#issuecomment-2196137381
# { os: "macos-14", python-architecture: "x64", name: "macos-arm64" },
{ os: "windows-latest", python-architecture: "x86", name: "windows-x86" },
{ os: "windows-latest", python-architecture: "x64", name: "windows-x64" },
]
fail-fast: false
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
architecture: ${{ matrix.platform.python-architecture }}
- run: python tests/python_info.py
- run: pip install --upgrade setuptools
- name: build the C extension
run: python setup.py build
working-directory: c_impl
- run: git clean -dffx
- name: build the C extension with FORCE_INTRINSICS
run: python setup.py build
working-directory: c_impl
env:
FORCE_INTRINSICS: "1"
- run: git clean -dffx
- name: install the C extension
run: pip install .
working-directory: c_impl
- name: test import, __version__, __file__
run: python -c "import blake3; print(blake3.__version__); print(blake3.__file__)"
# We use numpy to test the error case of trying to hash a strided buffer.
- name: Install pytest and numpy
run: pip install pytest numpy
- name: Run pytest
run: python -u -m pytest --verbose
mypy:
name: "mypy"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "3.x"
# We use numpy to test the error case of trying to hash a strided buffer.
- name: Install pytest, numpy, and mypy
run: pip install pytest numpy mypy
- name: Run mypy
run: python -u -m mypy --strict tests/test_blake3.py