Skip to content

Commit ab2dd65

Browse files
committed
Make the test and lint workflows faster
1 parent 3c6cb8c commit ab2dd65

File tree

5 files changed

+22
-14
lines changed

5 files changed

+22
-14
lines changed

.github/workflows/lint.yml

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,12 +24,13 @@ jobs:
2424
uses: actions-rust-lang/setup-rust-toolchain@v1
2525
with:
2626
toolchain: stable
27+
components: clippy
2728

28-
- name: Install Dependencies
29-
run: |
30-
sudo apt-get update
31-
sudo apt-get install -y clang curl pkg-config libssl-dev make
32-
make install-deps
29+
- name: Cache Rust dependencies
30+
uses: Swatinem/rust-cache@v2
31+
32+
- name: Install System Dependencies
33+
run: sudo apt-get update && sudo apt-get install -y make
3334

3435
- name: Run Linters
3536
run: make lint

.github/workflows/tests.yml

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -31,11 +31,14 @@ jobs:
3131
with:
3232
toolchain: ${{ matrix.rust-version }}
3333

34-
- name: Install Dependencies
35-
run: |
36-
sudo apt-get update
37-
sudo apt-get install -y make
38-
make install-deps
34+
- name: Cache Rust dependencies
35+
uses: Swatinem/rust-cache@v2
36+
37+
- name: Install System Dependencies
38+
run: sudo apt-get update && sudo apt-get install -y make
39+
40+
- name: Install Tarpaulin for Coverage
41+
run: cargo install cargo-tarpaulin cargo-fmt
3942

4043
- name: Run Tests and Generate Coverage Report
4144
run: make coverage

src/core/mst.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,7 @@ pub struct MstEdge<W> {
106106
/// A `Result` containing a tuple with:
107107
/// - A vector of MST edges (`MstEdge<W>`).
108108
/// - The total weight of the MST.
109+
///
109110
/// Returns an `Err(GraphinaException)` if the input graph is empty.
110111
///
111112
/// # Example
@@ -205,6 +206,7 @@ where
205206
/// A `Result` containing a tuple with:
206207
/// - A vector of MST edges (`MstEdge<W>`).
207208
/// - The total weight of the MST.
209+
///
208210
/// Returns an `Err(GraphinaException)` if the input graph is empty.
209211
///
210212
/// # Example
@@ -276,6 +278,7 @@ where
276278
/// A `Result` containing a tuple with:
277279
/// - A vector of MST edges (`MstEdge<W>`).
278280
/// - The total weight of the MST.
281+
///
279282
/// Returns an `Err(GraphinaException)` if the input graph is empty.
280283
///
281284
/// # Example

src/core/paths.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@ where
6464
/// A `Result` containing a vector of length equal to the number of nodes, where each element is:
6565
/// - `Some(cost)` if the node is reachable from the source, or
6666
/// - `None` if it is unreachable.
67+
///
6768
/// Returns an `Err(GraphinaException)` if a negative edge weight is found.
6869
///
6970
/// # Complexity

src/core/traversal.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -279,10 +279,10 @@ where
279279

280280
if depth > 0 {
281281
for neighbor in graph.neighbors(current) {
282-
if !visited.contains(&neighbor) {
283-
if dls(graph, neighbor, target, depth - 1, visited, path) {
284-
return true;
285-
}
282+
if !visited.contains(&neighbor)
283+
&& dls(graph, neighbor, target, depth - 1, visited, path)
284+
{
285+
return true;
286286
}
287287
}
288288
}

0 commit comments

Comments
 (0)