forked from tafia/quick-xml
71 lines (65 loc) · 2.17 KB
/
rust.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
59
60
61
62
63
64
65
66
67
68
69
70
name: Rust
on: [push, pull_request]
jobs:
build:
strategy:
matrix:
platform: [ubuntu-latest, windows-latest]
runs-on: ${{ matrix.platform }}
# Set variable to enable coverage
env:
RUSTFLAGS: -C instrument-coverage
steps:
- name: Install coverage reporter (llvm-tools-preview)
if: runner.os == 'Linux'
run: rustup component add llvm-tools-preview
- name: Install coverage reporter (grcov)
if: runner.os == 'Linux'
run: cargo install grcov
- uses: actions/checkout@v1
- name: Build
run: cargo build
- name: Run tests (no features)
env:
LLVM_PROFILE_FILE: coverage/no-features-%p-%m.profraw
run: cargo test --no-default-features
- name: Run tests (serialize)
env:
LLVM_PROFILE_FILE: coverage/serialize-%p-%m.profraw
run: cargo test --features serialize
- name: Run tests (serialize+encoding)
env:
LLVM_PROFILE_FILE: coverage/serialize-encoding-%p-%m.profraw
run: cargo test --features serialize,encoding
- name: Run tests (serialize+escape-html)
env:
LLVM_PROFILE_FILE: coverage/serialize-escape-html-%p-%m.profraw
run: cargo test --features serialize,escape-html
- name: Run tests (all features)
env:
LLVM_PROFILE_FILE: coverage/all-features-%p-%m.profraw
run: cargo test --all-features
- name: Prepare coverage information for upload
if: runner.os == 'Linux'
# --token is required by grcov, but not required by coveralls.io, so pass
# something to get it work. See https://github.com/mozilla/grcov/issues/833
run: |
grcov ./coverage \
-s . \
--binary-path ./target/debug/ \
--branch \
--ignore-not-existing \
--ignore 'tests/*' \
-t coveralls+ \
--token ? \
-o ./coveralls.json
- name: Upload coverage to codecov.io
if: runner.os == 'Linux'
uses: codecov/codecov-action@v2
with:
files: ./coveralls.json
flags: unittests
verbose: true
continue-on-error: true
- name: Check fmt
run: cargo fmt -- --check