-
-
Notifications
You must be signed in to change notification settings - Fork 20
73 lines (71 loc) · 2.48 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
name: 'sntpc test'
on:
push:
branches:
- master
pull_request:
branches:
- master
jobs:
clippy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Run clippy with all features
run: cargo clippy --workspace --exclude example-simple-no-std --all-features -- -D clippy::all -D clippy::pedantic
- name: Run clippy with no_std
run: cargo clippy -p example-simple-no-std --no-default-features --profile no-std -- -D clippy::all -D clippy::pedantic
clippy-nightly:
runs-on: ubuntu-latest
container:
image: rust:latest
steps:
- uses: actions/checkout@v4
- name: Install nightly toolchain
run: rustup toolchain add nightly
- name: Install clippy
run: rustup component add clippy --toolchain nightly
- name: Run clippy for async feature
run: cargo +nightly clippy --workspace --exclude example-simple-no-std --all-features -- -D clippy::all -D clippy::pedantic
check-format:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Check formatting
run: cargo fmt --check
build-test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Build with std
run: cargo build --workspace --exclude example-simple-no-std --all-features
- name: Build with no_std
run: |
cargo build -p sntpc --no-default-features
cargo build -p example-simple-no-std --profile no-std
- name: Run tests with std
run: cargo test --all-features
- name: Run tests with no_std
run: cargo test --no-default-features
benchmark:
name: Benchmark sync and async API
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install uv
uses: astral-sh/setup-uv@v4
- name: Start test NTP server
run: uvx --from git+https://github.com/vpetrigo/ntpserver@master ntpserver > /dev/null &
- name: Run benchmarking
run: cargo bench --bench async --bench sync --features sync -- --output-format bencher | tee output.txt
- name: Kill NTP server
run: pgrep -f ntpserver | xargs kill
- name: Store benchmark result
uses: benchmark-action/github-action-benchmark@v1
with:
tool: 'cargo'
output-file-path: output.txt
github-token: ${{ secrets.GITHUB_TOKEN }}
fail-on-alert: true
comment-on-alert: true
alert-comment-cc-users: '@vpetrigo'