File: tests.yml

package info (click to toggle)
blake3-py 1.0.8-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 1,024 kB
  • sloc: asm: 17,520; ansic: 4,109; python: 598; makefile: 15
file content (130 lines) | stat: -rw-r--r-- 5,418 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
name: tests

on:
  pull_request:
  push:
    branches: [master]
  workflow_dispatch:  # allows running workflow manually from the Actions tab

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:
        #   - pyproject.toml
        #   - dists.yml
        #   - the c_impl tests below
        #   - the mypy checks below
        python-version: ["3.8", "3.9", "3.10", "3.11", "3.12", "3.13", "3.14"]
        rust-toolchain: ["1.80", stable, beta, nightly]
        platform: [
          { os: "ubuntu-latest",  python-architecture: "x64", rust-target: "x86_64-unknown-linux-gnu", name: "ubuntu-x64" },
          { os: "macos-15-intel", 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@v5
      - name: Set up Python
        uses: actions/setup-python@v6
        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:
        #   - pyproject.toml
        #   - dists.yml
        #   - the rust_impl tests above
        #   - the mypy checks below
        python-version: ["3.8", "3.9", "3.10", "3.11", "3.12", "3.13", "3.14"]
        platform: [
          # This list should be kept in sync with dists.yml.
          { os: "ubuntu-latest",  python-architecture: "x64", name: "ubuntu-x64" },
          { os: "macos-15-intel", 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@v5
      - name: Set up Python
        uses: actions/setup-python@v6
        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
    strategy:
      matrix:
        # Keep in sync with:
        #   - pyproject.toml
        #   - dists.yml
        #   - the rust_impl tests above
        #   - the c_impl tests above
        python-version: ["3.8", "3.14"]
    steps:
      - uses: actions/checkout@v5
      - uses: actions/setup-python@v6
        with:
          python-version: ${{ matrix.python-version }}
      # 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 blake3.pyi tests/test_blake3.py