dvn/new-ci
Neal H. Walfield 10 months ago
parent 7fad1eca11
commit eeee86aa65
  1. 7
      .cargo/config.toml
  2. 34
      .ci/all_commits.sh
  3. 4
      .ci/snippet_for_cross_compilation_config.toml
  4. 3
      .codespellrc
  5. 218
      .gitlab-ci.yml
  6. 3
      Cargo.toml

@ -0,0 +1,7 @@
[target.'cfg(all())']
# Note: if the RUSTFLAGS environment variable is set, this will be
# ignored.
rustflags = [
"-Dwarnings",
"-Aunused-parens",
]

@ -0,0 +1,34 @@
#!/usr/bin/env bash
# Test all commits on this branch but the last one.
#
# Used in the all_commits ci job to ensure all commits build
# and tests pass at least for the sequoia-openpgp crate.
# NOTE: under gitlab's Settings, "CI/CD", General Pipelines ensure
# that the "git shallow clone" setting is set to 0. Otherwise other
# branch are not fetched.
set -e
set -x
# Use dummy identity to make git rebase happy.
git config user.name "C.I. McTestface"
git config user.email "ci.mctestface@example.com"
# If the previous commit already is on main we're done.
git merge-base --is-ancestor HEAD~ origin/main &&
echo "All commits tested already" &&
exit 0
# Leave out the last commit - it has already been checked.
git checkout HEAD~
git status
git rebase origin/main \
--exec 'echo ===; echo ===; echo ===; git log -n 1;' \
--exec 'cargo test --all' &&
echo "All commits passed tests" &&
exit 0
# The rebase failed - probably because a test failed.
git rebase --abort; exit 1

@ -0,0 +1,4 @@
[target.armv7-unknown-linux-gnueabihf]
linker = "arm-linux-gnueabihf-gcc"
runner = "qemu-arm"

@ -0,0 +1,3 @@
[codespell]
skip = *.bin,*.gpg,*.pgp,./.git,data,highlight.js,*/target,Makefile,*.html,*/cargo,*.xml,*.xmlv2,
ignore-words-list = crate,ede,iff,mut,nd,te,uint,KeyServer,keyserver,Keyserver,keyservers,Keyservers,keypair,keypairs,KeyPair,fpr,dedup,ba,

@ -0,0 +1,218 @@
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
needs:
- codespell
script:
- cargo test
variables:
CARGO_TARGET_DIR: /target
CARGO_HOME: /cargo
after_script: []
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"]
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:
- codespell --config .codespellrc --summary
after_script: []
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 test
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
- rm rust-toolchain
- *before_script_end
script:
- cargo test
variables:
CARGO_TARGET_DIR: /target
CARGO_HOME: /cargo
CARGO_FLAGS: --target=armv7-unknown-linux-gnueabihf
PKG_CONFIG_PATH: /usr/lib/arm-linux-gnueabihf/pkgconfig
PKG_CONFIG_ALLOW_CROSS: 1
windows-gnu:
tags:
- win
- win2019
stage: build
image: registry.gitlab.com/sequoia-pgp/build-docker-image/windows-gnu
# This job takes ~20 minutes to run, let's only execute it manually or for
# scheduled builds, otherwise this will stall MRs often not related to Windows
only:
refs:
- /windows/i # refs containing 'windows' keyword
- tags
- web
- schedules
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"
script:
- cargo test
# https://github.com/rust-lang/cargo/issues/5015
- cargo test --manifest-path Cargo.toml --no-default-features --features crypto-cng
after_script: []
variables:
CFLAGS: "" # Silence some C warnings when compiling under Windows
windows-msvc:
tags:
- win
- win2019
stage: build
image: registry.gitlab.com/sequoia-pgp/build-docker-image/windows-msvc
only:
refs:
- /windows/i # refs containing 'windows' keyword
- tags
- web
- schedules
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.
- rustc --version --verbose
- cargo --version
script:
# https://github.com/rust-lang/cargo/issues/5015
- cargo test --manifest-path Cargo.toml --no-default-features --features crypto-cng
after_script: []
variables:
CFLAGS: "" # Silence some C warnings when compiling with MSVC
windows-msvc-32:
tags:
- win
- win2019
stage: build
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.
- rm rust-toolchain
- rustup default 1.56.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 Cargo.toml --no-default-features --features crypto-cng --target i686-pc-windows-msvc
after_script: []
variables:
CFLAGS: "" # Silence some C warnings when compiling with MSVC
variables:
DEBIAN_FRONTEND: noninteractive
CARGO_HOME: $CI_PROJECT_DIR/../cargo
CARGO_FLAGS: --color always
CARGO_INCREMENTAL: 0
RUST_BACKTRACE: full
CFLAGS: -Werror
QUICKCHECK_GENERATOR_SIZE: 500 # https://github.com/BurntSushi/quickcheck/pull/240

@ -17,10 +17,7 @@ maintenance = { status = "actively-developed" }
[dependencies]
anyhow = "1"
backtrace = "0.3.61"
buffered-reader = "1"
chrono = "0.4"
configparser = "2"
csv = "1.1"
enumber = "0.3"
lazy_static = "1"
libc = "0.2"

Loading…
Cancel
Save