-
Notifications
You must be signed in to change notification settings - Fork 12
114 lines (104 loc) · 3.34 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
name: CI
on:
push:
paths-ignore:
- '**.md'
- 'LICENSE'
pull_request:
paths-ignore:
- '**.md'
- 'LICENSE'
workflow_dispatch:
env:
CARGO_TERM_COLOR: always
# When updating this, also update:
# - src/lib.rs
# - Cargo.toml
# - README.md
rust_minver: 1.56.0
jobs:
format:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Install nightly
run: |
rustup toolchain install nightly
rustup component add rustfmt --toolchain nightly
- name: Restore cargo caches
uses: Swatinem/rust-cache@v1
- name: Check formatting
run: cargo +nightly fmt --all --verbose -- --check
test:
strategy:
matrix:
os: ['ubuntu-latest', 'windows-latest', 'macos-latest']
fn_features: ['', 'log native libsystemd multi-thread']
cfg_feature: ['', 'flexible-string', 'source-location']
runs-on: ${{ matrix.os }}
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Install dependencies
if: matrix.os == 'ubuntu-latest'
run: sudo apt install libsystemd-dev
- name: Restore cargo caches
uses: Swatinem/rust-cache@v1
- name: Run tests
run: cargo test --features "${{ env.fn_features }} ${{ matrix.cfg_feature }}" --verbose
clippy:
strategy:
matrix:
os: ['ubuntu-latest', 'windows-latest', 'macos-latest']
runs-on: ${{ matrix.os }}
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Install dependencies
if: matrix.os == 'ubuntu-latest'
run: sudo apt install libsystemd-dev
- name: Install nightly
run: |
rustup toolchain install nightly
rustup component add clippy --toolchain nightly
- name: Restore cargo caches
uses: Swatinem/rust-cache@v1
- name: Run clippy
run: cargo clippy --all-features --tests --examples -- -D warnings
- name: Run clippy nightly for benches
run: cargo +nightly clippy --all-features --benches
check-doc:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Install dependencies
run: sudo apt install libsystemd-dev
- name: Install nightly
run: rustup toolchain install nightly
- name: Restore cargo caches
uses: Swatinem/rust-cache@v1
- name: Run rustdoc
run: |
cd spdlog
cargo +nightly rustdoc --all-features --verbose -- -D warnings
cd ../spdlog-macros
cargo +nightly rustdoc --all-features --verbose -- -D warnings
check-minver:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Install dependencies
run: sudo apt install libsystemd-dev
- name: Install Rust ${{ env.rust_minver }}
run: rustup toolchain install ${{ env.rust_minver }}
- name: Restore cargo caches
uses: Swatinem/rust-cache@v1
- name: Run check for core with Rust ${{ env.rust_minver }}
run: |
# Some dev-dependencies require a newer version of Rust, but it doesn't matter for MSRV check
# This is a workaround for the cargo nightly option `-Z avoid-dev-deps`
sed -i 's/\[dev-dependencies]/[workaround-avoid-dev-deps]/g' ./spdlog/Cargo.toml
cargo +${{ env.rust_minver }} check --all-features --verbose