summaryrefslogtreecommitdiff
path: root/.gitlab-ci.yml
blob: 1147815125590a445d8ff7de2b1f937859361dca (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
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 --locked --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
    - 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: test
  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 --no-deps
  tags:
    - amd64

coverage:
  stage: test
  image: rust:latest
  script:
    - apt-get update && apt-get install -y python3-pip python3-setuptools
    - pip3 install beautifulsoup4 lxml
    - rustup component add llvm-tools-preview
    - cp grcov $CARGO_HOME/bin/ || cargo install grcov
    - cp $CARGO_HOME/bin/grcov .
    # Generate report
    - ./maint/with_coverage cargo test --verbose --all-features
    - ./maint/with_coverage -f cobertura -o coverage.xml -c true
  cache:
    paths:
      - grcov
  artifacts:
    paths:
      - 'coverage'
    reports:
      cobertura: coverage.xml

minimal-versions:
  stage: test
  image: rust:1.56
  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
  # If you upgrade this image, also change the one in docker_reproducible_build
  image: rust:1.59.0-alpine3.15
  script:
    - ./maint/reproducible_build 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 dnsutils
    - ./tests/chutney/setup proxy
    - ./tests/chutney/test
    - ./tests/chutney/stop-arti
    - 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
  artifacts:
    paths:
      - benchmark_results.json
  tags:
    - amd64