blob: e6711f303559f4b53f4b491ea46f19dc9a9b32a3 [file] [log] [blame]
name: CI
on: [push, pull_request]
env:
CARGO_TERM_COLOR: always
RUST_BACKTRACE: 1
jobs:
unit-test:
name: unit tests
strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
fail-fast: false
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v3
- uses: dtolnay/rust-toolchain@stable
- name: Run tests
run: cargo test --color always --all
linter:
name: clippy and rustfmt
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: dtolnay/rust-toolchain@stable
with:
components: rustfmt, clippy
- run: cargo fmt --all -- --color always --check
- run: cargo clippy --color always --all -- -D warnings
examples:
name: examples
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: dtolnay/rust-toolchain@stable
- name: Run parse example
run: |
ret="$(echo '{"hello": "world"}' | cargo run --example parse)"
if [[ "$ret" != 'Parsed: Object({"hello": String("world")})' ]]; then
echo "Error: '$ret'" 2>&1
exit 1
fi
- name: Run minify example
run: |
ret="$(echo ' { "hello" : "world" } ' | cargo run --example minify)"
if [[ "$ret" != '{"hello":"world"}' ]]; then
echo "Error: '$ret'" 2>&1
exit 1
fi
- name: Run json_value example
run: cargo run --example json_value