diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 1295bdb..7c9177f 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -7,11 +7,8 @@ on: pull_request: branches: - master - paths: - - "**.rs" - - "Cargo.toml" - - "Cargo.lock" - - ".github/workflows/*" + paths-ignore: + - "README.md" jobs: fmt: @@ -19,68 +16,44 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout sources - uses: actions/checkout@v3.2.0 + uses: actions/checkout@v3 - name: Install Rust toolchain - uses: actions-rs/toolchain@v1 + uses: dtolnay/rust-toolchain@stable with: - profile: minimal - toolchain: nightly - override: true components: rustfmt - name: Check formatting - uses: actions-rs/cargo@v1 - with: - command: fmt - args: -- --check + run: cargo fmt --check build: name: Lint and test check - runs-on: ubuntu-latest strategy: fail-fast: false matrix: - rust: - - 1.56.0 - - stable - - nightly + rust: ["1.56.0", "stable", "nightly"] + os: ["ubuntu-latest", "windows-latest", "macos-latest"] + runs-on: ${{ matrix.os }} steps: - name: Checkout sources - uses: actions/checkout@v3.2.0 - - - name: Restore cargo cache - uses: actions/cache@v3.2.1 - env: - cache-name: ci - with: - path: | - ~/.cargo/registry - ~/.cargo/git - ~/.cargo/bin - target - key: ${{ matrix.os }}-${{ env.cache-name }}-${{ matrix.rust }}-${{ hashFiles('Cargo.lock') }} + uses: actions/checkout@v3 - name: Install Rust toolchain - uses: actions-rs/toolchain@v1 + uses: dtolnay/rust-toolchain@master with: - profile: minimal toolchain: ${{ matrix.rust }} - override: true components: clippy + - name: Restore cargo cache + uses: Swatinem/rust-cache@v2 + - name: Run lints - uses: actions-rs/cargo@v1 - with: - command: clippy - args: -- -D warnings + run: cargo clippy -- -D warnings - name: Run tests - uses: actions-rs/cargo@v1 - with: - command: test - args: --all-features --example all_xterm_colors --example colors --example dyn_colors --example override --example custom_colors --example extra_colors --example supports_color - + run: | + cargo test --all-targets --all-features + cargo test --all-targets --no-default-features - name: Install cargo-hack uses: taiki-e/install-action@cargo-hack