Debian Codegraph @

.github/workflows/tests.yml

raw
1 name: tests
2
3 on:
4 pull_request:
5 push:
6 branches: [master]
7 workflow_dispatch: # allows running workflow manually from the Actions tab
8
9 concurrency: # https://stackoverflow.com/questions/66335225#comment133398800_72408109
10 group: ${{ github.workflow }}-${{ github.ref || github.run_id }}
11 cancel-in-progress: ${{ github.event_name == 'pull_request' }}
12
13 jobs:
14 rust_impl:
15 name: rust-impl-${{ matrix.python-version }}-${{ matrix.rust-toolchain }}-${{ matrix.platform.name }}
16 runs-on: ${{ matrix.platform.os }}
17 strategy:
18 matrix:
19 # Keep in sync with:
20 # - pyproject.toml
21 # - dists.yml
22 # - the c_impl tests below
23 # - the mypy checks below
24 python-version: ["3.8", "3.9", "3.10", "3.11", "3.12", "3.13", "3.14"]
25 rust-toolchain: ["1.80", stable, beta, nightly]
26 platform: [
27 { os: "ubuntu-latest", python-architecture: "x64", rust-target: "x86_64-unknown-linux-gnu", name: "ubuntu-x64" },
28 { os: "macos-15-intel", python-architecture: "x64", rust-target: "x86_64-apple-darwin", name: "macos-x64" },
29 # disabled for now ref https://github.com/actions/setup-python/issues/855#issuecomment-2196137381
30 # { os: "macos-14", python-architecture: "x64", rust-target: "aarch64-apple-darwin", name: "macos-arm64" },
31 { os: "windows-latest", python-architecture: "x86", rust-target: "i686-pc-windows-msvc", name: "windows-x86" },
32 { os: "windows-latest", python-architecture: "x64", rust-target: "x86_64-pc-windows-msvc", name: "windows-x64" },
33 ]
34 fail-fast: false
35 env:
36 CARGO_BUILD_TARGET: ${{ matrix.platform.rust-target }}
37 steps:
38 - uses: actions/checkout@v5
39 - name: Set up Python
40 uses: actions/setup-python@v6
41 with:
42 python-version: ${{ matrix.python-version }}
43 architecture: ${{ matrix.platform.python-architecture }}
44 - run: python tests/python_info.py
45 - name: Set up Rust
46 uses: dtolnay/rust-toolchain@master
47 with:
48 toolchain: ${{ matrix.rust-toolchain }}
49 target: ${{ matrix.platform.rust-target }}
50 # We use numpy to test the error case of trying to hash a strided buffer.
51 - name: Install pytest and numpy
52 run: pip install pytest numpy
53 - name: Build and install the blake3 module
54 run: pip install .
55 - name: Run pytest
56 if: ${{ matrix.platform.rust-target != 'aarch64-apple-darwin' }}
57 run: python -u -m pytest --verbose
58
59 c_impl:
60 name: c-impl-${{ matrix.python-version }}-${{ matrix.platform.name }}
61 runs-on: ${{ matrix.platform.os }}
62 strategy:
63 matrix:
64 # Keep in sync with:
65 # - pyproject.toml
66 # - dists.yml
67 # - the rust_impl tests above
68 # - the mypy checks below
69 python-version: ["3.8", "3.9", "3.10", "3.11", "3.12", "3.13", "3.14"]
70 platform: [
71 # This list should be kept in sync with dists.yml.
72 { os: "ubuntu-latest", python-architecture: "x64", name: "ubuntu-x64" },
73 { os: "macos-15-intel", python-architecture: "x64", name: "macos-x64" },
74 # disabled for now ref https://github.com/actions/setup-python/issues/855#issuecomment-2196137381
75 # { os: "macos-14", python-architecture: "x64", name: "macos-arm64" },
76 { os: "windows-latest", python-architecture: "x86", name: "windows-x86" },
77 { os: "windows-latest", python-architecture: "x64", name: "windows-x64" },
78 ]
79 fail-fast: false
80 steps:
81 - uses: actions/checkout@v5
82 - name: Set up Python
83 uses: actions/setup-python@v6
84 with:
85 python-version: ${{ matrix.python-version }}
86 architecture: ${{ matrix.platform.python-architecture }}
87 - run: python tests/python_info.py
88 - run: pip install --upgrade setuptools
89 - name: build the C extension
90 run: python setup.py build
91 working-directory: c_impl
92 - run: git clean -dffx
93 - name: build the C extension with FORCE_INTRINSICS
94 run: python setup.py build
95 working-directory: c_impl
96 env:
97 FORCE_INTRINSICS: "1"
98 - run: git clean -dffx
99 - name: install the C extension
100 run: pip install .
101 working-directory: c_impl
102 - name: test import, __version__, __file__
103 run: python -c "import blake3; print(blake3.__version__); print(blake3.__file__)"
104 # We use numpy to test the error case of trying to hash a strided buffer.
105 - name: Install pytest and numpy
106 run: pip install pytest numpy
107 - name: Run pytest
108 run: python -u -m pytest --verbose
109
110 mypy:
111 name: "mypy"
112 runs-on: ubuntu-latest
113 strategy:
114 matrix:
115 # Keep in sync with:
116 # - pyproject.toml
117 # - dists.yml
118 # - the rust_impl tests above
119 # - the c_impl tests above
120 python-version: ["3.8", "3.14"]
121 steps:
122 - uses: actions/checkout@v5
123 - uses: actions/setup-python@v6
124 with:
125 python-version: ${{ matrix.python-version }}
126 # We use numpy to test the error case of trying to hash a strided buffer.
127 - name: Install pytest, numpy, and mypy
128 run: pip install pytest numpy mypy
129 - name: Run mypy
130 run: python -u -m mypy --strict blake3.pyi tests/test_blake3.py