66 - ' v*'
77
88jobs :
9- build-extension :
9+ build-and-test :
1010 strategy :
1111 fail-fast : false
1212 matrix :
1313 include :
1414 - os : ubuntu-latest
1515 artifact : graphqlite.so
16- - os : macos-latest
16+ artifact-name : graphqlite-linux-x86_64.so
17+ - os : macos-14
18+ arch : arm64
1719 artifact : graphqlite.dylib
20+ artifact-name : graphqlite-macos-arm64.dylib
21+ - os : macos-14
22+ arch : x86_64
23+ artifact : graphqlite.dylib
24+ artifact-name : graphqlite-macos-x86_64.dylib
25+ - os : windows-latest
26+ artifact : graphqlite.dll
27+ artifact-name : graphqlite-windows-x86_64.dll
1828
1929 runs-on : ${{ matrix.os }}
2030
31+ defaults :
32+ run :
33+ shell : ${{ matrix.os == 'windows-latest' && 'msys2 {0}' || 'bash' }}
34+
2135 steps :
2236 - uses : actions/checkout@v4
2337
38+ - name : Setup MSYS2 (Windows)
39+ if : runner.os == 'Windows'
40+ uses : msys2/setup-msys2@v2
41+ with :
42+ msystem : MINGW64
43+ update : true
44+ install : >-
45+ mingw-w64-x86_64-gcc
46+ mingw-w64-x86_64-sqlite3
47+ mingw-w64-x86_64-libsystre
48+ bison
49+ flex
50+ make
51+
2452 - name : Install dependencies (Linux)
2553 if : runner.os == 'Linux'
2654 run : |
@@ -34,23 +62,74 @@ jobs:
3462 echo "$(brew --prefix bison)/bin" >> $GITHUB_PATH
3563 echo "$(brew --prefix flex)/bin" >> $GITHUB_PATH
3664 echo "HOMEBREW_PREFIX=$(brew --prefix)" >> $GITHUB_ENV
65+ echo "SQLITE_PREFIX=$(brew --prefix sqlite)" >> $GITHUB_ENV
3766
3867 - name : Build extension (Linux)
3968 if : runner.os == 'Linux'
40- run : make extension
69+ run : make extension RELEASE=1
4170
42- - name : Build extension (macOS)
43- if : runner.os == 'macOS'
44- run : make extension EXTRA_INCLUDES="-I$HOMEBREW_PREFIX/include" EXTRA_LIBS="-L$HOMEBREW_PREFIX/lib"
71+ - name : Build extension (macOS arm64)
72+ if : runner.os == 'macOS' && matrix.arch == 'arm64'
73+ run : make extension RELEASE=1 EXTRA_INCLUDES="-I$HOMEBREW_PREFIX/include" EXTRA_LIBS="-L$HOMEBREW_PREFIX/lib"
74+
75+ - name : Build extension (macOS x86_64 cross-compile)
76+ if : runner.os == 'macOS' && matrix.arch == 'x86_64'
77+ run : make extension RELEASE=1 CC="clang -arch x86_64" EXTRA_INCLUDES="-I$HOMEBREW_PREFIX/include" EXTRA_LIBS="-L$HOMEBREW_PREFIX/lib"
78+
79+ - name : Build extension (Windows)
80+ if : runner.os == 'Windows'
81+ run : make extension RELEASE=1
82+
83+ # Python binding tests
84+ - name : Set up Python (Linux/Windows)
85+ if : runner.os != 'macOS'
86+ uses : actions/setup-python@v5
87+ with :
88+ python-version : ' 3.11'
89+
90+ - name : Install and test Python bindings (Linux)
91+ if : runner.os == 'Linux'
92+ run : |
93+ pip install -e "./bindings/python[dev]"
94+ cd bindings/python && pytest tests/ -v
95+
96+ - name : Install and test Python bindings (macOS)
97+ if : runner.os == 'macOS' && matrix.arch == 'arm64'
98+ run : |
99+ # Use Homebrew Python which supports extension loading
100+ brew install python@3.11
101+ $(brew --prefix python@3.11)/libexec/bin/python -m pip install -e "./bindings/python[dev]"
102+ DYLD_LIBRARY_PATH="$SQLITE_PREFIX/lib:$DYLD_LIBRARY_PATH" $(brew --prefix python@3.11)/libexec/bin/python -m pytest bindings/python/tests/ -v
103+
104+ - name : Install and test Python bindings (Windows)
105+ if : runner.os == 'Windows'
106+ shell : bash
107+ run : |
108+ pip install -e "./bindings/python[dev]"
109+ cd bindings/python && pytest tests/ -v
110+
111+ # Rust binding tests (skip for cross-compiled x86_64)
112+ - name : Install Rust toolchain
113+ if : matrix.arch != 'x86_64'
114+ uses : dtolnay/rust-toolchain@stable
115+
116+ - name : Test Rust bindings
117+ if : matrix.arch != 'x86_64'
118+ working-directory : bindings/rust
119+ shell : bash
120+ run : cargo test -- --test-threads=1
121+
122+ - name : Rename artifact
123+ run : cp build/${{ matrix.artifact }} build/${{ matrix.artifact-name }}
45124
46125 - name : Upload extension artifact
47126 uses : actions/upload-artifact@v4
48127 with :
49- name : extension- ${{ matrix.os }}
50- path : build/${{ matrix.artifact }}
128+ name : ${{ matrix.artifact-name }}
129+ path : build/${{ matrix.artifact-name }}
51130
52131 publish-python :
53- needs : build-extension
132+ needs : build-and-test
54133 runs-on : ubuntu-latest
55134
56135 steps :
76155 run : twine upload dist/*
77156
78157 publish-rust :
158+ needs : build-and-test
79159 runs-on : ubuntu-latest
80160
81161 steps :
91171 run : cargo publish --allow-dirty
92172
93173 create-release :
94- needs : [build-extension , publish-python, publish-rust]
174+ needs : [build-and-test , publish-python, publish-rust]
95175 runs-on : ubuntu-latest
96176
97177 steps :
@@ -106,6 +186,5 @@ jobs:
106186 uses : softprops/action-gh-release@v1
107187 with :
108188 files : |
109- artifacts/extension-ubuntu-latest/*
110- artifacts/extension-macos-latest/*
189+ artifacts/**/*
111190 generate_release_notes : true
0 commit comments