-
Notifications
You must be signed in to change notification settings - Fork 172
127 lines (109 loc) · 4.31 KB
/
pre-release.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
115
116
117
118
119
120
121
122
123
124
125
126
127
#
# Copyright (c) 2023 ZettaScale Technology
#
# This program and the accompanying materials are made available under the
# terms of the Eclipse Public License 2.0 which is available at
# http://www.eclipse.org/legal/epl-2.0, or the Apache License, Version 2.0
# which is available at https://www.apache.org/licenses/LICENSE-2.0.
#
# SPDX-License-Identifier: EPL-2.0 OR Apache-2.0
#
# Contributors:
# ZettaScale Zenoh Team, <[email protected]>
#
name: Pre-Release
on:
schedule:
- cron: "0 0 * * 1-5"
workflow_dispatch:
inputs:
features:
description: Build with specified features (comma separated, no space)
type: string
workflow_call:
inputs:
features:
description: Build with specified features (comma separated, no space)
type: string
jobs:
checks:
name: Code checks
runs-on: ubuntu-latest
strategy:
matrix:
image: [ "ubuntu:20.04", "ubuntu:22.04", "ubuntu:24.04" ]
container:
image: ${{ matrix.image }}
options: --sysctl net.ipv6.conf.all.disable_ipv6=0 -e DEBIAN_FRONTEND=noninteractive
steps:
- name: Update and install packages
run: apt-get update && apt-get install -y curl git build-essential pkg-config libssl-dev
- name: Install Rust toolchain
run: |
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
echo "$HOME/.cargo/bin" >> $GITHUB_PATH
- name: Clone this repository
uses: actions/checkout@v4
- name: Install rustup components
run: rustup component add rustfmt clippy
- name: Code format check
run: cargo fmt --check -- --config "unstable_features=true,imports_granularity=Crate,group_imports=StdExternalCrate"
env:
CARGO_REGISTRIES_CRATES_IO_PROTOCOL: sparse
- name: Clippy check
run: cargo +stable clippy --all-targets --features=${{ inputs.features }} -- --deny warnings
- name: Clippy unstable check
run: cargo +stable clippy --all-targets -- --deny warnings
- name: Clippy all features
run: cargo +stable clippy --all-targets --all-features -- --deny warnings
tests:
name: Tests
needs: checks
runs-on: ubuntu-latest
strategy:
matrix:
image: [ "ubuntu:20.04", "ubuntu:22.04", "ubuntu:24.04" ]
container:
image: ${{ matrix.image }}
options: --sysctl net.ipv6.conf.all.disable_ipv6=0 -e DEBIAN_FRONTEND=noninteractive
steps:
- name: Update and install packages
run: apt-get update && apt-get install -y curl git build-essential pkg-config libssl-dev
- name: Install Rust toolchain
run: |
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
echo "$HOME/.cargo/bin" >> $GITHUB_PATH
- name: Clone this repository
uses: actions/checkout@v4
- name: Install nextest
run: cargo +stable install --locked cargo-nextest
env:
CARGO_REGISTRIES_CRATES_IO_PROTOCOL: sparse
- name: Run tests
run: cargo nextest run --release --features=${{ inputs.features }} --verbose
env:
CARGO_REGISTRIES_CRATES_IO_PROTOCOL: sparse
ASYNC_STD_THREAD_COUNT: 4
- name: Run doctests
run: cargo test --release --features=${{ inputs.features }} --doc
env:
CARGO_REGISTRIES_CRATES_IO_PROTOCOL: sparse
ASYNC_STD_THREAD_COUNT: 4
doc:
name: Generate documentation
needs: checks
runs-on: ubuntu-latest
steps:
- name: Clone this repository
uses: actions/checkout@v4
# Use a similar command than docs.rs build: rustdoc with nightly toolchain
- name: Install Rust toolchain nightly for docs gen
run: rustup toolchain install nightly
- name: Run rustdoc using Nightly Rust and Zenoh unstable
# NOTE: force 'unstable' feature for doc generation, as forced for docs.rs build in zenoh/Cargo.toml
run: >
cargo +nightly rustdoc --manifest-path ./zenoh/Cargo.toml --lib --features unstable -j3
-Z rustdoc-map -Z unstable-options -Z rustdoc-scrape-examples
--config build.rustdocflags='["-Z", "unstable-options", "--emit=invocation-specific", "--cap-lints", "warn", "--disable-per-crate-search", "--extern-html-root-takes-precedence"]'
env:
RUSTDOCFLAGS: -Dwarnings