name: Tests
on:
push:
branches: [ main, master ]
pull_request:
branches: [ main, master ]
env:
CARGO_TERM_COLOR: always
jobs:
test:
name: Test Suite
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable
with:
components: rustfmt, clippy
- name: Cache cargo dependencies
uses: actions/cache@v4
with:
path: |
~/.cargo/registry
~/.cargo/git
target
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
${{ runner.os }}-cargo-
- name: Check code formatting
run: cargo fmt -- --check
- name: Run Clippy lints
run: cargo clippy --all-targets --all-features -- -D warnings
- name: Build project
run: cargo build --verbose
- name: Run tests
run: cargo test --verbose
- name: Test RFC 4180 compliance features
run: |
cargo build --release
# Test the basic functionality
echo "field1,field2,field3" > test.csv
echo "a,b,c" >> test.csv
echo "d,e,f" >> test.csv
./target/release/csvlint test.csv
# Test RFC 4180 strict mode
./target/release/csvlint --rfc4180 test.csv || echo "Expected RFC 4180 violations detected"
rm test.csv
test-matrix:
name: Test on Multiple Platforms
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
rust: [stable, beta]
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable
with:
toolchain: ${{ matrix.rust }}
- name: Cache cargo dependencies
uses: actions/cache@v4
with:
path: |
~/.cargo/registry
~/.cargo/git
target
key: ${{ runner.os }}-${{ matrix.rust }}-cargo-${{ hashFiles('**/Cargo.lock') }}
- name: Build project
run: cargo build --verbose
- name: Run tests
run: cargo test --verbose