Add a CI job to run 'cargo test' with rustc/cargo from debian stable.

Minor fixes so that the code compiles with rustc 1.48
This commit is contained in:
Heiko Schaefer 2021-08-27 14:15:56 +02:00
parent 454d50eb45
commit fdac0de34f
3 changed files with 19 additions and 8 deletions

View file

@ -1,8 +1,6 @@
# SPDX-FileCopyrightText: 2021 Heiko Schaefer <heiko@schaefer.name> # SPDX-FileCopyrightText: 2021 Heiko Schaefer <heiko@schaefer.name>
# SPDX-License-Identifier: CC0-1.0 # SPDX-License-Identifier: CC0-1.0
image: rust:latest
reuse: reuse:
image: image:
name: fsfe/reuse:latest name: fsfe/reuse:latest
@ -12,15 +10,28 @@ reuse:
cargo-test: cargo-test:
stage: test stage: test
image: rust:latest
before_script:
- mkdir -p /run/user/$UID
- apt update -y -qq
- apt install -y -qq --no-install-recommends git clang make pkg-config nettle-dev libssl-dev capnproto ca-certificates libpcsclite-dev
- apt clean
script:
- cargo test
cargo-test-debian-stable:
stage: test
image: debian:stable
before_script: before_script:
- mkdir -p /run/user/$UID - mkdir -p /run/user/$UID
- apt update -y -qq - apt update -y -qq
- apt install -y -qq --no-install-recommends git rustc cargo clang make pkg-config nettle-dev libssl-dev capnproto ca-certificates libpcsclite-dev - apt install -y -qq --no-install-recommends git rustc cargo clang make pkg-config nettle-dev libssl-dev capnproto ca-certificates libpcsclite-dev
- apt clean - apt clean
script: script:
- cargo test - cargo test
cargo-fmt: cargo-fmt:
image: rust:latest
script: script:
- rustup component add rustfmt - rustup component add rustfmt
- cargo fmt -- --check - cargo fmt -- --check

View file

@ -30,12 +30,12 @@ pub(crate) fn upload_subkeys(
) -> Result<Vec<(String, KeyGenerationTime)>> { ) -> Result<Vec<(String, KeyGenerationTime)>> {
let mut out = vec![]; let mut out = vec![];
for kt in [ for kt in &[
KeyType::Signing, KeyType::Signing,
KeyType::Decryption, KeyType::Decryption,
KeyType::Authentication, KeyType::Authentication,
] { ] {
let vka = get_subkey(cert, kt)?; let vka = get_subkey(cert, *kt)?;
// store fingerprint as return-value // store fingerprint as return-value
let fp = vka.fingerprint().to_hex(); let fp = vka.fingerprint().to_hex();
@ -50,7 +50,7 @@ pub(crate) fn upload_subkeys(
// upload key // upload key
let cuk = vka_as_uploadable_key(vka, None); let cuk = vka_as_uploadable_key(vka, None);
let _ = ca.upload_key(cuk, kt)?; ca.upload_key(cuk, *kt)?;
} }
Ok(out) Ok(out)

View file

@ -309,12 +309,12 @@ impl CardUploadableKey for SequoiaKey {
let secret_key_material = unenc.map(|mpis| mpis.clone()); let secret_key_material = unenc.map(|mpis| mpis.clone());
match (&self.public, secret_key_material) { match (self.public.clone(), secret_key_material) {
( (
mpi::PublicKey::RSA { e, n }, mpi::PublicKey::RSA { e, n },
mpi::SecretKeyMaterial::RSA { d: _, p, q, u: _ }, mpi::SecretKeyMaterial::RSA { d: _, p, q, u: _ },
) => { ) => {
let sq_rsa = SqRSA::new(e.clone(), n.clone(), p, q); let sq_rsa = SqRSA::new(e, n, p, q);
Ok(PrivateKeyMaterial::R(Box::new(sq_rsa))) Ok(PrivateKeyMaterial::R(Box::new(sq_rsa)))
} }