stages: - pre-check - build - test # These stanzas do some common management tasks before and after the # job-specific before_script and after_script stanzas are run. # before_script_start configures any default global state. The # job-specific before_script can override this state, if required. # before_script_end prints out information about the environment to # improve debugging; it does not modify the environment. # after_script_end does some common management tasks after the # job-specific after_script is run. It prints information about the # environment, and does some clean up. # # Add this to your stanza as follows: # # before_script: # - *before_script_start # - *** YOUR CODE HERE *** # - *before_script_end # after_script: # - *** YOUR CODE HERE *** # - *after_script_end .before_script_start: &before_script_start - 'if test "x${RUSTFLAGS+SET}" = xSET; then echo "\$RUSTFLAGS is set ($RUSTFLAGS)"; exit 1; fi' .before_script_end: &before_script_end - 'if test "x${RUSTFLAGS+SET}" = xSET; then echo "WARNING: before_script set \$RUSTFLAGS ($RUSTFLAGS)"; fi' - rustc --version --verbose - cargo --version - clang -v - if [ -d $CARGO_TARGET_DIR ]; then find $CARGO_TARGET_DIR | wc --lines; du -sh $CARGO_TARGET_DIR; fi - if [ -d $CARGO_HOME ]; then find $CARGO_HOME | wc --lines; du -sh $CARGO_HOME; fi .after_script_end: &after_script_end - if [ -d $CARGO_TARGET_DIR ]; then find $CARGO_TARGET_DIR -type f -atime +7 -delete; fi - if [ -d $CARGO_TARGET_DIR ]; then du -sh $CARGO_TARGET_DIR; fi - if [ -d $CARGO_HOME ]; then du -sh $CARGO_HOME; fi before_script: - *before_script_start - *before_script_end after_script: - *after_script_end bookworm: tags: - linux stage: build image: registry.gitlab.com/sequoia-pgp/build-docker-image/bookworm-prebuild:latest script: - cargo run --manifest-path openpgp/Cargo.toml --no-default-features --features crypto-nettle,compression --example supported-algorithms - $MAKE_TOP test - 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 sq ; then echo "Please commit the changes to sq/sq-usage.md." ; false ; fi - if ! git diff --quiet ; then echo "The build changed the source. Please investigate." ; git diff ; fi variables: CARGO_TARGET_DIR: /target CARGO_HOME: /cargo bookworm:arm64: tags: - docker-arm64 stage: build image: registry.gitlab.com/sequoia-pgp/build-docker-image/bookworm-prebuild-arm64:latest when: manual only: variables: # Forks of this project most likely do not have an arm64 runner - $CI_PROJECT_NAMESPACE == "sequoia-pgp" script: - $MAKE_TOP test - if ! git diff --quiet Cargo.lock ; then echo "Cargo.lock changed. Please add the change to the corresponding commit." ; false ; fi - if ! git diff --quiet sq ; then echo "Please commit the changes to sq/src/sq-usage.md." ; false ; fi - if ! git diff --quiet ; then echo "The build changed the source. Please investigate." ; git diff ; fi variables: CARGO_TARGET_DIR: /target CARGO_HOME: /cargo sq-features: tags: - linux stage: build image: registry.gitlab.com/sequoia-pgp/build-docker-image/bookworm-prebuild:latest only: refs: # Run unconditionally for branch names that contain sq and main, # changes only applies to "branches" here - sq #branch names containing 'sq' - tags - web - schedules parallel: matrix: - FEATURES: - "" - "autocrypt" - "autocrypt,compression-bzip2" - "compression-bzip2" script: - cargo test --package sequoia-sq --no-default-features --features crypto-nettle --features $FEATURES variables: CARGO_TARGET_DIR: /target CARGO_HOME: /cargo bookworm-crypto-rust: tags: - linux stage: build image: registry.gitlab.com/sequoia-pgp/build-docker-image/bookworm-prebuild:latest dependencies: - codespell script: - cargo run --manifest-path openpgp/Cargo.toml --no-default-features --features crypto-rust,compression,allow-experimental-crypto,allow-variable-time-crypto --example supported-algorithms - cargo test --release --manifest-path openpgp/Cargo.toml --no-default-features --features crypto-rust,compression,allow-experimental-crypto,allow-variable-time-crypto variables: CARGO_TARGET_DIR: /target CARGO_HOME: /cargo benchmarks: stage: test image: registry.gitlab.com/sequoia-pgp/build-docker-image/bookworm:latest needs: ["rust-stable"] only: refs: - /bench/i # refs containing 'bench' keyword - tags - web - schedules before_script: - *before_script_start - cargo install critcmp - *before_script_end script: - cargo bench -- --color always --save-baseline $CI_COMMIT_SHA after_script: - MAIN_SHA=$(git merge-base $CI_COMMIT_SHA origin/main) - echo CI_COMMIT_SHA=$CI_COMMIT_SHA > benchmark.txt - echo CI_COMMIT_BEFORE_SHA=$CI_COMMIT_BEFORE_SHA >> benchmark.txt - echo MAIN_SHA=$MAIN_SHA >> benchmark.txt - $CARGO_HOME/bin/critcmp --baselines - $CARGO_HOME/bin/critcmp $CI_COMMIT_SHA $CI_COMMIT_BEFORE_SHA $MAIN_SHA | tee -a benchmark.txt artifacts: expose_as: 'benchmark results' paths: ['benchmark.txt'] variables: CARGO_TARGET_DIR: $CI_PROJECT_DIR/../target.benchmarks all_commits: # Test each commit up to main, to facilitate bisecting. stage: test image: registry.gitlab.com/sequoia-pgp/build-docker-image/rust-stable-prebuild:latest needs: ["rust-stable"] except: # Do not run for pushes to the pep-engine branch. - /^pep-engine$/ script: - .ci/all_commits.sh variables: CARGO_TARGET_DIR: /target CARGO_HOME: /cargo GIT_STRATEGY: clone all_commits:arm64: # Test each commit up to main, to facilitate bisecting. tags: - docker-arm64 stage: test image: registry.gitlab.com/sequoia-pgp/build-docker-image/rust-stable-prebuild-arm64:latest needs: ["rust-stable:arm64"] only: refs: - /arm64/i # refs containing 'arm64' keyword - tags - web - schedules variables: # Forks of this project most likely do not have an arm64 runner - $CI_PROJECT_NAMESPACE == "sequoia-pgp" when: manual except: # Do not run for pushes to the pep-engine branch. - /^pep-engine$/ script: - .ci/all_commits.sh variables: CARGO_TARGET_DIR: /target CARGO_HOME: /cargo GIT_STRATEGY: clone codespell: tags: - linux stage: pre-check image: registry.gitlab.com/sequoia-pgp/build-docker-image/bookworm:latest before_script: - *before_script_start - codespell --version - *before_script_end script: - $MAKE_TOP codespell CODESPELL_FLAGS=--summary doc: tags: - linux stage: build image: registry.gitlab.com/sequoia-pgp/build-docker-image/rust-stable-prebuild:latest before_script: - *before_script_start - rustup override set stable - *before_script_end script: - cargo doc --document-private-items --no-deps variables: CARGO_TARGET_DIR: /target CARGO_HOME: /cargo rust-stable: tags: - linux stage: build image: registry.gitlab.com/sequoia-pgp/build-docker-image/rust-stable-prebuild:latest before_script: - *before_script_start - rustup override set stable - *before_script_end script: - CARGO_PACKAGES="-p buffered-reader -p sequoia-openpgp" $MAKE_TOP test variables: CARGO_TARGET_DIR: /target CARGO_HOME: /cargo clippy: tags: - linux stage: build image: registry.gitlab.com/sequoia-pgp/build-docker-image/rust-stable-prebuild:latest before_script: - *before_script_start - apt-get -y install libssl-dev capnproto libsqlite3-dev - rustup default 1.60.0 - rustup component add clippy - cargo clippy --version - *before_script_end script: - cargo clippy variables: CARGO_TARGET_DIR: /target CARGO_HOME: /cargo rust-stable-armv7: tags: - linux stage: build image: registry.gitlab.com/sequoia-pgp/build-docker-image/bullseye-cross-arm-prebuild:latest before_script: - *before_script_start - cat .ci/snippet_for_cross_compilation_config.toml >> .cargo/config.toml - *before_script_end script: - CARGO_PACKAGES="-p buffered-reader -p sequoia-openpgp" $MAKE_TOP test variables: CARGO_TARGET_DIR: /target CARGO_HOME: /cargo CARGO_PACKAGES: -p buffered-reader -p sequoia-openpgp CARGO_FLAGS: --target=armv7-unknown-linux-gnueabihf PKG_CONFIG_PATH: /usr/lib/arm-linux-gnueabihf/pkgconfig PKG_CONFIG_ALLOW_CROSS: 1 rust-stable:arm64: tags: - docker-arm64 stage: build image: registry.gitlab.com/sequoia-pgp/build-docker-image/rust-stable-prebuild-arm64:latest only: variables: # Forks of this project most likely do not have an arm64 runner - $CI_PROJECT_NAMESPACE == "sequoia-pgp" when: manual before_script: - *before_script_start - rustup override set stable - *before_script_end script: - CARGO_PACKAGES="-p buffered-reader -p sequoia-openpgp" $MAKE_TOP test variables: CARGO_TARGET_DIR: /target CARGO_HOME: /cargo windows-gnu-nettle: tags: - win - win2019 stage: build image: registry.gitlab.com/sequoia-pgp/build-docker-image/windows-gnu only: variables: # Forks of this project most likely use gitlab's shared windows runners, which # do not use the docker executor, so disable the windows jobs for forks. - $CI_PROJECT_NAMESPACE == "sequoia-pgp" before_script: # the default before_scipt scriptlet doesn't work on Powershell - pacman -S gnupg --noconfirm - rustup default "1.60.0" - rustc --version --verbose - cargo --version - clang -v - gpg --version script: - cargo test --workspace after_script: [] # scriptlet doesn't work on Powershell variables: CFLAGS: "" # Silence some C warnings when compiling under Windows windows-gnu-cng: tags: - win - win2019 stage: build # Depend on the main configuration. As the jobs have common error # conditions, if one fails it is often not worth trying the other. # Therefore, we can short-circuit here. Also, this pipelines # Windows jobs, allowing us to test the other toolchain as well. needs: - windows-gnu-nettle image: registry.gitlab.com/sequoia-pgp/build-docker-image/windows-gnu only: variables: # Forks of this project most likely use gitlab's shared windows runners, which # do not use the docker executor, so disable the windows jobs for forks. - $CI_PROJECT_NAMESPACE == "sequoia-pgp" before_script: # the default before_scipt scriptlet doesn't work on Powershell - rustup default "1.60.0" - rustc --version --verbose - cargo --version - clang -v - gpg --version script: # https://github.com/rust-lang/cargo/issues/5015 - cargo test --manifest-path openpgp/Cargo.toml --no-default-features --features crypto-cng,compression after_script: [] # scriptlet doesn't work on Powershell variables: CFLAGS: "" # Silence some C warnings when compiling under Windows windows-msvc-cng: tags: - win - win2019 stage: build image: registry.gitlab.com/sequoia-pgp/build-docker-image/windows-msvc only: variables: # Forks of this project most likely use gitlab's shared windows runners, which # do not use the docker executor, so disable the windows jobs for forks. - $CI_PROJECT_NAMESPACE == "sequoia-pgp" before_script: # We don't call *before_script_start or *before_script_end as we # don't have bash, clang, etc. - rustup default "1.60.0" - rustc --version --verbose - cargo --version script: # https://github.com/rust-lang/cargo/issues/5015 - cargo run --manifest-path openpgp/Cargo.toml --no-default-features --features crypto-cng,compression --example supported-algorithms - cargo test --manifest-path openpgp/Cargo.toml --no-default-features --features crypto-cng,compression after_script: [] # scriptlet doesn't work on Powershell variables: CFLAGS: "" # Silence some C warnings when compiling with MSVC windows-msvc32-cng: tags: - win - win2019 stage: build # Depend on the main configuration. As the jobs have common error # conditions, if one fails it is often not worth trying the other. # Therefore, we can short-circuit here. Also, this pipelines # Windows jobs, allowing us to test the other toolchain as well. needs: - windows-msvc-cng image: name: registry.gitlab.com/sequoia-pgp/build-docker-image/windows-msvc # Set up a cross compilation environment for building x86 binaries on amd64, line copied from Dockerfile.windows.msvc # see https://renenyffenegger.ch/notes/Windows/dirs/Program-Files-x86/Microsoft-Visual-Studio/version/edition/Common7/Tools/VsDevCmd_bat # # Alternatively: ["C:\\BuildTools\\VC\\Auxiliary\\Build\\vcvarsamd64_x86.bat", "&&", "type", "README", "&&", "powershell.exe", "-NoLogo", "-ExecutionPolicy", "Bypass"] # see https://docs.microsoft.com/en-us/cpp/build/building-on-the-command-line?view=msvc-160 entrypoint: ["C:\\BuildTools\\Common7\\Tools\\VsDevCmd.bat", "-arch=x86", "-host_arch=amd64", "&&", "type", "README", "&&", "powershell.exe", "-NoLogo", "-ExecutionPolicy", "Bypass"] only: variables: # Forks of this project most likely use gitlab's shared windows runners, which # do not use the docker executor, so disable the windows jobs for forks. - $CI_PROJECT_NAMESPACE == "sequoia-pgp" before_script: # We don't call *before_script_start or *before_script_end as we # don't have bash, clang, etc. - rustup default 1.60.0-x86_64-pc-windows-msvc - rustup target add i686-pc-windows-msvc - rustup show - rustc --version --verbose - cargo --version script: # https://github.com/rust-lang/cargo/issues/5015 - cargo test --manifest-path openpgp/Cargo.toml --no-default-features --features crypto-cng,compression --target i686-pc-windows-msvc after_script: [] # scriptlet doesn't work on Powershell variables: CFLAGS: "" # Silence some C warnings when compiling with MSVC docker-build-push: # Official docker image. image: docker:stable stage: build services: - docker:dind tags: - docker - self-hosted before_script: - docker login -u gitlab-ci-token -p $CI_JOB_TOKEN $CI_REGISTRY script: - > docker build --no-cache --target sq --tag "$IMAGE":latest . # smoke test - docker run "$IMAGE":latest --help - docker push "$IMAGE":latest after_script: [] only: refs: - /docker/i # refs containing 'docker' keyword - tags - web - schedules variables: CI_REGISTRY: "registry.gitlab.com" IMAGE: "$CI_REGISTRY/sequoia-pgp/sequoia" DOCKER_HOST: tcp://docker:2376 DOCKER_DRIVER: overlay2 variables: DEBIAN_FRONTEND: noninteractive CARGO_HOME: $CI_PROJECT_DIR/../cargo CARGO_FLAGS: --color always CARGO_INCREMENTAL: 0 RUST_BACKTRACE: full CFLAGS: -Werror MAKE_TOP: make --file=.Makefile QUICKCHECK_GENERATOR_SIZE: 500 # https://github.com/BurntSushi/quickcheck/pull/240