-
Notifications
You must be signed in to change notification settings - Fork 251
107 lines (93 loc) · 3.11 KB
/
build_cython.yml
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
name: Build Cython Extensions
on:
push:
paths:
- 'retopoflow/cy/*.pyx'
- 'retopoflow/cy/*.pxd'
- 'cy_setup.py'
- '.github/workflows/build_cython.yml'
pull_request:
paths:
- 'retopoflow/cy/*.pyx'
- 'retopoflow/cy/*.pxd'
- 'cy_setup.py'
workflow_dispatch: # Allows manual triggering
jobs:
build:
name: Build on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
python-version: ['3.11']
include:
- os: macos-latest
target: native
compile_target: arm64
- os: macos-latest
target: intel
compile_target: x86_64
steps:
- uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install cython numpy setuptools wheel
- name: Build Cython extensions
shell: bash
env:
ARCHFLAGS: ${{ matrix.target == 'intel' && '-arch x86_64' || matrix.target == 'native' && '-arch arm64' || '' }}
run: |
python -m pip install --upgrade pip
python -m pip install cython numpy setuptools wheel
python cy_setup.py build_ext --inplace
- name: List compiled extensions
shell: bash
run: |
cd retopoflow/cy
echo "Current directory contents:"
ls -la
echo -e "\nSearching for compiled files recursively:"
find . -type f \( -name "*.so" -o -name "*.pyd" \) || true
# Don't fail if no files are found
if ! find . -type f \( -name "*.so" -o -name "*.pyd" \) | grep -q .; then
echo "No compiled extensions found. This might indicate a build issue."
# Continue without failing
exit 0
fi
- name: Upload compiled extensions
uses: actions/upload-artifact@v4
if: always() # Try to upload even if previous step failed
with:
name: compiled-extensions-${{ matrix.os }}
path: |
retopoflow/cy/**/*.so
retopoflow/cy/**/*.pyd
if-no-files-found: warn # Change from error to warn
retention-days: 7
commit-files:
needs: build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Download all artifacts
uses: actions/download-artifact@v4
with:
path: artifacts
merge-multiple: true
- name: Copy compiled files to cy folder
run: |
mkdir -p retopoflow/cy
find artifacts -type f \( -name "*.so" -o -name "*.pyd" \) -exec cp -f {} retopoflow/cy/ \;
- name: Commit and push changes
run: |
git config --local user.email "github-actions[bot]@users.noreply.github.com"
git config --local user.name "github-actions[bot]"
git add retopoflow/cy/*.so retopoflow/cy/*.pyd
git commit -m "Update compiled Cython extensions [skip ci]" || echo "No changes to commit"
git push