Debian Codegraph @

.github/workflows/tests.yml

raw
1 name: tests
2
3 on:
4 push:
5 paths-ignore:
6 - "*.md"
7 pull_request:
8 types: [opened, synchronize, reopened, edited]
9 paths-ignore:
10 - "*.md"
11
12 env:
13 MODULE_NAME: 'blis'
14 RUN_MYPY: 'false'
15
16 jobs:
17 tests:
18 name: Test
19 if: github.repository_owner == 'explosion'
20 strategy:
21 fail-fast: true
22 matrix:
23 os: [ubuntu-latest, windows-latest, macos-13]
24 python_version: ["3.9", "3.10", "3.11", "3.12"]
25 runs-on: ${{ matrix.os }}
26
27 steps:
28 - name: Check out repo
29 uses: actions/checkout@v3
30
31 - name: Configure Python version
32 uses: actions/setup-python@v4
33 with:
34 python-version: ${{ matrix.python_version }}
35 architecture: x64
36
37 - name: Preinstall (Windows)
38 shell: bash
39 if: startsWith(matrix.os, 'windows')
40 run: |
41 choco install llvm
42
43 - name: Install dependencies
44 run: |
45 python -m pip install -U build pip setuptools wheel
46
47 - name: Build wheel (Windows)
48 if: startsWith(matrix.os, 'windows')
49 run: |
50 set "PATH=C:\Program Files\LLVM\bin;%PATH%"
51 set "AR=llvm-ar"
52 set "AS=llvm-as"
53 set "CC=clang"
54 set RANLIB=echo
55 clang --version
56 python -m build --wheel
57
58 - name: Build wheel (Mac)
59 if: startsWith(matrix.os, 'macos')
60 run: |
61 python -m build --wheel
62
63 - name: Build wheel (Linux / clang)
64 if: startsWith(matrix.os, 'ubuntu') && matrix.python_version == '3.6'
65 run: |
66 clang --version
67 CC=clang python -m build --wheel
68
69 - name: Build wheel (Linux / gcc-9)
70 if: startsWith(matrix.os, 'ubuntu') && (matrix.python_version == '3.7' || matrix.python_version == '3.8')
71 run: |
72 gcc-9 --version
73 CC=gcc-9 python -m build --wheel
74
75 - name: Build wheel (Linux / gcc-10)
76 if: startsWith(matrix.os, 'ubuntu') && matrix.python_version == '3.9'
77 run: |
78 gcc-10 --version
79 CC=gcc-10 python -m build --wheel
80
81 - name: Build wheel (Linux / clang-13)
82 if: startsWith(matrix.os, 'ubuntu') && matrix.python_version == '3.10'
83 run: |
84 clang-13 --version
85 CC=clang-13 python -m build --wheel
86
87 - name: Build wheel (Linux / gcc)
88 if: startsWith(matrix.os, 'ubuntu') && (matrix.python_version == '3.11' || matrix.python_version == '3.12')
89 run: |
90 gcc --version
91 CC=gcc python -m build --wheel
92
93 # TODO: install mypy from requirements if reenabled
94 - name: Run mypy
95 shell: bash
96 if: ${{ env.RUN_MYPY == 'true' }}
97 run: |
98 python -m mypy $MODULE_NAME
99
100 - name: Uninstall all packages
101 run: |
102 python -m pip freeze > installed.txt
103 python -m pip uninstall -y -r installed.txt
104
105 - name: Install wheel
106 shell: bash
107 run: |
108 python -m pip install dist/*.whl
109
110 - name: Delete source directory
111 shell: bash
112 run: |
113 rm -rf $MODULE_NAME
114
115 - name: Test import
116 shell: bash
117 run: |
118 python -c "import $MODULE_NAME" -Werror
119
120 - name: Install test requirements
121 run: |
122 python -m pip install -U -r requirements.txt
123
124 - name: Run tests
125 shell: bash
126 run: |
127 python -m pytest --pyargs $MODULE_NAME -Werror