-
-
Notifications
You must be signed in to change notification settings - Fork 28
175 lines (165 loc) · 4.86 KB
/
ci.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
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
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
on: [push, pull_request]
name: CI
env:
CARGO_HOME: ${{ github.workspace }}/.cargo
CARGO_TERM_COLOR: always
RUSTFLAGS: -D warnings -A unused-imports
RUSTDOCFLAGS: -D warnings
RUST_BACKTRACE: full
jobs:
# Check formatting.
rustfmt:
name: Rustfmt
if: github.event_name == 'push' || github.event.pull_request.head.repo.full_name != github.repository
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- run: cargo fmt --all -- --check
# Build documentation.
rustdoc:
name: Rustdoc
if: github.event_name == 'push' || github.event.pull_request.head.repo.full_name != github.repository
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/cache@v3.3.2
with:
path: |
${{ env.CARGO_HOME }}
target
key: rustdoc-${{ runner.os }}
- run: cargo rustdoc --all-features -- --document-private-items
# Run linter.
clippy:
name: Clippy
if: github.event_name == 'push' || github.event.pull_request.head.repo.full_name != github.repository
runs-on: ${{ matrix.os }}
strategy:
matrix:
os:
- ubuntu-latest
- macos-latest
- windows-latest
steps:
- uses: actions/checkout@v4
- uses: actions/cache@v3.3.2
with:
path: |
${{ env.CARGO_HOME }}
target
key: clippy-${{ runner.os }}
- run: cargo clippy --all --all-targets --all-features
# Run tests in `src/` and `tests/`.
unit-test:
name: Unit Test
if: github.event_name == 'push' || github.event.pull_request.head.repo.full_name != github.repository
runs-on: ${{ matrix.os }}
strategy:
matrix:
os:
- ubuntu-latest
- macos-latest
- windows-latest
rust:
- stable
- nightly
steps:
- uses: actions/checkout@v4
- uses: actions/cache@v3.3.2
with:
path: |
${{ env.CARGO_HOME }}
target
key: unit-test-${{ runner.os }}-${{ matrix.rust }}
- run: rustup default ${{ matrix.rust }}
- run: cargo test -p divan -p divan-macros
# Run tests in `src/` and `tests/` using Miri.
unit-test-miri:
name: Unit Test (Miri)
if: github.event_name == 'push' || github.event.pull_request.head.repo.full_name != github.repository
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/cache@v3.3.2
with:
path: |
${{ env.CARGO_HOME }}
target
key: miri-${{ runner.os }}
- run: rustup default nightly
- run: rustup component add miri
- run: cargo miri test -p divan -p divan-macros
# Run `examples/` directory as tests.
examples-test:
name: Examples Test
if: github.event_name == 'push' || github.event.pull_request.head.repo.full_name != github.repository
runs-on: ${{ matrix.os }}
strategy:
matrix:
os:
- ubuntu-latest
- macos-latest
- windows-latest
rust:
- stable
- nightly
env:
DIVAN_ITEMS_COUNT: 0
DIVAN_BYTES_COUNT: 1
DIVAN_CHARS_COUNT: 2
steps:
- uses: actions/checkout@v4
- uses: actions/cache@v3.3.2
with:
path: |
${{ env.CARGO_HOME }}
target
key: examples-test-${{ runner.os }}-${{ matrix.rust }}
- run: rustup default ${{ matrix.rust }}
- run: cargo test -p examples --all-features --benches
# Run `examples/` directory as benchmarks.
examples-bench:
name: Examples Bench
if: github.event_name == 'push' || github.event.pull_request.head.repo.full_name != github.repository
runs-on: ${{ matrix.os }}
env:
# Run each benchmark within 2 seconds.
DIVAN_MAX_TIME: 2
strategy:
matrix:
os:
- ubuntu-latest
- macos-latest
- windows-latest
steps:
- uses: actions/checkout@v4
- uses: actions/cache@v3.3.2
with:
path: |
${{ env.CARGO_HOME }}
target
key: examples-bench-${{ runner.os }}
- run: cargo bench -p examples --all-features
# Run `internal_benches/` directory as benchmarks.
internals-bench:
name: Internals Bench
if: github.event_name == 'push' || github.event.pull_request.head.repo.full_name != github.repository
runs-on: ${{ matrix.os }}
env:
# Run each benchmark within 2 seconds.
DIVAN_MAX_TIME: 2
strategy:
matrix:
os:
- ubuntu-latest
- macos-latest
- windows-latest
steps:
- uses: actions/checkout@v4
- uses: actions/cache@v3.3.2
with:
path: |
${{ env.CARGO_HOME }}
target
key: internals-bench-${{ runner.os }}
- run: cargo bench -p internal_benches --all-features