-
Notifications
You must be signed in to change notification settings - Fork 35
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #103 from LingMan/ci
Polish CI
- Loading branch information
Showing
1 changed file
with
17 additions
and
44 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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/[email protected] | ||
|
||
- name: Restore cargo cache | ||
uses: actions/[email protected] | ||
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 | ||
|
||
|