diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 93a4855..220971e 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -21,6 +21,10 @@ cache: &general_cache_config - target/ - $CARGO_HOME +.report-rust: &report-rust + - cargo --version + - rustc --version + reuse: stage: lint image: @@ -34,8 +38,10 @@ reuse: cargo-fmt: stage: lint image: rust:latest - script: + before_script: - rustup component add rustfmt + - *report-rust + script: - cargo fmt -- --check cache: [ ] @@ -44,6 +50,7 @@ cargo-deny: image: rust:latest before_script: - cargo install --locked cargo-deny + - *report-rust script: - cargo deny check cache: [ ] @@ -56,9 +63,9 @@ cargo-clippy: - 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 + - *report-rust script: - rustup component add clippy - - rm tools/tests/opgpcard.rs # otherwise build fails - cargo clippy --verbose --tests -- -D warnings cache: # inherit all general cache settings @@ -77,22 +84,21 @@ udeps: - curl --location --output /tmp/cargo-udeps.tar.gz https://github.com/est31/cargo-udeps/releases/download/v0.1.26/cargo-udeps-v0.1.26-x86_64-unknown-linux-gnu.tar.gz - tar --extract --verbose --gzip --file /tmp/cargo-udeps.tar.gz --directory /usr/local/bin/ --strip-components=2 ./cargo-udeps-v0.1.26-x86_64-unknown-linux-gnu/cargo-udeps script: - - rm tools/tests/opgpcard.rs # otherwise build fails - cargo udeps --workspace --all-features --all-targets cache: [ ] cargo-test: stage: test - image: registry.gitlab.com/openpgp-card/virtual-cards/smartpgp-builddeps + 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 - - /etc/init.d/pcscd start - - su - -c "sh /home/jcardsim/run-card.sh >/dev/null" jcardsim + - *report-rust script: - - touch tools/virtual-card-available + # there is no virtual card in this image, so subplot does not generate tests + # that would require one. - cargo test cache: # inherit all general cache settings @@ -102,16 +108,16 @@ cargo-test: cargo-test-debian-bookworm: stage: test - image: registry.gitlab.com/openpgp-card/virtual-cards/smartpgp-builddeps + image: debian:bookworm-slim before_script: - mkdir -p /run/user/$UID - 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 clean - - /etc/init.d/pcscd start - - su - -c "sh /home/jcardsim/run-card.sh >/dev/null" jcardsim + - *report-rust script: - - touch tools/virtual-card-available + # there is no virtual card in this image, so subplot does not generate tests + # that would require one. - cargo test cache: # inherit all general cache settings @@ -119,9 +125,33 @@ cargo-test-debian-bookworm: # override the key key: "bookworm" +subplot: + stage: virtual-test + image: registry.gitlab.com/openpgp-card/virtual-cards/smartpgp-builddeps + 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 + - /etc/init.d/pcscd start + - su - -c "sh /home/jcardsim/run-card.sh >/dev/null" jcardsim + - *report-rust + script: + # make sure a virtual card is available, so that the subplot tests are + # generated + - touch tools/virtual-card-available + - cargo test + cache: + # inherit all general cache settings + <<: *general_cache_config + # override the key + key: "rust-latest" + run_cardtest_smartpgp: stage: virtual-test image: registry.gitlab.com/openpgp-card/virtual-cards/smartpgp-builddeps + before_script: + - *report-rust script: - sh /start.sh - RUST_BACKTRACE=1 cargo run -p openpgp-card-tools --bin opgpcard -- status @@ -140,6 +170,8 @@ run_cardtest_smartpgp: run_cardtest_opcard_rs: stage: virtual-test image: registry.gitlab.com/openpgp-card/virtual-cards/opcard-rs-builddeps + before_script: + - *report-rust script: - sh /start.sh - RUST_BACKTRACE=1 cargo run -p openpgp-card-tools --bin opgpcard -- status @@ -158,6 +190,8 @@ run_cardtest_opcard_rs: run_cardtest_ykneo: stage: virtual-test image: registry.gitlab.com/openpgp-card/virtual-cards/ykneo-builddeps + before_script: + - *report-rust script: - sh /start.sh - RUST_BACKTRACE=1 cargo run -p openpgp-card-tools --bin opgpcard -- status @@ -176,6 +210,8 @@ run_cardtest_ykneo: run_cardtest_fluffypgp: stage: virtual-test image: registry.gitlab.com/openpgp-card/virtual-cards/fluffypgp-builddeps + before_script: + - *report-rust script: - sh /start.sh - RUST_BACKTRACE=1 cargo run -p openpgp-card-tools --bin opgpcard -- status @@ -233,6 +269,8 @@ hardware-builddeps: - "card-functionality/ci/nitro-pro1.toml" - "card-functionality/ci/nitro-pro2.toml" - "card-functionality/ci/nitro-start.toml" + before_script: + - *report-rust script: - RUST_BACKTRACE=1 RUST_LOG=debug cargo run --bin $ARG -- $CONFIG cache: