• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1name: CI
2on: [push, pull_request]
3env:
4  CARGO_TERM_COLOR: always
5  RUST_BACKTRACE: 1
6
7jobs:
8  unit-test:
9    name: unit tests
10    strategy:
11      matrix:
12        os: [ubuntu-latest, macos-latest, windows-latest]
13      fail-fast: false
14    runs-on: ${{ matrix.os }}
15    steps:
16      - uses: actions/checkout@v3
17      - uses: dtolnay/rust-toolchain@stable
18      - name: Run tests
19        run: cargo test --color always --all
20  linter:
21    name: clippy and rustfmt
22    runs-on: ubuntu-latest
23    steps:
24      - uses: actions/checkout@v3
25      - uses: dtolnay/rust-toolchain@stable
26        with:
27          components: rustfmt, clippy
28      - run: cargo fmt --all -- --color always --check
29      - run: cargo clippy --color always --all -- -D warnings
30  examples:
31    name: examples
32    runs-on: ubuntu-latest
33    steps:
34      - uses: actions/checkout@v3
35      - uses: dtolnay/rust-toolchain@stable
36      - name: Run parse example
37        run: |
38          ret="$(echo '{"hello": "world"}' | cargo run --example parse)"
39          if [[ "$ret" != 'Parsed: Object({"hello": String("world")})' ]]; then
40            echo "Error: '$ret'" 2>&1
41            exit 1
42          fi
43      - name: Run minify example
44        run: |
45          ret="$(echo ' {  "hello" : "world"         }   ' | cargo run --example minify)"
46          if [[ "$ret" != '{"hello":"world"}' ]]; then
47            echo "Error: '$ret'" 2>&1
48            exit 1
49          fi
50      - name: Run json_value example
51        run: cargo run --example json_value
52