-
Notifications
You must be signed in to change notification settings - Fork 0
137 lines (127 loc) · 3.82 KB
/
Copy pathci.yml
File metadata and controls
137 lines (127 loc) · 3.82 KB
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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
name: CI / Rust (PCF Reference)
on:
push:
branches: [master]
pull_request:
branches: [master]
env:
CARGO_TERM_COLOR: always
RUSTFLAGS: "-D warnings"
defaults:
run:
working-directory: reference/PCF-v1.0
jobs:
fmt:
name: rustfmt
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
with:
components: rustfmt
- run: cargo fmt --all -- --check
clippy:
name: clippy
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
with:
components: clippy
- uses: Swatinem/rust-cache@v2
with:
workspaces: reference/PCF-v1.0
- run: cargo clippy --all-targets --all-features -- -D warnings
test:
name: test (${{ matrix.os }})
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
- uses: Swatinem/rust-cache@v2
with:
workspaces: reference/PCF-v1.0
- run: cargo build --verbose
- run: cargo test --all-targets --verbose
- run: cargo test --doc --verbose
test-vector:
name: regenerate spec test vector
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
- uses: Swatinem/rust-cache@v2
with:
workspaces: reference/PCF-v1.0
- name: Build and run the test-vector example
run: cargo run --example gen_testvector -- pcf_testvector.bin
- name: Inspect generated test vector
run: |
ls -l pcf_testvector.bin
test "$(wc -c < pcf_testvector.bin)" = "395"
- uses: actions/upload-artifact@v4
with:
name: pcf-testvector
path: reference/PCF-v1.0/pcf_testvector.bin
coverage:
name: code coverage
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
with:
components: llvm-tools-preview
- uses: Swatinem/rust-cache@v2
with:
workspaces: reference/PCF-v1.0
- name: Install cargo-llvm-cov
uses: taiki-e/install-action@cargo-llvm-cov
- name: Generate coverage report (lcov)
run: cargo llvm-cov --all-features --package pcf --lcov --output-path lcov.info
- name: Print coverage summary
run: cargo llvm-cov report
- name: Enforce minimum line coverage (>=95%)
run: |
cargo llvm-cov report --summary-only \
--fail-under-lines 95 \
--fail-under-functions 100
- uses: actions/upload-artifact@v4
with:
name: coverage-lcov
path: reference/PCF-v1.0/lcov.info
pcf-debug:
name: pcf-debug tool
runs-on: ubuntu-latest
defaults:
run:
working-directory: .
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
with:
components: rustfmt, clippy
- uses: Swatinem/rust-cache@v2
- run: cargo fmt -p pcf-debug -- --check
- run: cargo clippy -p pcf-debug --all-targets -- -D warnings
- run: cargo build -p pcf-debug --verbose
- run: cargo test -p pcf-debug --verbose
pcf-compact:
name: pcf-compact tool
runs-on: ubuntu-latest
defaults:
run:
working-directory: .
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
with:
components: rustfmt, clippy
- uses: Swatinem/rust-cache@v2
- run: cargo fmt -p pcf-compact -- --check
- run: cargo clippy -p pcf-compact --all-targets -- -D warnings
- run: cargo build -p pcf-compact --verbose
- run: cargo test -p pcf-compact --verbose