-
Notifications
You must be signed in to change notification settings - Fork 3
102 lines (97 loc) · 3.07 KB
/
Copy pathci.yml
File metadata and controls
102 lines (97 loc) · 3.07 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
name: Rust CI checks
on:
push:
branches: ["main"]
pull_request:
jobs:
lint:
name: Run lint checks
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Install Rust stable toolchain
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
override: true
components: rustfmt, clippy
- name: Check Rust formatting
uses: actions-rs/cargo@v1
with:
command: fmt
args: --all -- --check
- name: Check clippy
uses: actions-rs/clippy-check@v1
with:
token: ${{ secrets.GITHUB_TOKEN }}
args: --all-targets -- -D warnings
test:
name: Run tests
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/cache@v2
with:
path: |
~/.cargo/registry
~/.cargo/git
target
key: ${{ runner.os }}-cargo-test-${{ hashFiles('Cargo.toml') }}
- name: Install Rust stable toolchain
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
- name: Run test
run: cargo test --all-targets --features long_tests
bench:
name: Run benchmarks
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/cache@v2
with:
path: |
~/.cargo/registry
~/.cargo/git
target
key: ${{ runner.os }}-cargo-bench-${{ hashFiles('Cargo.toml') }}
- name: Install Rust stable toolchain
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
- name: Run benchmark
run: cargo bench -- --output-format bencher | tee output.txt
- name: 'Upload Artifact'
uses: actions/upload-artifact@v2
with:
name: bench_result
path: output.txt
# Split the benchmark testing step into a separate
# step that runs with no checked-out code and access to secrets
bench-check:
name: Check benchmark result
runs-on: ubuntu-latest
needs: "bench"
steps:
- uses: actions/checkout@v2
- uses: actions/download-artifact@v2
with:
name: bench_result
- name: Store benchmark result
uses: rhysd/github-action-benchmark@v1
with:
name: Rust Benchmark
tool: "cargo"
output-file-path: output.txt
github-token: ${{ secrets.GITHUB_TOKEN }}
comment-on-alert: true
alert-threshold: "150%"
# Only push and save on pushes to main.
auto-push: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }}
# Comment on pushes to main AND on any commit that includes `[bench]`
# in the message.
comment-always: ${{ (github.event_name == 'push' && github.ref == 'refs/heads/main') || contains(steps.head_commit.outputs.message, '[bench]') }}
save-data-file: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }}