Skip to content

Commit dd49a4d

Browse files
committed
fix(ci): make cargo-make tasks cross-platform
- Use taiki-e/install-action@cargo-deny instead of cargo-make install - Replace bash scripts with cross-platform cargo-make commands - Split test-node, test-python, coverage-* tasks into subtasks - Use cwd and command/args instead of script blocks - Fixes Windows CI failures due to missing /bin/bash
1 parent badcf15 commit dd49a4d

File tree

2 files changed

+101
-85
lines changed

2 files changed

+101
-85
lines changed

.github/workflows/ci.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -74,11 +74,11 @@ jobs:
7474
with:
7575
shared-key: "security"
7676

77-
- name: Install cargo-make
78-
uses: taiki-e/install-action@cargo-make
77+
- name: Install cargo-deny
78+
uses: taiki-e/install-action@cargo-deny
7979

80-
- name: Run security checks
81-
run: cargo make ci-security
80+
- name: Run cargo-deny
81+
run: cargo deny check
8282

8383
# Cross-platform Rust tests
8484
test-rust:

Makefile.toml

Lines changed: 97 additions & 81 deletions
Original file line numberDiff line numberDiff line change
@@ -129,49 +129,49 @@ dependencies = ["test-rust", "doctest"]
129129

130130
[tasks.test-python]
131131
description = "Build and test Python bindings"
132-
dependencies = ["build-python", "test-python-run"]
132+
condition = { files_exist = ["${CARGO_MAKE_WORKING_DIRECTORY}/crates/feedparser-rs-py/Cargo.toml"] }
133+
dependencies = ["test-python-deps", "test-python-build", "test-python-install", "test-python-run", "test-python-import"]
134+
135+
[tasks.test-python-deps]
136+
description = "Install Python dependencies"
137+
command = "uv"
138+
args = ["pip", "install", "--system", "maturin", "pytest"]
133139

134-
[tasks.build-python]
140+
[tasks.test-python-build]
135141
description = "Build Python wheel with maturin"
136-
condition = { files_exist = ["${CARGO_MAKE_WORKING_DIRECTORY}/crates/feedparser-rs-py/Cargo.toml"] }
137-
script = '''
138-
#!/bin/bash
139-
set -e
140-
cd crates/feedparser-rs-py
142+
cwd = "./crates/feedparser-rs-py"
143+
command = "maturin"
144+
args = ["build", "--release", "--out", "dist"]
141145

142-
# Check if uv is available, fallback to pip
143-
if command -v uv &> /dev/null; then
144-
uv pip install --system maturin pytest
145-
else
146-
pip install maturin pytest
147-
fi
146+
[tasks.test-python-install]
147+
description = "Install built wheel"
148+
cwd = "./crates/feedparser-rs-py"
149+
command = "uv"
150+
args = ["pip", "install", "--system", "--reinstall", "--no-deps", "dist/feedparser_rs-0.1.0-cp39-abi3-${CARGO_MAKE_RUST_TARGET_TRIPLE}.whl"]
151+
# Note: wheel name pattern may need adjustment per platform
148152

149-
maturin build --release --out dist
150-
'''
153+
[tasks.test-python-install.linux]
154+
command = "uv"
155+
args = ["pip", "install", "--system", "--reinstall", "--no-deps", "--find-links", "dist", "feedparser-rs"]
151156

152-
[tasks.test-python-run]
153-
description = "Run pytest on Python bindings"
154-
condition = { files_exist = ["${CARGO_MAKE_WORKING_DIRECTORY}/crates/feedparser-rs-py/tests"] }
155-
script = '''
156-
#!/bin/bash
157-
set -e
158-
cd crates/feedparser-rs-py
157+
[tasks.test-python-install.mac]
158+
command = "uv"
159+
args = ["pip", "install", "--system", "--reinstall", "--no-deps", "--find-links", "dist", "feedparser-rs"]
159160

160-
# Install the built wheel
161-
if command -v uv &> /dev/null; then
162-
uv pip install --system dist/*.whl
163-
else
164-
pip install dist/*.whl
165-
fi
161+
[tasks.test-python-install.windows]
162+
command = "uv"
163+
args = ["pip", "install", "--system", "--reinstall", "--no-deps", "--find-links", "dist", "feedparser-rs"]
166164

167-
# Run tests if they exist
168-
if [ -d "tests" ] && [ "$(ls -A tests/*.py 2>/dev/null)" ]; then
169-
pytest tests/ -v
170-
fi
165+
[tasks.test-python-run]
166+
description = "Run pytest"
167+
cwd = "./crates/feedparser-rs-py"
168+
command = "pytest"
169+
args = ["tests/", "-v"]
171170

172-
# Test import
173-
python -c "import feedparser_rs; print('feedparser-rs loaded successfully')"
174-
'''
171+
[tasks.test-python-import]
172+
description = "Test Python import"
173+
command = "python"
174+
args = ["-c", "import feedparser_rs; print('feedparser-rs loaded successfully')"]
175175

176176
# ============================================================================
177177
# Testing Tasks - Node.js
@@ -180,15 +180,25 @@ python -c "import feedparser_rs; print('feedparser-rs loaded successfully')"
180180
[tasks.test-node]
181181
description = "Build and test Node.js bindings"
182182
condition = { files_exist = ["${CARGO_MAKE_WORKING_DIRECTORY}/crates/feedparser-rs-node/package.json"] }
183-
script = '''
184-
#!/bin/bash
185-
set -e
186-
cd crates/feedparser-rs-node
187-
188-
npm ci
189-
npm run build
190-
npm test
191-
'''
183+
dependencies = ["test-node-install", "test-node-build", "test-node-run"]
184+
185+
[tasks.test-node-install]
186+
description = "Install Node.js dependencies"
187+
cwd = "./crates/feedparser-rs-node"
188+
command = "npm"
189+
args = ["ci"]
190+
191+
[tasks.test-node-build]
192+
description = "Build Node.js bindings"
193+
cwd = "./crates/feedparser-rs-node"
194+
command = "npm"
195+
args = ["run", "build"]
196+
197+
[tasks.test-node-run]
198+
description = "Run Node.js tests"
199+
cwd = "./crates/feedparser-rs-node"
200+
command = "npm"
201+
args = ["test"]
192202

193203
# ============================================================================
194204
# Coverage Tasks
@@ -219,47 +229,53 @@ echo "Coverage report generated: lcov.info"
219229
[tasks.coverage-python]
220230
description = "Generate Python code coverage"
221231
condition = { files_exist = ["${CARGO_MAKE_WORKING_DIRECTORY}/crates/feedparser-rs-py/tests"] }
222-
script = '''
223-
#!/bin/bash
224-
set -e
225-
cd crates/feedparser-rs-py
226-
227-
# Install dependencies
228-
if command -v uv &> /dev/null; then
229-
uv pip install --system maturin pytest pytest-cov
230-
else
231-
pip install maturin pytest pytest-cov
232-
fi
233-
234-
# Build and install wheel
235-
maturin build --release --out dist
236-
if command -v uv &> /dev/null; then
237-
uv pip install --system --force-reinstall dist/*.whl
238-
else
239-
pip install --force-reinstall dist/*.whl
240-
fi
241-
242-
# Run tests with coverage if tests exist
243-
if [ -d "tests" ] && [ "$(ls -A tests/*.py 2>/dev/null)" ]; then
244-
pytest tests/ --cov=feedparser_rs --cov-report=xml --cov-report=term
245-
echo "Python coverage report generated: coverage.xml"
246-
fi
247-
'''
232+
dependencies = ["coverage-python-deps", "coverage-python-build", "coverage-python-install", "coverage-python-run"]
233+
234+
[tasks.coverage-python-deps]
235+
description = "Install Python coverage dependencies"
236+
command = "uv"
237+
args = ["pip", "install", "--system", "maturin", "pytest", "pytest-cov"]
238+
239+
[tasks.coverage-python-build]
240+
description = "Build Python wheel for coverage"
241+
cwd = "./crates/feedparser-rs-py"
242+
command = "maturin"
243+
args = ["build", "--release", "--out", "dist"]
244+
245+
[tasks.coverage-python-install]
246+
description = "Install built wheel for coverage"
247+
cwd = "./crates/feedparser-rs-py"
248+
command = "uv"
249+
args = ["pip", "install", "--system", "--reinstall", "--no-deps", "--find-links", "dist", "feedparser-rs"]
250+
251+
[tasks.coverage-python-run]
252+
description = "Run pytest with coverage"
253+
cwd = "./crates/feedparser-rs-py"
254+
command = "pytest"
255+
args = ["tests/", "--cov=feedparser_rs", "--cov-report=xml", "--cov-report=term"]
248256

249257
[tasks.coverage-node]
250258
description = "Generate Node.js code coverage with c8"
251259
condition = { files_exist = ["${CARGO_MAKE_WORKING_DIRECTORY}/crates/feedparser-rs-node/package.json"] }
252-
script = '''
253-
#!/bin/bash
254-
set -e
255-
cd crates/feedparser-rs-node
256-
257-
npm ci
258-
npm run build
259-
npm run test:coverage
260-
261-
echo "Node.js coverage report generated in coverage/"
262-
'''
260+
dependencies = ["coverage-node-install", "coverage-node-build", "coverage-node-run"]
261+
262+
[tasks.coverage-node-install]
263+
description = "Install Node.js dependencies for coverage"
264+
cwd = "./crates/feedparser-rs-node"
265+
command = "npm"
266+
args = ["ci"]
267+
268+
[tasks.coverage-node-build]
269+
description = "Build Node.js bindings for coverage"
270+
cwd = "./crates/feedparser-rs-node"
271+
command = "npm"
272+
args = ["run", "build"]
273+
274+
[tasks.coverage-node-run]
275+
description = "Run Node.js tests with coverage"
276+
cwd = "./crates/feedparser-rs-node"
277+
command = "npm"
278+
args = ["run", "test:coverage"]
263279

264280
# ============================================================================
265281
# MSRV Check

0 commit comments

Comments
 (0)