|
10 | 10 | branches: [ "main" ] |
11 | 11 |
|
12 | 12 | jobs: |
13 | | - build: |
| 13 | + build-ubuntu: |
14 | 14 |
|
15 | | - runs-on: ${{matrix.os}} |
| 15 | + runs-on: ubuntu-latest |
16 | 16 | strategy: |
17 | 17 | fail-fast: false |
18 | 18 | matrix: |
19 | 19 | python-version: ["3.9", "3.10", "3.11", "3.12"] |
20 | | - os: [ubuntu-latest, macos-latest] |
21 | 20 |
|
22 | 21 | steps: |
23 | 22 | - uses: actions/checkout@v3 |
24 | 23 | - name: Set up Python ${{ matrix.python-version }} |
25 | 24 | uses: actions/setup-python@v3 |
26 | 25 | with: |
27 | 26 | python-version: ${{ matrix.python-version }} |
28 | | - - name: Install libomp on macOS |
29 | | - if: matrix.os == 'macos-latest' |
30 | | - run: | |
31 | | - brew install libomp |
32 | 27 | - name: Install dependencies |
33 | 28 | run: | |
34 | 29 | python -m pip install --upgrade pip |
35 | 30 | python -m pip install flake8 pytest |
36 | 31 | pip install "numpy<2.0" numba |
37 | | - - name: Install torch (mac) |
38 | | - if: matrix.os == 'macos-latest' |
39 | | - run: pip install torch |
40 | | - - name: Install torch (ubuntu) |
41 | | - if: matrix.os == 'ubuntu-latest' |
| 32 | + - name: Install torch |
42 | 33 | run: pip install torch --index-url https://download.pytorch.org/whl/cpu |
43 | 34 | - name: Lint with flake8 |
44 | 35 | run: | |
45 | 36 | # stop the build if there are Python syntax errors or undefined names |
46 | 37 | flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics |
47 | 38 | # exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide |
48 | 39 | flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics |
| 40 | + - name: Build CPP extension with g++ |
| 41 | + run: | |
| 42 | + python -m pip install -e . |
| 43 | + - name: Test with pytest |
| 44 | + run: | |
| 45 | + pytest |
| 46 | +
|
| 47 | + build-macos: |
| 48 | + if: github.event_name == 'pull_request' |
| 49 | + runs-on: macos-latest |
| 50 | + strategy: |
| 51 | + fail-fast: false |
| 52 | + matrix: |
| 53 | + python-version: ["3.12"] |
| 54 | + |
| 55 | + steps: |
| 56 | + - uses: actions/checkout@v3 |
| 57 | + - name: Set up Python ${{ matrix.python-version }} |
| 58 | + uses: actions/setup-python@v3 |
| 59 | + with: |
| 60 | + python-version: ${{ matrix.python-version }} |
| 61 | + - name: Install libomp |
| 62 | + run: | |
| 63 | + brew install libomp |
| 64 | + - name: Install dependencies |
| 65 | + run: | |
| 66 | + python -m pip install --upgrade pip |
| 67 | + python -m pip install flake8 pytest |
| 68 | + pip install "numpy<2.0" numba torch |
| 69 | + - name: Lint with flake8 |
| 70 | + run: | |
| 71 | + # stop the build if there are Python syntax errors or undefined names |
| 72 | + flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics |
| 73 | + # exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide |
| 74 | + flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics |
49 | 75 | - name: Build CPP extension with clang++ |
50 | | - if: matrix.os == 'macos-latest' |
51 | 76 | run: | |
52 | 77 | export CXX=$(brew --prefix llvm@15)/bin/clang++ |
53 | 78 | export LDFLAGS="-L/usr/local/opt/libomp/lib" |
54 | 79 | export CPPFLAGS="-I/usr/local/opt/libomp/include" |
55 | 80 | python -m pip install -e . |
56 | | - - name: Build CPP extension with g++ |
57 | | - if: matrix.os == 'ubuntu-latest' |
58 | | - run: | |
59 | | - python -m pip install -e . |
60 | 81 | - name: Test with pytest |
61 | 82 | run: | |
62 | 83 | pytest |
0 commit comments