|
8 | 8 | branches: [ main ] |
9 | 9 |
|
10 | 10 | jobs: |
11 | | - |
12 | | - build: |
| 11 | + lint: |
| 12 | + runs-on: ubuntu-22.04 |
| 13 | + steps: |
| 14 | + - uses: actions/checkout@v4 |
| 15 | + - uses: astral-sh/ruff-action@v3 |
| 16 | + - run: ruff check |
| 17 | + - run: ruff format --check --diff |
| 18 | + build-binaries: |
| 19 | + needs: [ lint ] |
13 | 20 | strategy: |
14 | 21 | matrix: |
15 | 22 | include: |
16 | | - - name: x86-windows |
17 | | - image: windows-2022 |
18 | | - arch: x86 |
| 23 | + - name: x86_64-linux |
| 24 | + image: ubuntu-22.04 |
| 25 | + cmake-args: -D ARCHITECTURE=x86_64 |
19 | 26 | - name: x86_64-windows |
20 | 27 | image: windows-2022 |
21 | | - arch: x86_64 |
22 | | - - name: x86_64-linux |
23 | | - image: ubuntu-20.04 |
24 | | - arch: x86_64 |
| 28 | + cmake-args: -A x64 -D ARCHITECTURE=x86_64 |
25 | 29 | - name: x86_64-darwin |
26 | | - image: macos-12 |
27 | | - arch: x86_64 |
| 30 | + image: macos-13 |
| 31 | + cmake-args: -D CMAKE_OSX_ARCHITECTURES=x86_64 -D ARCHITECTURE=x86_64 |
| 32 | + - name: aarch64-darwin |
| 33 | + image: macos-13 |
| 34 | + cmake-args: -D CMAKE_OSX_ARCHITECTURES=arm64 -D ARCHITECTURE=aarch64 |
28 | 35 | runs-on: ${{ matrix.image }} |
29 | 36 | steps: |
30 | 37 | - name: Checkout repository |
31 | 38 | uses: actions/checkout@v4 |
32 | | - - name: Setup Python |
33 | | - uses: actions/setup-python@v5 |
34 | | - with: |
35 | | - python-version: '3.x' |
36 | | - - name: Query Python executable |
37 | | - run: which python |
38 | | - - name: Install dependencies |
39 | | - run: python -m pip install h5py matplotlib numpy pytest scipy setuptools wheel |
40 | | - - name: Build Python Wheel |
41 | | - run: python setup.py bdist_wheel |
42 | | - - name: Install Python Wheel |
43 | | - shell: bash |
| 39 | + with: |
| 40 | + submodules: true |
| 41 | + - name: Build NDTable |
44 | 42 | run: | |
45 | | - for f in dist/SDF-*-py3-none-any.whl; do |
46 | | - python -m pip install $f --no-deps -vv |
47 | | - done |
48 | | - - name: Run Python tests |
49 | | - run: pytest tests |
50 | | - - name: Upload artifacts |
51 | | - uses: actions/upload-artifact@v4 |
| 43 | + cmake -S C -B C/${{ matrix.name }} ${{ matrix.cmake-args }} |
| 44 | + cmake --build C/${{ matrix.name }} --target install |
| 45 | + - uses: actions/upload-artifact@v4 |
52 | 46 | with: |
53 | 47 | name: ${{ matrix.name }} |
54 | | - path: dist/*.whl |
| 48 | + path: src/sdf/ndtable/${{ matrix.name }} |
55 | 49 | if-no-files-found: error |
| 50 | + build-wheel: |
| 51 | + runs-on: ubuntu-22.04 |
| 52 | + needs: [build-binaries] |
| 53 | + steps: |
| 54 | + - uses: astral-sh/setup-uv@v4 |
| 55 | + - uses: actions/checkout@v4 |
| 56 | + - uses: actions/download-artifact@v4 |
| 57 | + with: |
| 58 | + name: x86_64-linux |
| 59 | + path: src/sdf/ndtable/x86_64-linux |
| 60 | + - uses: actions/download-artifact@v4 |
| 61 | + - uses: actions/download-artifact@v4 |
| 62 | + with: |
| 63 | + name: x86_64-windows |
| 64 | + path: src/sdf/ndtable/x86_64-windows |
| 65 | + - uses: actions/download-artifact@v4 |
| 66 | + with: |
| 67 | + name: x86_64-darwin |
| 68 | + path: src/sdf/ndtable/x86_64-darwin |
| 69 | + - uses: actions/download-artifact@v4 |
| 70 | + with: |
| 71 | + name: aarch64-darwin |
| 72 | + path: src/sdf/ndtable/aarch64-darwin |
| 73 | + - run: uv build --wheel |
| 74 | + - uses: actions/upload-artifact@v4 |
| 75 | + with: |
| 76 | + name: dist |
| 77 | + path: dist |
| 78 | + if-no-files-found: error |
| 79 | + run-tests: |
| 80 | + needs: [ build-wheel ] |
| 81 | + strategy: |
| 82 | + matrix: |
| 83 | + include: |
| 84 | + - name: x86_64-linux |
| 85 | + image: ubuntu-22.04 |
| 86 | + - name: x86_64-windows |
| 87 | + image: windows-2022 |
| 88 | + - name: x86_64-darwin |
| 89 | + image: macos-13 |
| 90 | + - name: aarch64-darwin |
| 91 | + image: macos-13 |
| 92 | + runs-on: ${{ matrix.image }} |
| 93 | + steps: |
| 94 | + - uses: actions/checkout@v4 |
| 95 | + - run: rm pyproject.toml |
| 96 | + - uses: astral-sh/setup-uv@v4 |
| 97 | + - uses: actions/download-artifact@v4 |
| 98 | + with: |
| 99 | + name: dist |
| 100 | + - if: matrix.name == 'x86_64-windows' |
| 101 | + run: | |
| 102 | + uv venv --python 3.10 |
| 103 | + .venv\Scripts\activate |
| 104 | + uv pip install pytest |
| 105 | + $files = Get-ChildItem "sdf-*-py3-none-any.whl" |
| 106 | + foreach ($f in $files) { |
| 107 | + uv pip install $f.FullName |
| 108 | + } |
| 109 | + uv run pytest |
| 110 | + - if: matrix.name != 'x86_64-windows' |
| 111 | + run: | |
| 112 | + uv venv --python 3.10 |
| 113 | + source .venv/bin/activate |
| 114 | + uv pip install pytest |
| 115 | + uv pip install sdf-*-py3-none-any.whl |
| 116 | + uv run pytest |
0 commit comments