Repository navigation
123 lines (113 loc) · 4.32 KB
/
Copy pathrust.yml
File metadata and controls
123 lines (113 loc) · 4.32 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
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
name: Rust
on:
push:
# Feature branches get CI from pull_request, so push runs only the long-lived branches.
branches:
- main
- 'branch-*'
pull_request:
merge_group:
permissions:
contents: read
# Only PR runs are disposable. Main, schedule and merge-queue runs keep their verdicts.
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
jobs:
codestyle:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Setup Rust Toolchain
uses: ./.github/actions/setup-builder
- run: cargo fmt --all -- --check
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Setup Rust Toolchain
uses: ./.github/actions/setup-builder
- run: cargo clippy --locked --workspace --all-targets --all-features -- -D warnings
docs:
runs-on: ubuntu-latest
env:
RUSTDOCFLAGS: "-Dwarnings"
steps:
- uses: actions/checkout@v4
- name: Setup Rust Toolchain
uses: ./.github/actions/setup-builder
- run: cargo doc --locked --document-private-items --no-deps --workspace --all-features
compile-no-std:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Setup Rust Toolchain
uses: ./.github/actions/setup-builder
with:
targets: 'thumbv6m-none-eabi'
- run: cargo test --locked --release --no-default-features --test no_std_recursion
- run: cargo check --locked --no-default-features --target thumbv6m-none-eabi
- run: cargo check --locked --no-default-features --features visitor --target thumbv6m-none-eabi
test:
strategy:
matrix:
rust: [stable, beta, nightly]
runs-on: ubuntu-latest
env:
CARGO_PROFILE_TEST_DEBUG: line-tables-only
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Rust Toolchain
uses: ./.github/actions/setup-builder
with:
rust-version: ${{ matrix.rust }}
- uses: Swatinem/rust-cache@9d47c6ad4b02e050fd481d890b2ea34778fd09d6 # v2.7.8
- name: Test
run: cargo test --locked --all-features
- name: Test fuzz helpers
run: cargo test --locked --manifest-path fuzz/Cargo.toml --test expression
coverage:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
ref: ${{ github.event.pull_request.head.sha || github.sha }}
- name: Setup Rust Toolchain
uses: ./.github/actions/setup-builder
- run: rustup component add llvm-tools-preview
- uses: taiki-e/install-action@7623a79cdfecb99d681017af368ca353d9f49bb5 # v2.87.19
with:
tool: cargo-llvm-cov
- uses: Swatinem/rust-cache@9d47c6ad4b02e050fd481d890b2ea34778fd09d6 # v2.7.8
- run: cargo llvm-cov --locked --all-features --no-report
- run: cargo llvm-cov report --codecov --output-path target/codecov.json
- uses: codecov/codecov-action@303a32d7a59b442fa8d48b6a1cc6825c09c847a5 # v7.1.1
with:
files: target/codecov.json
fail_ci_if_error: false
token: ${{ secrets.CODECOV_TOKEN }}
- run: cargo llvm-cov report --summary-only --fail-under-lines 90
- name: Changed lines must be covered
if: github.event_name == 'pull_request'
run: |
cargo llvm-cov report --lcov --output-path target/lcov.info
pipx run --spec diff-cover==10.6.0 diff-cover target/lcov.info \
--compare-branch ${{ github.event.pull_request.base.sha }} --fail-under 80