Move subplot tests to a feature so subplot doesn't affect most builds

Installing sq from crates.io (cargo install sequoia-sq) was broken by a
semver-compatible change in Tera.  Running cargo test uses the lockfile
and isn't affected.

This has the side benefit of reducing dependency bloat, the baseline
depends on check/build/build --release but in the case of a non-release
build the dependency count goes from 403 to 315.

Fixes #2.

The subplot/tera issue was likely triggered by this change in tera
1.18: <https://github.com/Keats/tera/pull/799>.
This commit is contained in:
Gabriel de Perthuis 2023-04-15 12:04:53 +02:00 committed by Neal H. Walfield
parent 689ed7428b
commit 2c57cd77d7
No known key found for this signature in database
GPG Key ID: 6863C9AD5B4D22D3
4 changed files with 7 additions and 4 deletions

View File

@ -53,7 +53,7 @@ bookworm:
interruptible: true
image: 192.168.122.1:5000/sequoia-pgp/build-docker-image/bookworm:latest
script:
- cargo test
- cargo test --features=subplot
- if ! git diff --quiet Cargo.lock ; then echo "Cargo.lock changed. Please add the change to the corresponding commit." ; git diff ; false ; fi
- if ! git diff --quiet ; then echo "The build changed the source. Please investigate." ; git diff ; fi
variables:
@ -136,7 +136,7 @@ rust-stable:
- rustup override set stable
- *before_script_end
script:
- cargo test
- cargo test --features=subplot
variables:
CARGO_TARGET_DIR: /target
CARGO_HOME: /cargo
@ -181,7 +181,7 @@ windows-gnu-cng:
script:
# https://github.com/rust-lang/cargo/issues/5015
- pacman --noconfirm --needed -S mingw-w64-x86_64-openssl
- cargo test --tests --no-default-features --features crypto-cng,compression-bzip2
- cargo test --tests --no-default-features --features crypto-cng,compression-bzip2,subplot
after_script: [] # scriptlet doesn't work on Powershell
variables:
CFLAGS: "" # Silence some C warnings when compiling under Windows

View File

@ -61,7 +61,7 @@ clap_mangen = "0.2"
chrono = "0.4.10"
sequoia-openpgp = { version = "1.13", default-features = false }
sequoia-net = { version = "0.27", default-features = false }
subplot-build = "0.6.0"
subplot-build = { version = "0.6.0", optional = true }
cfg-if = "1"
[dev-dependencies]
@ -90,6 +90,7 @@ crypto-cng = ["sequoia-openpgp/crypto-cng"]
crypto-rust = ["sequoia-openpgp/crypto-rust"]
compression-bzip2 = ["sequoia-openpgp/compression-bzip2"]
autocrypt = ["sequoia-autocrypt"]
subplot = ["subplot-build"]
[profile.release]
debug = true

View File

@ -13,6 +13,7 @@ fn main() {
println!("cargo:rerun-if-changed=build.rs");
// Generate subplot tests.
#[cfg(feature = "subplot")]
subplot_build::codegen(Path::new("sq.subplot"))
.expect("failed to generate code with Subplot");

View File

@ -1 +1,2 @@
#![cfg(feature = "subplot")]
include!(concat!(env!("OUT_DIR"), "/sq.rs"));