Skip to content

Commit

Permalink
Improve control over what tests run in CI vs locally
Browse files Browse the repository at this point in the history
  • Loading branch information
Notgnoshi committed Dec 25, 2024
1 parent a15a016 commit 8d49cbe
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 11 deletions.
8 changes: 3 additions & 5 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,12 +55,10 @@ jobs:
- name: Setup Rust cache
uses: swatinem/rust-cache@v2
- name: Build
run: cargo build --release --all-targets
run: cargo build --release --all-targets --all-features
- name: Clippy
run: cargo clippy --no-deps --release --all-targets
# The tests depend on the 'herostratus' binary that 'cargo build' built
run: cargo clippy --no-deps --release --all-targets --all-features
- name: Test
run: |
git fetch
cargo test --release --all-targets
cargo test --release --all-targets -- --ignored required
cargo test --release --all-targets --all-features
4 changes: 4 additions & 0 deletions herostratus/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ license.workspace = true
repository.workspace = true
description.workspace = true

[features]
# Set by the CI pipeline using --all-features. Used to conditionally enable/disable tests
ci = []

[dependencies]
clap.workspace = true
color-eyre.workspace = true
Expand Down
12 changes: 6 additions & 6 deletions herostratus/tests/add.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ use herostratus::config::{config_path, read_config, Config, RepositoryConfig};
use herostratus_tests::cmd::{herostratus, CommandExt};

#[test]
#[ignore = "Slow; Performs clone"]
fn required_clone_herostratus() {
#[cfg_attr(not(feature = "ci"), ignore = "Slow; Performs clone")]
fn test_clone_herostratus() {
let (mut cmd, temp) = herostratus(None);
let data_dir = temp.as_ref().unwrap().path();

Expand Down Expand Up @@ -51,8 +51,8 @@ fn required_clone_herostratus() {
}

#[test]
#[ignore = "Slow; Performs clone"]
fn required_clone_herostratus_branch() {
#[cfg_attr(not(feature = "ci"), ignore = "Slow; Performs clone")]
fn test_clone_herostratus_branch() {
let (mut cmd, temp) = herostratus(None);
let clone_dir = temp
.as_ref()
Expand Down Expand Up @@ -197,8 +197,8 @@ fn add_the_same_repo_twice() {
}

#[test]
#[ignore = "Slow; Performs clone;"]
fn required_two_branches_share_one_bare_repo() {
#[cfg_attr(not(feature = "ci"), ignore = "Slow; Performs clone")]
fn test_two_branches_share_one_bare_repo() {
let (mut cmd1, temp) = herostratus(None);
let (mut cmd2, _) = herostratus(Some(temp.as_ref().unwrap().path()));

Expand Down

0 comments on commit 8d49cbe

Please sign in to comment.