Skip to content

Commit 593bc47

Browse files
committed
run CI for stable and nightly
1 parent 1909414 commit 593bc47

File tree

3 files changed

+44
-16
lines changed

3 files changed

+44
-16
lines changed

.github/workflows/ci.yml

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -138,9 +138,8 @@ jobs:
138138
steps:
139139
- uses: actions/checkout@v4
140140

141-
- uses: dtolnay/rust-toolchain@master
142-
with:
143-
toolchain: stable
141+
- uses: dtolnay/rust-toolchain@nightly
142+
- uses: dtolnay/rust-toolchain@stable
144143

145144
- name: Cache
146145
uses: Swatinem/rust-cache@v2
@@ -150,7 +149,7 @@ jobs:
150149
cargo install svd2rust --path .
151150
152151
- name: Check docs and clippy on generated PACs
153-
run: cargo regress test -c ${{ matrix.chip }} --docs --clippy ${{ matrix.options }}
152+
run: cargo regress test -c ${{ matrix.chip }} --docs-stable --docs-nightly --clippy ${{ matrix.options }}
154153

155154
ci-serde:
156155
runs-on: ubuntu-latest

ci/svd2rust-regress/src/main.rs

Lines changed: 18 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -94,9 +94,13 @@ pub struct TestAll {
9494
#[clap(long)]
9595
pub clippy: bool,
9696

97-
/// Check documentation build.
97+
/// Check documentation build with stable.
9898
#[clap(long)]
99-
pub docs: bool,
99+
pub docs_stable: bool,
100+
101+
/// Check documentation build with nightly settings (docs.rs equivalent).
102+
#[clap(long)]
103+
pub docs_nightly: bool,
100104

101105
/// Print all available test using the specified filters
102106
#[clap(long)]
@@ -154,9 +158,14 @@ pub struct Test {
154158
/// Check generated crate with clippy.
155159
#[arg(long)]
156160
pub clippy: bool,
157-
/// Check documentation build.
158-
#[arg(long)]
159-
pub docs: bool,
161+
162+
/// Check documentation build with stable.
163+
#[clap(long)]
164+
pub docs_stable: bool,
165+
166+
/// Check documentation build with nightly settings (docs.rs equivalent).
167+
#[clap(long)]
168+
pub docs_nightly: bool,
160169

161170
/// Path to an `svd2rust` binary, relative or absolute.
162171
/// Defaults to `target/release/svd2rust[.exe]` of this repository
@@ -210,7 +219,8 @@ impl Test {
210219
opts,
211220
&self.current_bin_path,
212221
self.clippy,
213-
self.docs,
222+
self.docs_stable,
223+
self.docs_nightly,
214224
&self.passthrough_opts,
215225
)?;
216226
Ok(())
@@ -272,7 +282,8 @@ impl TestAll {
272282
opt,
273283
&self.current_bin_path,
274284
self.clippy,
275-
self.docs,
285+
self.docs_stable,
286+
self.docs_nightly,
276287
&self.passthrough_opts,
277288
) {
278289
Ok(s) => {

ci/svd2rust-regress/src/svd_test.rs

Lines changed: 23 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,8 @@ impl TestCase {
159159
opts: &Opts,
160160
bin_path: &Path,
161161
run_clippy: bool,
162-
run_docs: bool,
162+
run_docs_stable: bool,
163+
run_docs_nightly: bool,
163164
cli_passthrough_opts: &Option<Vec<String>>,
164165
) -> Result<Option<Vec<PathBuf>>, TestError> {
165166
let (chip_dir, mut process_stderr_paths) = self
@@ -180,9 +181,9 @@ impl TestCase {
180181
.with_context(|| "failed to check with cargo check")?;
181182
process_stderr_paths.push(cargo_check_err_file);
182183
}
183-
if run_docs {
184-
tracing::info!("Checking docs build");
185-
let cargo_docs_err_file = path_helper_base(&chip_dir, &["cargo-docs.err.log"]);
184+
if run_docs_nightly {
185+
tracing::info!("Checking docs build with nightly");
186+
let cargo_docs_err_file = path_helper_base(&chip_dir, &["cargo-docs-nightly.err.log"]);
186187
// Docs are built like docs.rs would build them. Additionally, build with all features.
187188

188189
// Set the RUSTDOCFLAGS environment variable
@@ -195,7 +196,24 @@ impl TestCase {
195196
.current_dir(&chip_dir)
196197
.run_and_capture_stderr(
197198
true,
198-
"cargo docs",
199+
"cargo docs nightly",
200+
&cargo_docs_err_file,
201+
&process_stderr_paths,
202+
)
203+
.with_context(|| "failed to generate docs with cargo docs")?;
204+
}
205+
if run_docs_stable {
206+
tracing::info!("Checking docs build with stable");
207+
let cargo_docs_err_file = path_helper_base(&chip_dir, &["cargo-docs-stable.err.log"]);
208+
// Docs are built like docs.rs would build them. Additionally, build with all features.
209+
Command::new("cargo")
210+
.arg("+stable")
211+
.arg("doc")
212+
.arg("--all-features")
213+
.current_dir(&chip_dir)
214+
.run_and_capture_stderr(
215+
true,
216+
"cargo docs stable",
199217
&cargo_docs_err_file,
200218
&process_stderr_paths,
201219
)

0 commit comments

Comments
 (0)