Skip to content

Commit

Permalink
Validate minver (#128)
Browse files Browse the repository at this point in the history
  • Loading branch information
mitsuhiko committed Jul 27, 2022
1 parent b3ecb7d commit cdd342d
Show file tree
Hide file tree
Showing 6 changed files with 111 additions and 57 deletions.
63 changes: 11 additions & 52 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,10 @@ jobs:
- name: Checkout
uses: actions/checkout@v2
- name: Build
uses: actions-rs/cargo@v1
with:
command: check
args: --target ${{ matrix.target }}
env:
CARGO_BUILD_TARGET: ${{ matrix.target }}
run: make check

test:
name: Tests
strategy:
Expand Down Expand Up @@ -76,16 +76,10 @@ jobs:
run: |
sudo apt-get update
sudo apt-get install gcc-multilib
- name: Test no features
uses: actions-rs/cargo@v1
with:
command: test
args: --target ${{ matrix.target }} --no-default-features
- name: Test
uses: actions-rs/cargo@v1
with:
command: test
args: --target ${{ matrix.target }}
env:
CARGO_BUILD_TARGET: ${{ matrix.target }}
run: make test
wasm:
name: Wasm
strategy:
Expand All @@ -104,10 +98,9 @@ jobs:
- name: Checkout
uses: actions/checkout@v2
- name: Check
uses: actions-rs/cargo@v1
with:
command: check
args: --target ${{ matrix.target }}
env:
CARGO_BUILD_TARGET: ${{ matrix.target }}
run: make check
nightly:
name: Nightly Tests
runs-on: ubuntu-latest
Expand All @@ -119,39 +112,5 @@ jobs:
override: true
- name: Checkout
uses: actions/checkout@v2
- name: Test no features
uses: actions-rs/cargo@v1
with:
command: test
args: --no-default-features
- name: Test
uses: actions-rs/cargo@v1
with:
command: test
lint:
name: Linting (fmt + clippy)
strategy:
fail-fast: false
matrix:
os: [windows-latest, ubuntu-latest]
runs-on: ${{ matrix.os }}
steps:
- name: Install rust
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
override: true
components: rustfmt, clippy
- name: Checkout
uses: actions/checkout@v2
- name: Clippy
uses: actions-rs/cargo@v1
with:
command: clippy
args: -- -D warnings
- name: Format check
uses: actions-rs/cargo@v1
with:
command: fmt
args: -- --check
run: make test
18 changes: 18 additions & 0 deletions .github/workflows/clippy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
name: Clippy

on: [push]

jobs:
build:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v1
- uses: actions-rs/toolchain@v1
with:
toolchain: stable
profile: minimal
components: clippy, rustfmt
override: true
- name: Run clippy
run: make lint
21 changes: 21 additions & 0 deletions .github/workflows/minver.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
name: Check minimal version resolution

on: [push]

jobs:
check-minver:
name: Test with minimal version resolution
runs-on: ubuntu-latest
continue-on-error: true

steps:
- uses: actions/checkout@v1
- uses: actions-rs/toolchain@v1
with:
toolchain: nightly
profile: minimal
override: true
- uses: taiki-e/install-action@cargo-hack
- uses: taiki-e/install-action@cargo-minimal-versions
- name: Test
run: make check-minver
18 changes: 18 additions & 0 deletions .github/workflows/rustfmt.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
name: Rustfmt

on: [push]

jobs:
build:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v1
- uses: actions-rs/toolchain@v1
with:
toolchain: stable
profile: minimal
components: clippy, rustfmt
override: true
- name: Run rustfmt
run: make format-check
12 changes: 7 additions & 5 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ ansi-parsing = []

[dependencies]
once_cell = "1"
libc = "0.2"
libc = "0.2.30"
terminal_size = "0.1.14"
regex = { version = "1.4.2", optional = true, default-features = false, features = ["std"] }
unicode-width = { version = "0.1", optional = true }
Expand All @@ -29,10 +29,12 @@ winapi-util = { version = "0.1.3", optional = true }
encode_unicode = "0.3"

[dev-dependencies]
criterion = "0.3.5"
proptest = "1.0.0"
regex = "1.4.2"

[[bench]]
name = "ansi_parser"
harness = false
## These are currently disabled. If you want to play around with the benchmarks
## uncommit this.
#criterion = "0.3.5"
#[[bench]]
#name = "ansi_parser"
#harness = false
36 changes: 36 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
all: test

check:
@cargo check --all-features

build:
@cargo build --all-features

doc:
@cargo doc --all-features

test:
@echo "CARGO TESTS"
@cargo test
@cargo test --all-features
@cargo test --no-default-features

check-minver:
@echo "MINVER CHECK"
@cargo minimal-versions check
@cargo minimal-versions check --all-features
@cargo minimal-versions check --no-default-features

format:
@rustup component add rustfmt 2> /dev/null
@cargo fmt --all

format-check:
@rustup component add rustfmt 2> /dev/null
@cargo fmt --all -- --check

lint:
@rustup component add clippy 2> /dev/null
@cargo clippy

.PHONY: all doc build check test format format-check lint check-minver

0 comments on commit cdd342d

Please sign in to comment.