diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 00000000..cca26cba --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,40 @@ +name: CI + +on: + push: + branches: [main] + pull_request: + +# Cancel in-flight runs for the same ref when new commits land. +concurrency: + group: ci-${{ github.ref }} + cancel-in-progress: true + +env: + CARGO_TERM_COLOR: always + +jobs: + check: + name: fmt, clippy, test + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + + - name: Install Rust toolchain + uses: dtolnay/rust-toolchain@stable + with: + components: rustfmt, clippy + + - uses: Swatinem/rust-cache@v2 + + - name: Format + run: cargo fmt --all --check + + - name: Clippy + run: cargo clippy --all-targets -- -D warnings + + - name: Build + run: cargo build --locked + + - name: Test + run: cargo test --locked diff --git a/src/commands/chart.rs b/src/commands/chart.rs index bd41169a..cb8d9839 100644 --- a/src/commands/chart.rs +++ b/src/commands/chart.rs @@ -250,7 +250,7 @@ mod tests { assert_eq!(fmt(99999.0), "1.000e+5"); assert_eq!(fmt(0.0001234), "1.234e-4"); // ordinary values - assert_eq!(fmt(3.14159), "3.142"); + assert_eq!(fmt(3.21459), "3.215"); assert_eq!(fmt(-42.0), "-42.00"); } }