Skip to content

Commit

Permalink
Merge #356
Browse files Browse the repository at this point in the history
356: Move integration tests to a separate workspace crate to avoid MSRV is… r=Ogeon a=Ogeon

Due to [an MSRV bump in `memchr`](BurntSushi/memchr@e1f72c6), I decided to move the integration tests to their own workspace crate.

Co-authored-by: Erik Hedvall <[email protected]>
  • Loading branch information
bors[bot] and Ogeon authored Sep 9, 2023
2 parents 8a2fbfa + ffcab42 commit bae6ab5
Show file tree
Hide file tree
Showing 40 changed files with 61 additions and 26 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/benchmark.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,10 @@ jobs:
cache-target: release
bins: cargo-codspeed
- name: Build the benchmark target(s)
run: cargo codspeed build -p benchmarks
run: cargo codspeed build -p benchmarks --features all_features
- name: Run the benchmarks
uses: CodSpeedHQ/action@v1
with:
run: cargo codspeed run
working-directory: palette # mimics how tests work, so the colors CSV can be found
working-directory: integration_tests # mimics how tests work, so the colors CSV can be found
token: ${{ secrets.CODSPEED_TOKEN }}
14 changes: 14 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,19 @@ jobs:
shell: bash
working-directory: palette
run: bash ../scripts/test_features.sh
integration_tests:
name: integration tests
strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
runs-on: ${{ matrix.os }}
env:
RUSTFLAGS: -D warnings
steps:
- uses: actions/checkout@v3
- uses: dtolnay/rust-toolchain@stable
- name: Run integration tests
run: cargo test -v -p integration_tests --all-features
check_stable_beta_nightly:
name: Quick check
strategy:
Expand Down Expand Up @@ -86,6 +99,7 @@ jobs:
if: success()
needs:
- compile_and_test_msrv
- integration_tests
- check_stable_beta_nightly
- no_std
- miri
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/coverage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ jobs:
- uses: dtolnay/rust-toolchain@nightly
- uses: taiki-e/install-action@cargo-llvm-cov
- name: Collect code coverage
run: cargo +nightly llvm-cov --all-features -p palette --codecov --doctests --output-path codecov.json
run: cargo +nightly llvm-cov --all-features -p integration_tests -p palette --codecov --doctests --output-path codecov.json
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v3
with:
Expand Down
1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ members = [
"palette_derive",

# Test crates
"integration_tests",
"no_std_test",
"benchmarks"
]
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ A color management and conversion library that focuses on maintaining correctnes

## Minimum Supported Rust Version (MSRV)

This version of Palette has been automatically tested with Rust version `1.60.0` and the `stable`, `beta`, and `nightly` channels. Future versions of the library may advance the minimum supported version to make use of new language features, but this will normally be considered a breaking change. Exceptions may be made for security patches and similar changes.
This version of Palette has been automatically tested with Rust version `1.60.0` and the `stable`, `beta`, and `nightly` channels. Future versions of the library may advance the minimum supported version to make use of new language features, but this will normally be considered a breaking change. Exceptions may be made for security patches, dependencies advancing their MSRV in minor or patch releases, and similar changes.

## Contributing

Expand Down
6 changes: 5 additions & 1 deletion benchmarks/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,17 @@ path = "benches/matrix.rs"
name = "matrix"
harness = false

[features]
# Avoids getting these features included in other packages in the same workspace.
all_features = ["palette/default", "palette/wide"]

[dev-dependencies]
approx = { version = "0.5", default-features = false }
codspeed-criterion-compat = "2.1.0"
criterion = { version = "0.5.1", default-features = false }
csv = "1"
lazy_static = "1"
palette = { path = "../palette", features = ["wide"] }
palette = { path = "../palette", default-features = false }
serde = "1"
serde_derive = "1"
wide = "0.7.3"
2 changes: 1 addition & 1 deletion benchmarks/benches/cie.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ use codspeed_criterion_compat::{black_box, criterion_group, criterion_main, Crit
use palette::convert::FromColorUnclamped;
use palette::{Lab, Lch, Xyz, Yxy};

#[path = "../../palette/tests/convert/data_color_mine.rs"]
#[path = "../../integration_tests/tests/convert/data_color_mine.rs"]
#[allow(dead_code)]
mod data_color_mine;
use data_color_mine::{load_data, ColorMine};
Expand Down
2 changes: 1 addition & 1 deletion benchmarks/benches/rgb.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ type LinHsv = Hsv<encoding::Linear<encoding::Srgb>>;
type LinHsl = Hsl<encoding::Linear<encoding::Srgb>>;
type LinHwb = Hwb<encoding::Linear<encoding::Srgb>>;

#[path = "../../palette/tests/convert/data_color_mine.rs"]
#[path = "../../integration_tests/tests/convert/data_color_mine.rs"]
#[allow(dead_code)]
mod data_color_mine;
use data_color_mine::{load_data, ColorMine};
Expand Down
31 changes: 31 additions & 0 deletions integration_tests/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
[package]
name = "integration_tests"
version = "0.0.0"
authors = ["Erik Hedvall <[email protected]>"]
exclude = []
description = "Integration test crate for palette."
repository = "https://github.com/Ogeon/palette"
license = "MIT OR Apache-2.0"
edition = "2018"

[[example]]
name = "issue_283"
path = "regression_tests/issue_283.rs"

[features]
# Avoids getting these features included in other packages in the same workspace.
all_features = ["palette/default", "palette/wide"]

[dev-dependencies]
approx = { version = "0.5", default-features = false }
csv = "1"
lazy_static = "1"
palette = { path = "../palette" }
scad = "1.2.2" # For regression testing #283
serde = "1"
serde_derive = "1"
serde_json = "1"

[dev-dependencies.wide]
version = "0.7.3"
default-features = false
1 change: 1 addition & 0 deletions integration_tests/LICENSE-APACHE
1 change: 1 addition & 0 deletions integration_tests/LICENSE-MIT
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,6 @@ pub fn run_from_lab_tests() {
}
}

#[cfg(feature = "wide")]
pub mod wide_f64x2 {
use super::*;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,6 @@ pub fn run_from_lab_tests() {
}
}

#[cfg(feature = "wide")]
pub mod wide_f64x2 {
use super::*;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ pub fn color_checker_from_lab() {
color_checker::run_from_lab_tests();
}

#[cfg(feature = "wide")]
pub mod wide {
#[test]
pub fn babel_from_yxy() {
Expand Down
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,6 @@ pub fn run_tests() {
}
}

#[cfg(feature = "wide")]
pub mod wide_f32x4 {
use super::*;

Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -416,7 +416,6 @@ pub fn run_from_lch_tests() {
}
}

#[cfg(feature = "wide")]
pub mod wide_f64x2 {
use super::*;

Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@ pub fn color_mine_from_hwb() {
data_color_mine::run_from_hwb_tests();
}

#[cfg(feature = "wide")]
pub mod wide {
#[test]
pub fn xyz_yxy_conversion() {
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ pub fn from_lch() {
pointer_data::run_from_lch_tests();
}

#[cfg(feature = "wide")]
mod wide {
#[test]
pub fn from_lab() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,6 @@ pub fn run_from_lab_tests() {
}
}

#[cfg(feature = "wide")]
pub mod wide_f64x2 {
use super::*;

Expand Down
9 changes: 0 additions & 9 deletions palette/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,6 @@ std = ["approx?/std"]
[lib]
bench = false

[[example]]
name = "issue_283"
path = "regression_tests/issue_283.rs"

[dependencies]
palette_derive = { version = "0.7.3", path = "../palette_derive" }
fast-srgb8 = "1.0.0"
Expand Down Expand Up @@ -76,14 +72,9 @@ optional = true
default-features = false

[dev-dependencies]
csv = "1"
lazy_static = "1"
serde = "1"
serde_derive = "1"
serde_json = "1"
ron = "=0.8.0" # Pinned due to MSRV mismatch
enterpolation = "0.2.0"
scad = "1.2.2" # For regression testing #283

[dev-dependencies.clap]
version = "3.2.25"
Expand Down
2 changes: 1 addition & 1 deletion palette/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ A color management and conversion library that focuses on maintaining correctnes

## Minimum Supported Rust Version (MSRV)

This version of Palette has been automatically tested with Rust version `1.60.0` and the `stable`, `beta`, and `nightly` channels. Future versions of the library may advance the minimum supported version to make use of new language features, but this will normally be considered a breaking change. Exceptions may be made for security patches and similar changes.
This version of Palette has been automatically tested with Rust version `1.60.0` and the `stable`, `beta`, and `nightly` channels. Future versions of the library may advance the minimum supported version to make use of new language features, but this will normally be considered a breaking change. Exceptions may be made for security patches, dependencies advancing their MSRV in minor or patch releases, and similar changes.

## Getting Started

Expand Down
2 changes: 1 addition & 1 deletion palette_derive/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Contains derive macros for the [`palette`](https://crates.io/crates/palette/) cr

## Minimum Supported Rust Version (MSRV)

This version of Palette has been automatically tested with Rust version `1.60.0` and the `stable`, `beta`, and `nightly` channels. Future versions of the library may advance the minimum supported version to make use of new language features, but this will normally be considered a breaking change. Exceptions may be made for security patches and similar changes.
This version of Palette has been automatically tested with Rust version `1.60.0` and the `stable`, `beta`, and `nightly` channels. Future versions of the library may advance the minimum supported version to make use of new language features, but this will normally be considered a breaking change. Exceptions may be made for security patches, dependencies advancing their MSRV in minor or patch releases, and similar changes.

## License

Expand Down

0 comments on commit bae6ab5

Please sign in to comment.