-
Notifications
You must be signed in to change notification settings - Fork 1
149 lines (120 loc) · 4 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
name: CI
on:
push:
branches: [main]
tags: ['v*']
pull_request:
branches: [main]
env:
RUST_BACKTRACE: 1
jobs:
fmt:
name: Format
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0
- name: Stable toolchain with rustfmt
uses: dtolnay/rust-toolchain@stable
with:
components: rustfmt
- uses: swatinem/rust-cache@23bce251a8cd2ffc3c1075eaa2367cf899916d84 # v2.7.3
- name: Check coding style
run: cargo fmt --check --all
clippy:
name: Clippy
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0
- name: Stable toolchain with clippy
uses: dtolnay/rust-toolchain@stable
with:
components: clippy
- uses: swatinem/rust-cache@23bce251a8cd2ffc3c1075eaa2367cf899916d84 # v2.7.3
- name: Lint
run: cargo clippy --all-targets --all-features -- -D warnings
docs:
name: Docs
runs-on: ubuntu-latest
timeout-minutes: 30
env:
RUSTDOCFLAGS: "-Dwarnings"
steps:
- uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0
- uses: dtolnay/rust-toolchain@stable
- uses: swatinem/rust-cache@23bce251a8cd2ffc3c1075eaa2367cf899916d84 # v2.7.3
- run: cargo doc --no-deps
tests:
name: Tests
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0
- uses: dtolnay/rust-toolchain@stable
- uses: swatinem/rust-cache@23bce251a8cd2ffc3c1075eaa2367cf899916d84 # v2.7.3
- uses: taiki-e/install-action@9bef7e9c3d7c7aa986ef19933b0722880ae377e0 # v2.44.13
with:
tool: cargo-nextest
- name: Test
run: cargo nextest run --all-features
coverage:
name: Coverage
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0
- uses: dtolnay/rust-toolchain@nightly
- uses: swatinem/rust-cache@23bce251a8cd2ffc3c1075eaa2367cf899916d84 # v2.7.3
- uses: taiki-e/install-action@9bef7e9c3d7c7aa986ef19933b0722880ae377e0 # v2.44.13
with:
tool: cargo-nextest,cargo-llvm-cov
- name: Tests
run: cargo llvm-cov nextest --lcov --output-path lcov.info --all-features
- name: Upload coverage reports to Codecov
uses: codecov/codecov-action@e28ff129e5465c2c0dcc6f003fc735cb6ae0c673 # v4.5.0
with:
files: lcov.info
flags: rust
fail_ci_if_error: true
token: ${{ secrets.CODECOV_TOKEN }}
build:
name: Build
strategy:
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
runs-on: ${{ matrix.os }}
timeout-minutes: 30
steps:
- uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0
- uses: dtolnay/rust-toolchain@stable
- uses: swatinem/rust-cache@23bce251a8cd2ffc3c1075eaa2367cf899916d84 # v2.7.3
# msys2 required by rug on windows
- name: Setup msys2 (windows)
uses: msys2/setup-msys2@ddf331adaebd714795f1042345e6ca57bd66cea8 # v2.24.1
if: matrix.os == 'windows-latest'
with:
install: base-devel pacman-mirrors diffutils m4 make openssl openssl-devel
pacboy: gcc:p rust:p
# Only for windows
- name: Msys2 build (windows)
if: matrix.os == 'windows-latest'
shell: msys2 {0}
run: |
cargo build
- name: Build
if: matrix.os != 'windows-latest'
run: cargo build
publish:
name: Publish
runs-on: ubuntu-latest
timeout-minutes: 30
needs: [fmt, clippy, docs, tests, build]
if: github.event_name == 'push' && contains(github.ref, 'refs/tags/')
steps:
- name: Checkout sources
uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0
- uses: dtolnay/rust-toolchain@stable
- run: cargo publish --token ${CRATES_TOKEN}
env:
CRATES_TOKEN: ${{ secrets.CRATES_TOKEN }}