Skip to content

Commit

Permalink
Merge pull request #103 from LingMan/ci
Browse files Browse the repository at this point in the history
Polish CI
  • Loading branch information
jam1garner committed Oct 12, 2023
2 parents e7046b4 + 0f01a19 commit 457f546
Showing 1 changed file with 17 additions and 44 deletions.
61 changes: 17 additions & 44 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,80 +7,53 @@ on:
pull_request:
branches:
- master
paths:
- "**.rs"
- "Cargo.toml"
- "Cargo.lock"
- ".github/workflows/*"
paths-ignore:
- "README.md"

jobs:
fmt:
name: Source formatting check
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

Expand Down

0 comments on commit 457f546

Please sign in to comment.