Skip to content

Commit eebff27

Browse files
committed
refactor: disable macos runner on pushes
1 parent f43f3db commit eebff27

File tree

1 file changed

+38
-17
lines changed

1 file changed

+38
-17
lines changed

.github/workflows/python-package.yml

Lines changed: 38 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -10,53 +10,74 @@ on:
1010
branches: [ "main" ]
1111

1212
jobs:
13-
build:
13+
build-ubuntu:
1414

15-
runs-on: ${{matrix.os}}
15+
runs-on: ubuntu-latest
1616
strategy:
1717
fail-fast: false
1818
matrix:
1919
python-version: ["3.9", "3.10", "3.11", "3.12"]
20-
os: [ubuntu-latest, macos-latest]
2120

2221
steps:
2322
- uses: actions/checkout@v3
2423
- name: Set up Python ${{ matrix.python-version }}
2524
uses: actions/setup-python@v3
2625
with:
2726
python-version: ${{ matrix.python-version }}
28-
- name: Install libomp on macOS
29-
if: matrix.os == 'macos-latest'
30-
run: |
31-
brew install libomp
3227
- name: Install dependencies
3328
run: |
3429
python -m pip install --upgrade pip
3530
python -m pip install flake8 pytest
3631
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
4233
run: pip install torch --index-url https://download.pytorch.org/whl/cpu
4334
- name: Lint with flake8
4435
run: |
4536
# stop the build if there are Python syntax errors or undefined names
4637
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
4738
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
4839
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
4975
- name: Build CPP extension with clang++
50-
if: matrix.os == 'macos-latest'
5176
run: |
5277
export CXX=$(brew --prefix llvm@15)/bin/clang++
5378
export LDFLAGS="-L/usr/local/opt/libomp/lib"
5479
export CPPFLAGS="-I/usr/local/opt/libomp/include"
5580
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 .
6081
- name: Test with pytest
6182
run: |
6283
pytest

0 commit comments

Comments
 (0)