Skip to content

Commit

Permalink
improve tests
Browse files Browse the repository at this point in the history
  • Loading branch information
mazznoer committed Aug 19, 2024
1 parent 96e4590 commit 660b1ee
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 17 deletions.
39 changes: 23 additions & 16 deletions .github/workflows/rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,28 +19,35 @@ jobs:
runs-on: ${{ matrix.os }}

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- name: Build
run: cargo build --verbose --all-features
run: |
cargo build --verbose --no-default-features
cargo build --verbose --all-features
- name: Run tests
run: cargo test --verbose --all-features

- name: Run cargo fmt
run: cargo fmt --all -- --check
run: |
cargo test --verbose --no-default-features
cargo test --verbose --all-features
- name: Run cargo clippy
run: cargo clippy --all-features -- -D warnings

- name: Tarpaulin code coverage
id: coverage
if: matrix.os == 'ubuntu-latest'
run: |
cargo install cargo-tarpaulin
cargo tarpaulin -o xml
cargo clippy --no-default-features -- -D warnings
cargo clippy --all-features -- -D warnings
- name: Upload to codecov.io
if: matrix.os == 'ubuntu-latest'
uses: codecov/codecov-action@v3
- name: Run cargo fmt
run: |
cargo fmt --all -- --check
#- name: Tarpaulin code coverage
# id: coverage
# if: matrix.os == 'ubuntu-latest'
# run: >
# cargo install cargo-tarpaulin &&
# cargo tarpaulin -o xml

#- name: Upload to codecov.io
# if: matrix.os == 'ubuntu-latest'
# uses: codecov/codecov-action@v3

4 changes: 4 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,10 @@ default = ["named-colors"]
named-colors = ["phf"]
rust-rgb = ["rgb"]

[[test]]
name = "named_colors"
required-features = ["named-colors"]

[dependencies]
cint = { version = "^0.3.1", optional = true }
lab = { version = "0.11.0", optional = true }
Expand Down
3 changes: 3 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,12 @@ SHELL := /bin/bash
all: check test

check:
cargo build --no-default-features && \
cargo clippy --no-default-features -- -D warnings && \
cargo build --all-features && \
cargo clippy --all-features -- -D warnings && \
cargo fmt --all -- --check

test:
cargo test --no-default-features && \
cargo test --all-features
1 change: 0 additions & 1 deletion tests/named_colors.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
use csscolorparser::Color;

#[cfg(feature = "named-colors")]
#[test]
fn named_colors() {
let skip_list = ["aqua", "cyan", "fuchsia", "magenta"];
Expand Down

0 comments on commit 660b1ee

Please sign in to comment.