Skip to content

Commit 622b80f

Browse files
authored
feat(bundler): add Ruby/Bundler ecosystem support (#54)
* feat(bundler): add Ruby/Bundler ecosystem support Add deps-bundler crate with full Gemfile and Gemfile.lock support: - Gemfile DSL parser with regex-based extraction - Gemfile.lock parser with state machine for sections - rubygems.org API client with HTTP caching - Version comparison with pessimistic operator (~>) - Support for git, path, github dependency sources - Group handling (development, test, production) Implements Ecosystem, Dependency, Version, Metadata traits from deps-core. * fix(bundler): improve diagnostics and add README - Fix "Unknown package" false positives for gems in lock file - Parse DEPENDENCIES section for platform-specific gems - Fix clippy warnings (unnecessary raw string hashes) - Add README.md for deps-bundler crate * chore: bump version to 0.6.0 Add Ruby/Bundler ecosystem support as new minor version. * chore(bundler): add benchmarks and CI coverage Add criterion benchmarks for Gemfile and Gemfile.lock parsing with various file sizes (5-100 deps). Configure codecov upload for deps-bundler in CI workflow. * chore(ci): simplify codecov upload to single action Codecov automatically applies flags based on paths defined in codecov.yml. Remove redundant per-crate uploads (8 -> 1). Add missing flags for deps-go and deps-bundler. * test(bundler): increase test coverage to 90%+ Add comprehensive tests for error handling, parser edge cases, registry response parsing, and type implementations. Migrate CI to moonrepo/setup-rust, remove sccache. Add codecov flags for deps-go and deps-bundler. * docs: update CHANGELOG with bundler improvements
1 parent 37f78f3 commit 622b80f

File tree

21 files changed

+4179
-211
lines changed

21 files changed

+4179
-211
lines changed

.github/codecov.yml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,13 @@ ignore:
4141
- "crates/deps-zed/**/*" # WASM extension has limited testing
4242

4343
# Per-crate flags for detailed coverage tracking
44+
# Codecov automatically filters coverage by paths defined here
4445
flags:
46+
overall:
47+
paths:
48+
- crates/
49+
carryforward: true
50+
4551
deps-core:
4652
paths:
4753
- crates/deps-core/src/
@@ -62,6 +68,16 @@ flags:
6268
- crates/deps-pypi/src/
6369
carryforward: true
6470

71+
deps-go:
72+
paths:
73+
- crates/deps-go/src/
74+
carryforward: true
75+
76+
deps-bundler:
77+
paths:
78+
- crates/deps-bundler/src/
79+
carryforward: true
80+
6581
deps-lsp:
6682
paths:
6783
- crates/deps-lsp/src/

.github/workflows/ci.yml

Lines changed: 36 additions & 150 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ on:
88
schedule:
99
- cron: '0 0 * * 0' # Weekly dependency check
1010

11-
# Restrict permissions for all jobs by default
1211
permissions:
1312
contents: read
1413

@@ -20,13 +19,11 @@ env:
2019
RUSTFLAGS: "-D warnings"
2120
RUSTUP_MAX_RETRIES: 10
2221

23-
# Cancel previous runs on new push
2422
concurrency:
2523
group: ${{ github.workflow }}-${{ github.ref }}
2624
cancel-in-progress: true
2725

2826
jobs:
29-
# Detect changes to skip unnecessary jobs
3027
changes:
3128
name: Detect Changes
3229
runs-on: ubuntu-latest
@@ -51,7 +48,6 @@ jobs:
5148
workflows:
5249
- '.github/workflows/**'
5350
54-
# Format check (nightly for Edition 2024)
5551
fmt:
5652
name: Format
5753
needs: changes
@@ -61,15 +57,17 @@ jobs:
6157
steps:
6258
- uses: actions/checkout@v6
6359

64-
- name: Install Rust nightly
65-
uses: dtolnay/rust-toolchain@nightly
60+
- uses: moonrepo/setup-rust@v1
6661
with:
62+
channel: nightly
6763
components: rustfmt
64+
cache: false
65+
env:
66+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
6867

6968
- name: Check formatting
70-
run: cargo fmt --all -- --check
69+
run: cargo +nightly fmt --all -- --check
7170

72-
# Clippy and docs (stable)
7371
check:
7472
name: Check
7573
needs: changes
@@ -79,16 +77,11 @@ jobs:
7977
steps:
8078
- uses: actions/checkout@v6
8179

82-
- name: Install Rust stable
83-
uses: dtolnay/rust-toolchain@stable
80+
- uses: moonrepo/setup-rust@v1
8481
with:
8582
components: clippy
86-
87-
- name: Cache Cargo
88-
uses: Swatinem/rust-cache@v2
89-
with:
90-
shared-key: "check"
91-
save-if: ${{ github.ref == 'refs/heads/main' }}
83+
env:
84+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
9285

9386
- name: Clippy
9487
run: cargo clippy --workspace --all-targets --all-features -- -D warnings
@@ -98,7 +91,6 @@ jobs:
9891
env:
9992
RUSTDOCFLAGS: "-D warnings"
10093

101-
# Security audit
10294
security:
10395
name: Security Audit
10496
needs: changes
@@ -117,12 +109,6 @@ jobs:
117109
- name: Run cargo-deny
118110
run: cargo deny check
119111

120-
# Note: cargo-semver-checks removed for pre-1.0 development
121-
# Checking semver compliance for 7 crates takes 5-7 minutes
122-
# and is not valuable for pre-1.0 versions (breaking changes allowed)
123-
# Re-enable when approaching 1.0.0 release
124-
125-
# Cross-platform tests with matrix
126112
test:
127113
name: Test (${{ matrix.os }}${{ matrix.target && format(' / {0}', matrix.target) || '' }})
128114
needs: [changes, fmt, check]
@@ -135,10 +121,8 @@ jobs:
135121
os: [ubuntu-latest, macos-latest, windows-latest]
136122
rust: [stable]
137123
include:
138-
# Test on beta channel on Linux only
139124
- os: ubuntu-latest
140125
rust: beta
141-
# Cross-compile check for Windows ARM64
142126
- os: windows-latest
143127
rust: stable
144128
target: aarch64-pc-windows-msvc
@@ -147,29 +131,20 @@ jobs:
147131
steps:
148132
- uses: actions/checkout@v6
149133

150-
- name: Install Rust ${{ matrix.rust }}
151-
uses: dtolnay/rust-toolchain@master
134+
- uses: moonrepo/setup-rust@v1
152135
with:
153-
toolchain: ${{ matrix.rust }}
136+
channel: ${{ matrix.rust }}
154137
targets: ${{ matrix.target }}
138+
bins: cargo-nextest
139+
env:
140+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
155141

156-
# Platform-specific setup
157142
- name: Install dependencies (Ubuntu)
158143
if: matrix.os == 'ubuntu-latest'
159144
run: |
160145
sudo apt-get update
161146
sudo apt-get install -y libssl-dev pkg-config
162147
163-
- name: Cache Cargo
164-
uses: Swatinem/rust-cache@v2
165-
with:
166-
shared-key: "test-${{ matrix.os }}${{ matrix.target && format('-{0}', matrix.target) || '' }}"
167-
save-if: ${{ github.ref == 'refs/heads/main' }}
168-
169-
- name: Install nextest
170-
if: ${{ !matrix.cross }}
171-
uses: taiki-e/install-action@nextest
172-
173148
- name: Run tests
174149
if: ${{ !matrix.cross }}
175150
run: cargo nextest run --workspace --all-features --no-fail-fast
@@ -182,10 +157,6 @@ jobs:
182157
if: ${{ matrix.cross }}
183158
run: cargo build --workspace --target ${{ matrix.target }}
184159

185-
# Code coverage (Linux only for speed)
186-
# Optimized: Single test run with codecov flags for per-crate tracking
187-
# Previous approach ran tests 7 times (1 overall + 6 per-crate) taking ~15 min
188-
# New approach: Single run with flags takes ~5 min (67% faster, 67% less runner cost)
189160
coverage:
190161
name: Code Coverage
191162
needs: [changes, fmt, check]
@@ -195,92 +166,30 @@ jobs:
195166
steps:
196167
- uses: actions/checkout@v6
197168

198-
- name: Install Rust
199-
uses: dtolnay/rust-toolchain@stable
200-
201-
- name: Install llvm-cov and nextest
202-
uses: taiki-e/install-action@v2
203-
with:
204-
tool: cargo-llvm-cov,cargo-nextest
205-
206-
- name: Cache Cargo
207-
uses: Swatinem/rust-cache@v2
169+
- uses: moonrepo/setup-rust@v1
208170
with:
209-
shared-key: "coverage"
171+
bins: cargo-llvm-cov,cargo-nextest
172+
env:
173+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
210174

211-
- name: Generate coverage (single run for all crates)
212-
run: |
213-
cargo llvm-cov --all-features --workspace --lcov \
214-
--output-path lcov.info nextest
175+
- name: Generate coverage
176+
run: cargo llvm-cov --all-features --workspace --lcov --output-path lcov.info nextest
215177

216-
# Upload overall coverage with overall flag
217-
- name: Upload overall coverage
178+
- name: Upload coverage
218179
uses: codecov/codecov-action@v5
219180
with:
220181
token: ${{ secrets.CODECOV_TOKEN }}
221182
files: lcov.info
222-
flags: overall
223183
fail_ci_if_error: false
224184
verbose: true
225185

226-
# Upload per-crate coverage using flags
227-
# Codecov automatically filters by file paths in each crate
228-
- name: Upload deps-core coverage
229-
uses: codecov/codecov-action@v5
230-
with:
231-
token: ${{ secrets.CODECOV_TOKEN }}
232-
files: lcov.info
233-
flags: deps-core
234-
fail_ci_if_error: false
235-
236-
- name: Upload deps-cargo coverage
237-
uses: codecov/codecov-action@v5
238-
with:
239-
token: ${{ secrets.CODECOV_TOKEN }}
240-
files: lcov.info
241-
flags: deps-cargo
242-
fail_ci_if_error: false
243-
244-
- name: Upload deps-npm coverage
245-
uses: codecov/codecov-action@v5
246-
with:
247-
token: ${{ secrets.CODECOV_TOKEN }}
248-
files: lcov.info
249-
flags: deps-npm
250-
fail_ci_if_error: false
251-
252-
- name: Upload deps-pypi coverage
253-
uses: codecov/codecov-action@v5
254-
with:
255-
token: ${{ secrets.CODECOV_TOKEN }}
256-
files: lcov.info
257-
flags: deps-pypi
258-
fail_ci_if_error: false
259-
260-
- name: Upload deps-go coverage
261-
uses: codecov/codecov-action@v5
262-
with:
263-
token: ${{ secrets.CODECOV_TOKEN }}
264-
files: lcov.info
265-
flags: deps-go
266-
fail_ci_if_error: false
267-
268-
- name: Upload deps-lsp coverage
269-
uses: codecov/codecov-action@v5
270-
with:
271-
token: ${{ secrets.CODECOV_TOKEN }}
272-
files: lcov.info
273-
flags: deps-lsp
274-
fail_ci_if_error: false
275-
276186
- name: Archive coverage report
277187
uses: actions/upload-artifact@v4
278188
with:
279189
name: coverage-report
280190
path: lcov.info
281191
retention-days: 30
282192

283-
# MSRV check
284193
msrv:
285194
name: Check MSRV
286195
needs: [changes, fmt, check]
@@ -296,23 +205,15 @@ jobs:
296205
MSRV=$(grep '^rust-version' Cargo.toml | sed 's/.*"\(.*\)".*/\1/')
297206
echo "version=$MSRV" >> $GITHUB_OUTPUT
298207
299-
- name: Install Rust ${{ steps.msrv.outputs.version }}
300-
uses: dtolnay/rust-toolchain@master
208+
- uses: moonrepo/setup-rust@v1
301209
with:
302-
toolchain: ${{ steps.msrv.outputs.version }}
303-
304-
- name: Cache Cargo
305-
uses: Swatinem/rust-cache@v2
306-
with:
307-
shared-key: "msrv"
210+
channel: ${{ steps.msrv.outputs.version }}
211+
env:
212+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
308213

309214
- name: Check with MSRV
310215
run: cargo check --workspace --all-features
311216

312-
# WASM build check for Zed extension
313-
# Note: deps-zed is now a separate repository (submodule).
314-
# WASM build is handled in the deps-zed repo CI.
315-
# This job now validates that submodule is properly configured.
316217
wasm:
317218
name: WASM Build (Zed Extension)
318219
needs: [changes, fmt, check]
@@ -324,15 +225,12 @@ jobs:
324225
with:
325226
submodules: true
326227

327-
- name: Install Rust
328-
uses: dtolnay/rust-toolchain@stable
228+
- uses: moonrepo/setup-rust@v1
329229
with:
330230
targets: wasm32-wasip1
331-
332-
- name: Cache Cargo
333-
uses: Swatinem/rust-cache@v2
334-
with:
335-
shared-key: "wasm"
231+
cache-target: release
232+
env:
233+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
336234

337235
- name: Build Zed extension
338236
working-directory: crates/deps-zed
@@ -343,7 +241,6 @@ jobs:
343241
ls -lh crates/deps-zed/target/wasm32-wasip1/release/*.wasm
344242
du -sh crates/deps-zed/target/wasm32-wasip1/release/*.wasm
345243
346-
# Verify benchmarks compile (without running)
347244
benchmark:
348245
name: Check Benchmarks
349246
needs: [changes, fmt, check]
@@ -353,19 +250,13 @@ jobs:
353250
steps:
354251
- uses: actions/checkout@v6
355252

356-
- name: Install Rust
357-
uses: dtolnay/rust-toolchain@stable
358-
359-
- name: Cache Cargo
360-
uses: Swatinem/rust-cache@v2
361-
with:
362-
shared-key: "bench"
363-
save-if: ${{ github.ref == 'refs/heads/main' }}
253+
- uses: moonrepo/setup-rust@v1
254+
env:
255+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
364256

365257
- name: Build benchmarks
366258
run: cargo build --workspace --benches
367259

368-
# Release build check
369260
release-check:
370261
name: Release Build Check
371262
needs: [test]
@@ -374,13 +265,11 @@ jobs:
374265
steps:
375266
- uses: actions/checkout@v6
376267

377-
- name: Install Rust
378-
uses: dtolnay/rust-toolchain@stable
379-
380-
- name: Cache Cargo
381-
uses: Swatinem/rust-cache@v2
268+
- uses: moonrepo/setup-rust@v1
382269
with:
383-
shared-key: "release"
270+
cache-target: release
271+
env:
272+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
384273

385274
- name: Build release
386275
run: cargo build --workspace --release --all-features
@@ -390,7 +279,6 @@ jobs:
390279
ls -lh target/release/
391280
du -sh target/release/
392281
393-
# All checks passed
394282
ci-success:
395283
name: CI Success
396284
needs: [changes, fmt, check, security, test, coverage, msrv, wasm, benchmark]
@@ -399,13 +287,11 @@ jobs:
399287
steps:
400288
- name: Check all jobs
401289
run: |
402-
# If no relevant changes, all skipped jobs are OK
403290
if [[ "${{ needs.changes.outputs.rust }}" != "true" && "${{ needs.changes.outputs.workflows }}" != "true" ]]; then
404291
echo "No relevant changes - skipped jobs are OK"
405292
exit 0
406293
fi
407294
408-
# Check if any required job failed (skipped is OK for conditional jobs)
409295
check_job() {
410296
local result="$1"
411297
local name="$2"

0 commit comments

Comments
 (0)