Debian Codegraph @

.github/workflows/ci.yml

raw
1 name: Continuous Integration
2
3 on:
4 push:
5 branches:
6 - master
7 pull_request:
8
9 jobs:
10 lint:
11 runs-on: ubuntu-latest
12
13 steps:
14 - name: Checkout sources
15 uses: taiki-e/checkout-action@v1
16
17 - uses: taiki-e/install-action@cargo-binstall
18
19 - name: Rust toolchain
20 run: |
21 rustup default stable
22 rustup component add rustfmt clippy
23
24 - name: Cargo fmt
25 run: cargo fmt --all -- --check
26
27 - name: Clippy
28 run: cargo clippy --workspace --all-targets --features "block_on executor" -- -D warnings
29
30 ci-linux:
31 name: CI
32
33 needs:
34 - lint
35
36 strategy:
37 fail-fast: false
38 matrix:
39 rust: ["1.71.1", "stable", "beta"]
40
41 runs-on: "ubuntu-latest"
42
43 steps:
44 - name: Checkout sources
45 uses: taiki-e/checkout-action@v1
46
47 - name: Rust toolchain
48 run: rustup default ${{ matrix.rust }}
49
50 - name: Downgrade rayon
51 if: ${{ matrix.rust == '1.71.1' }}
52 run: cargo update --package rayon --precise 1.10.0
53
54 - name: Downgrade half
55 if: ${{ matrix.rust == '1.71.1' }}
56 run: cargo update --package half --precise 2.4.0
57
58 - name: Downgrade rayon-core
59 if: ${{ matrix.rust == '1.71.1' }}
60 run: cargo update --package rayon-core --precise 1.12.1
61
62 - name: Run tests
63 run: cargo test --features "block_on executor"
64
65 - name: Run tests with signals
66 run: cargo test --features "block_on executor signals"
67
68 - name: Run book tests
69 run: cargo test --all-features --manifest-path ./doc/Cargo.toml
70 if: ${{ matrix.rust == 'stable' || matrix.rust == 'beta' }}
71
72 ci-windows:
73 name: CI (Windows)
74
75 needs:
76 - lint
77
78 strategy:
79 fail-fast: false
80 matrix:
81 rust: ["1.71.1", "stable"]
82
83 runs-on: "windows-latest"
84
85 steps:
86 - name: Checkout sources
87 uses: taiki-e/checkout-action@v1
88
89 - name: Rust toolchain
90 run: rustup default ${{ matrix.rust }}
91
92 - name: Downgrade rayon
93 if: ${{ matrix.rust == '1.71.1' }}
94 run: cargo update --package rayon --precise 1.10.0
95
96 - name: Downgrade half
97 if: ${{ matrix.rust == '1.71.1' }}
98 run: cargo update --package half --precise 2.4.0
99
100 - name: Downgrade rayon-core
101 if: ${{ matrix.rust == '1.71.1' }}
102 run: cargo update --package rayon-core --precise 1.12.1
103
104 - name: Run tests
105 run: cargo test --features "block_on executor"
106
107 coverage:
108 name: Coverage
109
110 needs:
111 - ci-linux
112
113 strategy:
114 fail-fast: false
115 matrix:
116 os: ["ubuntu-latest", "macos-latest"]
117
118 runs-on: ${{ matrix.os }}
119
120 env:
121 GRCOV_VERSION: "0.8.10"
122
123 steps:
124 - name: Checkout sources
125 uses: taiki-e/checkout-action@v1
126
127 - name: Rust toolchain
128 run: |
129 rustup default nightly
130 rustup component add llvm-tools-preview
131
132 - name: Get grcov latest version
133 id: grcovversion
134 run: echo "::set-output name=version::$(cargo search 'grcov' --limit 1 | head -n 1 | cut -d ' ' -f 3 | cut -d '"' -f 2)"
135
136 - name: Install grcov
137 run: cargo install grcov --version ${{ steps.grcovversion.outputs.version }}
138
139 - name: Run tests
140 run: cargo test --all-features
141 env:
142 LLVM_PROFILE_FILE: "calloop-%p-%m.profraw"
143 RUSTFLAGS: "-Cinstrument-coverage --cfg coverage"
144
145 - name: Coverage
146 run: grcov . --binary-path ./target/debug -s . -t lcov --branch --llvm --ignore-not-existing --ignore 'examples/*' --ignore 'tests/*' --ignore '*/.cargo/registry/*' --excl-br-start "mod tests \{" --excl-start "mod tests \{" --excl-br-line "#\[derive\(" --excl-line "#\[derive\(" -o lcov.info
147
148 - name: Upload to codecov.io
149 uses: codecov/codecov-action@v5
150 with:
151 files: ./lcov.info
152 flags: ${{ matrix.os }}
153
154 doc:
155 name: Documentation on Github Pages
156 runs-on: ubuntu-latest
157
158 needs:
159 - ci-linux
160
161 steps:
162 - name: Checkout sources
163 uses: taiki-e/checkout-action@v1
164
165 - name: Rust toolchain
166 run: rustup default beta
167
168 # Combining these docs is order-dependent. The API docs must be copied
169 # into mdBook's source directory for it to copy it to the output directory
170 # as static content.
171
172 - name: Build Documentation
173 run: cargo doc --no-deps --features "block_on executor"
174
175 - run: rsync -r target/doc/ doc/src/api
176
177 - name: Build mdBook
178 uses: peaceiris/actions-mdbook@v2
179 with:
180 mdbook-version: "0.4.8"
181
182 - run: mdbook build doc
183
184 - name: Deploy
185 uses: peaceiris/actions-gh-pages@v4
186 if: ${{ github.event_name == 'push' }}
187 with:
188 github_token: ${{ secrets.GITHUB_TOKEN }}
189 publish_dir: ./doc/book
190 force_orphan: true