# SPDX-FileCopyrightText: 2021 Heiko Schaefer # SPDX-FileCopyrightText: 2021 Nora Widdecke # SPDX-License-Identifier: CC0-1.0 stages: - lint - test - virtual-test - hw-builddeps - hw-import - hw-keygen variables: CARGO_HOME: cargo/ CARGO_TERM_VERBOSE: 'true' cache: &general_cache_config # default key is default # default policy is pull-push paths: - target/ - $CARGO_HOME reuse: stage: lint image: name: fsfe/reuse:latest entrypoint: [""] script: - reuse lint cargo-fmt: stage: lint image: rust:latest script: - rustup component add rustfmt - cargo fmt -- --check cargo-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 cache: # inherit all general cache settings <<: *general_cache_config # override the key key: "rust-latest" cargo-test-debian-bookworm: stage: test 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 script: - cargo test cache: # inherit all general cache settings <<: *general_cache_config # override the key key: "bookworm" run_cardtest_smartpgp: stage: virtual-test image: registry.gitlab.com/hkos/openpgp-card-images/smartpgp-builddeps script: - /etc/init.d/pcscd start - su - -c "sh /home/jcardsim/run-card.sh" jcardsim - cargo run -p openpgp-card-tests --bin import -- $CONFIG - cargo run -p openpgp-card-tests --bin keygen -- $CONFIG variables: CONFIG: "card-functionality/docker/test-smartpgp.toml" cache: # inherit all general cache settings <<: *general_cache_config # override the key key: "bookworm" run_cardtest_ykneo: stage: virtual-test image: registry.gitlab.com/hkos/openpgp-card-images/ykneo-builddeps script: - /etc/init.d/pcscd start - su - -c "sh /home/jcardsim/run-card.sh" jcardsim - cargo run -p openpgp-card-tests --bin import -- $CONFIG - cargo run -p openpgp-card-tests --bin keygen -- $CONFIG variables: CONFIG: "card-functionality/docker/test-ykneo.toml" cache: # inherit all general cache settings <<: *general_cache_config # override the key key: "bookworm" hardware-builddeps: stage: hw-builddeps needs: [] image: docker:stable services: - docker:dind before_script: - docker info - docker login -u gitlab-ci-token -p $CI_JOB_TOKEN $CI_REGISTRY script: - docker pull $IMAGE_LATEST || true - docker build --cache-from $IMAGE_LATEST --file=$DOCKERFILE -t $IMAGE_LATEST -t $IMAGE_SHA . - docker push $IMAGE_SHA - docker push $IMAGE_LATEST only: changes: - card-functionality/docker/Dockerfile.hardware-builddeps - .gitlab-ci.yml variables: IMAGE_LATEST: $CI_REGISTRY_IMAGE/hardware-builddeps:latest IMAGE_SHA: $CI_REGISTRY_IMAGE/hardware-builddeps:$CI_COMMIT_SHA DOCKERFILE: card-functionality/docker/Dockerfile.hardware-builddeps .hw-test-template: image: registry.gitlab.com/hkos/openpgp-card/hardware-builddeps tags: - card parallel: matrix: - CONFIG: - "card-functionality/ci/basic-2_1.toml" - "card-functionality/ci/nitro-pro1.toml" - "card-functionality/ci/nitro-pro2.toml" - "card-functionality/ci/nitro-start.toml" script: #- /etc/init.d/pcscd start #- sleep 5 - RUST_LOG=debug cargo run --bin $ARG -- $CONFIG cache: # inherit all general cache settings <<: *general_cache_config # cookiejar does not access the cache of the shared gitlab runners, # so use a different key for clarity key: "cookiejar" import: extends: .hw-test-template stage: hw-import variables: ARG: import keygen: extends: .hw-test-template stage: hw-keygen timeout: 2h variables: ARG: keygen