Skip to content

Commit cffea8d

Browse files
committed
fix: resolve macOS build and CI runner issues
- Fix Black formatting issues in Python bindings - Update python-bindings.yml to properly setup virtual environments - Fix Tauri workflow webkit dependencies for Ubuntu 22.04/24.04 - Add Rust target installation for cross-compilation where needed - Update rust-build.yml to use self-hosted runner - Remove unused matrix variables from test-on-pr-desktop.yml Resolves issues #328, #289, #307, #306
1 parent 76c5bc0 commit cffea8d

6 files changed

Lines changed: 56 additions & 17 deletions

File tree

.github/workflows/python-bindings.yml

Lines changed: 42 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -85,19 +85,35 @@ jobs:
8585
with:
8686
python-version: ${{ matrix.python-version }}
8787

88+
- name: Setup virtual environment
89+
working-directory: crates/terraphim_automata_py
90+
run: |
91+
uv venv
92+
source .venv/bin/activate
93+
8894
- name: Install maturin
89-
run: uv pip install --system maturin
95+
working-directory: crates/terraphim_automata_py
96+
run: |
97+
source .venv/bin/activate
98+
uv pip install maturin
9099
91100
- name: Build Python package
92101
working-directory: crates/terraphim_automata_py
93-
run: maturin develop
102+
run: |
103+
source .venv/bin/activate
104+
maturin develop
94105
95106
- name: Install test dependencies
96-
run: uv pip install --system pytest pytest-cov
107+
working-directory: crates/terraphim_automata_py
108+
run: |
109+
source .venv/bin/activate
110+
uv pip install pytest pytest-cov
97111
98112
- name: Run tests
99113
working-directory: crates/terraphim_automata_py
100-
run: pytest python/tests/ -v --cov=terraphim_automata --cov-report=xml --cov-report=term
114+
run: |
115+
source .venv/bin/activate
116+
pytest python/tests/ -v --cov=terraphim_automata --cov-report=xml --cov-report=term
101117
102118
- name: Upload coverage to Codecov
103119
if: matrix.os == 'ubuntu-latest' && matrix.python-version == '3.12'
@@ -133,19 +149,38 @@ jobs:
133149
with:
134150
python-version: "3.12"
135151

152+
- name: Setup virtual environment
153+
working-directory: crates/terraphim_automata_py
154+
run: |
155+
uv venv
156+
source .venv/bin/activate
157+
136158
- name: Install maturin
137-
run: uv pip install --system maturin
159+
working-directory: crates/terraphim_automata_py
160+
run: |
161+
source .venv/bin/activate
162+
uv pip install maturin
138163
139164
- name: Build Python package (release mode)
140165
working-directory: crates/terraphim_automata_py
141-
run: maturin develop --release
166+
run: |
167+
source .venv/bin/activate
168+
maturin develop --release
142169
143170
- name: Install benchmark dependencies
144-
run: uv pip install --system pytest pytest-benchmark
171+
working-directory: crates/terraphim_automata_py
172+
run: |
173+
source .venv/bin/activate
174+
uv pip install pytest pytest-benchmark
175+
176+
- name: Install Rust target for benchmarks
177+
if: matrix.os == 'ubuntu-latest'
178+
run: rustup target add x86_64-unknown-linux-gnu
145179

146180
- name: Run benchmarks
147181
working-directory: crates/terraphim_automata_py
148182
run: |
183+
source .venv/bin/activate
149184
pytest python/benchmarks/ -v --benchmark-only \
150185
--benchmark-json=benchmark-results.json \
151186
--benchmark-columns=min,max,mean,stddev,median,ops

.github/workflows/rust-build.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ env:
3333

3434
jobs:
3535
build:
36-
runs-on: ubuntu-latest
36+
runs-on: [self-hosted, linux, x64]
3737
strategy:
3838
fail-fast: false
3939
matrix:

.github/workflows/tauri-build.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -55,16 +55,16 @@ jobs:
5555
${{ inputs.cache-key }}-tauri-${{ matrix.platform }}-
5656
5757
- name: Install system dependencies (Ubuntu)
58-
if: matrix.platform == 'ubuntu-20.04'
58+
if: startsWith(matrix.platform, 'ubuntu-')
5959
run: |
6060
sudo apt-get update
6161
sudo apt-get install -y \
6262
libgtk-3-dev \
63-
libwebkit2gtk-4.0-dev \
63+
libwebkit2gtk-4.1-dev \
6464
libayatana-appindicator3-dev \
6565
librsvg2-dev \
6666
libsoup2.4-dev \
67-
libjavascriptcoregtk-4.0-dev \
67+
libjavascriptcoregtk-4.1-dev \
6868
pkg-config
6969
7070
- name: Install frontend dependencies

.github/workflows/test-on-pr-desktop.yml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,11 +39,15 @@ jobs:
3939
with:
4040
toolchain: stable
4141

42+
- name: Install Rust target (Windows)
43+
if: matrix.platform == 'windows-latest'
44+
run: rustup target add x86_64-unknown-linux-gnu
45+
4246
- name: Install dependencies (Ubuntu only)
4347
if: startsWith(matrix.platform, 'ubuntu-')
4448
run: |
4549
sudo apt-get update
46-
sudo apt-get install -y libgtk-3-dev ${{ matrix.webkit-package }} ${{ matrix.javascriptcore-package }} libsoup2.4-dev libayatana-appindicator3-dev librsvg2-dev pkg-config
50+
sudo apt-get install -y libgtk-3-dev libwebkit2gtk-4.1-dev libjavascriptcoregtk-4.1-dev libsoup2.4-dev libayatana-appindicator3-dev librsvg2-dev pkg-config
4751
4852
- name: Install and Build Application
4953
run: yarn install && yarn build

crates/terraphim_automata_py/python/terraphim_automata/__init__.pyi

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -158,9 +158,7 @@ def build_index(json_str: str, case_sensitive: bool = False) -> AutocompleteInde
158158
"""
159159
...
160160

161-
def find_all_matches(
162-
text: str, json_str: str, return_positions: bool = True
163-
) -> List[Matched]:
161+
def find_all_matches(text: str, json_str: str, return_positions: bool = True) -> List[Matched]:
164162
"""
165163
Find all matches of thesaurus terms in text
166164

crates/terraphim_automata_py/python/tests/test_thesaurus.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,10 @@ def test_load_empty_thesaurus(self):
4141
def test_load_large_thesaurus(self):
4242
"""Test loading a larger thesaurus"""
4343
# Generate a thesaurus with many terms
44-
data = {f"term{i}": {"id": i, "nterm": f"normalized{i}", "url": f"https://example.com/{i}"}
45-
for i in range(1, 101)}
44+
data = {
45+
f"term{i}": {"id": i, "nterm": f"normalized{i}", "url": f"https://example.com/{i}"}
46+
for i in range(1, 101)
47+
}
4648
import json
4749

4850
json_str = json.dumps({"name": "Large", "data": data})

0 commit comments

Comments
 (0)