diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 2dc5036..7d70c3b 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,29 +1,65 @@ name: CI -on: [push, pull_request] +on: + push: + branches: [master, main] + pull_request: + +env: + CARGO_TERM_COLOR: always jobs: test: - name: Cargo Test - runs-on: ubuntu-latest + name: Test (${{ matrix.os }}) + strategy: + fail-fast: false + matrix: + os: [ubuntu-latest, windows-latest, macos-latest] + runs-on: ${{ matrix.os }} steps: - name: Checkout repository uses: actions/checkout@v4 with: ref: ${{ github.event.pull_request.head.sha }} - - uses: taiki-e/install-action@v2 + - name: Install Rust toolchain + uses: dtolnay/rust-toolchain@stable + with: + components: rustfmt, clippy + + - name: Install tools + uses: taiki-e/install-action@v2 with: tool: just,cargo-nextest + - name: Cache Dependencies + uses: Swatinem/rust-cache@v2 + + - name: Run CI checks + run: just ci + + features: + name: Feature Combinations + runs-on: ubuntu-latest + steps: + - name: Checkout repository + uses: actions/checkout@v4 + with: + ref: ${{ github.event.pull_request.head.sha }} + - name: Install Rust toolchain - run: | - rustup update --no-self-update stable - rustup component add --toolchain stable rustfmt rust-src - rustup default stable + uses: dtolnay/rust-toolchain@stable + + - name: Install tools + uses: taiki-e/install-action@v2 + with: + tool: just,cargo-nextest - name: Cache Dependencies - uses: Swatinem/rust-cache@640a22190e7a783d4c409684cea558f081f92012 + uses: Swatinem/rust-cache@v2 - - name: Test - run: just ci + - name: Test feature combinations + run: just features + + - name: Test with all features + run: just test-all-features diff --git a/Justfile b/Justfile index 5366cae..2c5bc84 100644 --- a/Justfile +++ b/Justfile @@ -1,14 +1,42 @@ +# Cross-platform CI tasks ci: just test just nostd just clippy cargo fmt --check --all +# Run tests using cargo-nextest +test *args: + cargo nextest run {{args}} + +# Check no_std compatibility nostd: cargo check --no-default-features -p pk2 +# Run clippy lints clippy: cargo clippy --workspace --all-targets --all-features -- -D warnings -test *args: - cargo nextest run {{args}} < /dev/null +# Feature matrix testing +features: + @echo "Testing no default features..." + cargo check --no-default-features -p pk2 + @echo "Testing std feature only..." + cargo check --no-default-features --features std -p pk2 + @echo "Testing euc-kr feature only..." + cargo check --no-default-features --features euc-kr -p pk2 + @echo "Testing all features..." + cargo check --all-features --workspace + @echo "All feature combinations passed!" + +# Run tests with all features +test-all-features: + cargo nextest run --workspace --all-features + +# Build documentation +docs: + cargo doc --workspace --no-deps --document-private-items + +# Clean build artifacts +clean: + cargo clean