arti/.gitlab-ci.yml

149 lines
4.1 KiB
YAML

stages:
- check
- build
- test
variables:
# We don't need Husky to install the Git hooks for CI.
CARGO_HUSKY_DONT_INSTALL_HOOKS: "true"
check-editorconfig:
stage: check
image: mstruebing/editorconfig-checker
script:
- ec
shellcheck:
stage: check
image: koalaman/shellcheck-alpine
script:
- apk add git
- ./maint/shellcheck_all
rust-latest:
stage: build
image: rust:latest
script:
- rustup show
- cargo build --verbose --target x86_64-unknown-linux-gnu
- cargo test --verbose --target x86_64-unknown-linux-gnu
- rustup component add clippy rustfmt
- rustup show
- cargo clippy --all-features --all-targets -- -D warnings
- cargo fmt -- --check
- cp cargo-audit $CARGO_HOME/bin/ || cargo install cargo-audit
- ./maint/cargo_audit.sh
- cp $CARGO_HOME/bin/cargo-audit .
- cargo build --verbose --release -p arti-bench --target x86_64-unknown-linux-gnu
tags:
- amd64
cache:
paths:
- cargo-audit
artifacts:
paths:
- target/x86_64-unknown-linux-gnu/debug/arti
- target/x86_64-unknown-linux-gnu/release/arti-bench
expire_in: 1 hours
rust-latest-async-std-rustls:
stage: build
image: rust:latest
script:
- rustup show
- rustup component add clippy
- cd crates/arti-client && cargo clippy --no-default-features --features=async-std,rustls
tags:
- amd64
rust-nightly:
stage: build
image: rustlang/rust:nightly
allow_failure: true
script:
- rustup show
- cargo build --verbose --target x86_64-unknown-linux-gnu --all-features
- cargo test --verbose --target x86_64-unknown-linux-gnu --all-features
- rustup component add clippy
# We check these extra warnings on CI only, since we don't want to forbid them while developing.
# The --cfg allows us to write #![cfg_attr(ci_arti_nightly, allow(clippy::needless_borrow))]
# and similar, for when nightly clippy has false positives. (There is no builtin
# cfg flag for nightly, and a cargo "feature" would be bad with --all-features.)
- cargo clippy --all-features --tests -- --cfg ci_arti_nightly -D clippy::dbg_macro -D clippy::print_stdout -D clippy::print_stderr
- RUSTDOCFLAGS="-Dwarnings" cargo doc --all-features --document-private-items
tags:
- amd64
coverage:
stage: test
image: rust:latest
allow_failure: true
variables:
RUSTFLAGS: "-Zinstrument-coverage"
LLVM_PROFILE_FILE: "arti-%p-%m.profraw"
script:
- apt-get update && apt-get install -y python3-pip python3-setuptools
- pip3 install beautifulsoup4 lxml
- rustup toolchain add nightly
- rustup default nightly
- rustup component add llvm-tools-preview
- cargo install grcov
# Generate report
- ./maint/with_coverage.sh cargo test --verbose --all-features
- ./maint/with_coverage.sh -f cobertura -o coverage.xml -c true
artifacts:
paths:
- 'coverage'
reports:
cobertura: coverage.xml
minimal-versions:
stage: test
image: rust:1.53
script:
- rustup install nightly
- ./maint/downgrade_dependencies
- cargo build --verbose --target x86_64-unknown-linux-gnu --all-features
- cargo test --verbose --target x86_64-unknown-linux-gnu --all-features
tags:
- amd64
build-repro:
rules:
- if: $CI_PIPELINE_SOURCE == "schedule"
- if: $CI_PIPELINE_SOURCE == "push" && $CI_COMMIT_TAG != null
stage: build
image: rust:1.54.0-alpine3.14
script:
- ./maint/reproducible_build.sh linux windows macos
artifacts:
paths:
- arti-linux
- arti-windows.exe
- arti-macos
expire_in: 1 day
cache:
paths:
- osxcross/target
tags:
- TPA
- amd64
integration:
stage: test
image: debian:stable-slim
script:
- apt update
- apt install -y tor git python3 curl
- ./tests/chutney/setup.sh
- curl http://example.com -vs --socks5-hostname 127.0.0.1:9150 -o /dev/null
- ./tests/chutney/stop-arti.sh
- RUST_LOG=debug target/x86_64-unknown-linux-gnu/release/arti-bench -c ./chutney/net/nodes/arti.toml --socks5 127.0.0.1:9008 -o benchmark_results.json
- ./tests/chutney/teardown.sh
artifacts:
paths:
- benchmark_results.json
tags:
- amd64