-
Notifications
You must be signed in to change notification settings - Fork 33
58 lines (54 loc) · 1.73 KB
/
test.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
name: test
on:
push:
branches:
- master
pull_request:
permissions:
contents: read
jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions-rust-lang/setup-rust-toolchain@v1
with:
toolchain: stable
- name: format check
run: cargo fmt --check --all
- name: clippy check
run: cargo clippy --workspace
test:
name: ${{ matrix.os }} / Rust ${{ matrix.rust }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest]
rust: [stable]
include:
- os: ubuntu-latest
rust: 1.65.0 # MSRV
- os: ubuntu-latest
rust: beta
steps:
- uses: actions/checkout@v4
- uses: actions-rust-lang/setup-rust-toolchain@v1
with:
toolchain: ${{ matrix.rust }}
- run: cd hjson && cargo build --release
- if: matrix.rust != '1.65.0'
run: |
cd hjson_cli &&
cargo build --release &&
diff ../hjson_tests/assets/trail_result.hjson <(../target/release/hjson ../hjson_tests/assets/trail_result.json) &&
diff ../hjson_tests/assets/trail_result.json <(../target/release/hjson -j ../hjson_tests/assets/trail_test.hjson) &&
diff ../hjson_tests/assets/simplenumber_result.json <(../target/release/hjson -c ../hjson_tests/assets/simplenumber_test.hjson)
- run: |
if [ '${{ matrix.rust }}' == '1.65.0' ]; then
# because of 'clap_derive' it needs Rust 1.74+
cargo test --workspace --exclude hjson -- --nocapture
else
cargo test --workspace -- --nocapture
fi
- run: cd hjson && cargo doc