/ .gitlab-ci.yml
.gitlab-ci.yml
  1  stages:
  2    - check
  3    - build
  4    - test
  5    - deploy
  6  
  7  variables:
  8    # We don't need Husky to install the Git hooks for CI.
  9    CARGO_HUSKY_DONT_INSTALL_HOOKS: "true"
 10    # fs-mistrust doesn't like umask 0
 11    FF_DISABLE_UMASK_FOR_DOCKER_EXECUTOR: "true"
 12    # Enable timestamps in job log lines.
 13    FF_TIMESTAMPS: "true"
 14    # Pinned CI image for must Rust tests
 15    # Using "amd64/" single-arch variant to work around https://gitlab.torproject.org/tpo/tpa/team/-/issues/41621.
 16    RECENT_RUST_IMAGE: "amd64/rust:1.83.0-bookworm"
 17    # Pinned chutney version.
 18    # TODO: Consider unpinning once chutney's CI is running arti's CI.
 19    # Alternatively if we decide to keep this, consider to actually start managing
 20    # versions in chutney and using a version tag here.
 21    CHUTNEY_COMMIT: b05403758dc81593256a93a10d896e68e0398fe7
 22  
 23  default:
 24    image:
 25      name: containers.torproject.org/tpo/tpa/base-images/debian:bookworm
 26      docker:
 27        platform: linux/amd64
 28    before_script:
 29      # get section_start and section_end bash functions
 30      - source maint/ci_log_span_fns.sh
 31      # gitlab fetch strategy doesn't reset permissions
 32      - (while [ "$PWD" != / ]; do chmod go-w . && cd ..; done)
 33      # verify that we're running in a container built for amd64.
 34      # See https://gitlab.torproject.org/tpo/tpa/team/-/issues/41621
 35      - |
 36        (
 37        if type dpkg; then
 38          arch="$(dpkg --print-architecture)"
 39          expected=amd64
 40        elif type apk; then
 41          arch="$(apk --print-arch)"
 42          expected=x86_64
 43        else
 44          echo "Couldn't determine userspace build arch"
 45          exit 1
 46        fi
 47        echo "Detected userspace build arch: $arch"
 48        if [ "$arch" != "$expected" ]; then
 49          echo "ERROR: Expected userspace build arch $expected; found $arch";
 50          exit 1;
 51        fi
 52        )
 53      # Put 3rd party cloned source (that we don't want in artifacts) in ~/src
 54      - mkdir -p ~/src
 55      # Support installing software to ~/.local
 56      - mkdir -p ~/.local
 57      - 'export PATH=$HOME/.local/bin:$PATH'
 58  
 59    after_script:
 60      # In every case, if we have a working `cargo` we should clean up
 61      # our target directory before we exit.  (Leaving big hunks of data
 62      # on the builders make our admins sad.)
 63      - if command -v cargo && test -d ./target; then cargo clean; fi
 64  
 65  check-editorconfig:
 66    stage: check
 67    image: mstruebing/editorconfig-checker
 68    script:
 69      - ec
 70  
 71  shellcheck:
 72    stage: check
 73    image: koalaman/shellcheck-alpine
 74    script:
 75      - apk add git bash
 76      - ./maint/common/shellcheck-all
 77  
 78  python3-checks:
 79    stage: check
 80    allow_failure: true
 81    script:
 82      - maint/common/apt-install python3-pip python3-venv git
 83      # AFAICT these python packages do not have debian packages.
 84      #
 85      # (`black` does have a debian package, but we need the latest version.)
 86      #
 87      # (NOTE: We have specific versions of some tools pinned here to avoid
 88      # breakage; we should update them periodically.)
 89      - |
 90        python3 -m venv lint
 91        source lint/bin/activate
 92        pip3 install marko tomli_w types-toml types-PyYAML types-beautifulsoup4 types-requests black==24.4.2 flake8==6.1.0 mypy==1.14.0
 93        ./maint/python-lints
 94  
 95  maint-checks:
 96    stage: check
 97    script:
 98      - maint/common/apt-install git python3-toml python3-requests
 99      - ./maint/check_toposort
100      - ./maint/add_warning --check
101      - ./maint/common/forbid-absolute-shebangs
102      - ./maint/common/forbid-script-extensions
103      - ./maint/common/update-shell-includes --check --all
104      - ./maint/cargo-check-publishable
105  
106  maint-check-changelog:
107    stage: test
108    script:
109      - maint/common/apt-install python3-mistune git
110      - git fetch --unshallow $ORIGIN
111      - ./maint/update-md-links --check CHANGELOG.md
112  
113  maint-check-ownership:
114    stage: test
115    allow_failure: true
116    script:
117      - maint/common/apt-install python3-toml curl jq
118      - ./maint/cargo-crate-owners
119    rules:
120      # Don't impede MR work when this goes wrong.
121      # Also, avoid running it for tags, because that would make the release tag
122      # (run right after tagging) CI fail, before the release technician has had
123      # a chance to run `cargo add`.
124      - if: $CI_COMMIT_BRANCH == "main"
125  
126  maint-check-cbindgen:
127    stage: test
128    # cbindgen needs nightly rust to do macro expansion
129    image: rustlang/rust:nightly
130    script:
131      - ./maint/common/apt-install python3-toml
132      - ./maint/common/via-cargo-install-in-ci cbindgen --version 0.27.0
133      - ./maint/cbindgen --check
134  
135  # non-blocking for now, see
136  #      https://gitlab.torproject.org/tpo/core/arti/-/issues/581
137  #      https://gitlab.torproject.org/tpo/core/arti/-/issues/601
138  doc-features:
139    stage: check
140    allow_failure: true
141    script:
142      - maint/common/apt-install python3-toml
143      - ./maint/check_doc_features
144  
145  # This should always be in the last testing stage, so that if it fails all the other steps still run
146  # But it should run before any deployument.
147  blocking-todos:
148    stage: test
149    needs: []
150    script:
151      - maint/common/apt-install git
152      - ./maint/check_todos
153  
154  rust-checks:
155    # This is too slow (and the cacheing of the "cargo build" too flaky) to be a "check"
156    stage: build
157    image: $RECENT_RUST_IMAGE
158    script:
159      - rustup show
160      - rustup component add rustfmt
161      - ./maint/common/via-cargo-install-in-ci cargo-sort
162      - ./maint/common/via-cargo-install-in-ci cargo-license
163      - cargo fmt -- --check
164      - ./maint/check_licenses
165      - ./maint/cargo_sort
166      - ./maint/check_tree
167      - ./maint/check_all_lockfiles
168      - ./maint/common/forbid-hard-tabs
169    cache:
170      paths:
171        - cache
172  
173  cargo-audit:
174    # This can start to fail even when our code doesn't change.
175    # Usually the new advisory is not a huge concern.
176    # Run it last, separately, so if we think we may want to merge anyway,
177    # all the other tests will have been run.
178    stage: test
179    image: $RECENT_RUST_IMAGE
180    script:
181      - rustup show
182      - ./maint/common/via-cargo-install-in-ci cargo-audit
183      - ./maint/cargo_audit
184    cache:
185      paths:
186        - cache
187  
188  # For use with YAML anchor.  See
189  #   https://docs.gitlab.com/ee/ci/yaml/yaml_optimization.html#yaml-anchors-for-scripts
190  .rust-recent-template:
191    script: &rust-recent-script
192      - rustup show
193  
194      - section_start "cargo check"
195      - cargo check --locked --verbose --target x86_64-unknown-linux-gnu
196  
197      - section_start "cargo test"
198      - cargo test --verbose --target x86_64-unknown-linux-gnu
199  
200      - section_start "cargo clippy"
201      - rustup component add clippy
202      - rustup show
203      - ./maint/add_warning --ci-stable
204      - cargo clippy --all-features --all-targets -- -D warnings
205  
206      - section_start "build arti-bench"
207      - cargo build --verbose --release -p arti-bench --target x86_64-unknown-linux-gnu
208  
209      - section_start "build arti"
210      - cargo build --locked --verbose --target x86_64-unknown-linux-gnu -p arti
211  
212      - section_start "build docs"
213      - RUSTDOCFLAGS="-Dwarnings" cargo doc --all-features --document-private-items --no-deps
214      - section_end
215  
216  rust-recent:
217    stage: build
218    image: $RECENT_RUST_IMAGE
219    script:
220      - *rust-recent-script
221      - ./maint/preserve target/x86_64-unknown-linux-gnu/debug/arti target/x86_64-unknown-linux-gnu/release/arti-bench
222    artifacts:
223      paths:
224        - artifacts
225      expire_in: 1 hours
226  
227  rust-latest:
228    stage: test
229    # Using "amd64/" single-arch variant to work around https://gitlab.torproject.org/tpo/tpa/team/-/issues/41621.
230    image: amd64/rust:bookworm
231    rules:
232      - if: $CI_COMMIT_BRANCH == "main"
233    script:
234      - *rust-recent-script
235  
236  .rust-recent-arti-extra-features-template:
237    script: &rust-recent-arti-extra-features-script
238      - rustup show
239      # Build the arti binary for use in chutney and shadow integration tests.
240      #
241      # Note: we enable the `experimental-api` feature instead of `experimental`,
242      # because we don't want to build with `rpc` enabled. The `rpc` feature causes
243      # the RPC listener to try to bind to a Unix domain socket, and pathname Unix
244      # domain sockets are not currently supported by shadow.
245      #
246      # Consider enabling the rpc feature when shadow starts supporting pathname
247      # addresses, or when we add a config setting for disabling rpc.
248      #
249      # Note: `-p arti` is *not* already implied by `--bin arti`. If we omit it,
250      # we'll get the union of all features needed by anything in the workspace,
251      # including examples.
252      - cargo build --verbose
253        --target x86_64-unknown-linux-gnu
254        -p arti -p tor-circmgr
255        --bin arti
256        --features full,restricted-discovery,arti-client/keymgr,tor-circmgr/ntor_v3,onion-service-service,vanguards,ctor-keystore
257  
258  rust-recent-arti-extra-features:
259    stage: build
260    image: $RECENT_RUST_IMAGE
261    script:
262      - *rust-recent-arti-extra-features-script
263      - ./maint/preserve target/x86_64-unknown-linux-gnu/debug/arti
264      # Save the full-featured binary under a different name to prevent it from being
265      # overwritten by the other jobs that preserve the arti binary.
266      - mv artifacts/target/x86_64-unknown-linux-gnu/debug/arti artifacts/target/x86_64-unknown-linux-gnu/debug/arti-extra
267    artifacts:
268      paths:
269        - artifacts
270      expire_in: 1 hours
271  
272  rust-latest-arti-extra-features:
273    stage: test
274    # Using "amd64/" single-arch variant to work around https://gitlab.torproject.org/tpo/tpa/team/-/issues/41621.
275    image: amd64/rust:bookworm
276    rules:
277      - if: $CI_COMMIT_BRANCH == "main"
278    script:
279      - *rust-recent-arti-extra-features-script
280  
281  rust-recent-async-std-rustls:
282    stage: build
283    image: $RECENT_RUST_IMAGE
284    script:
285      - rustup show
286      - rustup component add clippy
287      - cd crates/arti-client && cargo clippy --no-default-features --features=async-std,rustls
288  
289  rust-clippy-nontest:
290    stage: test
291    image: $RECENT_RUST_IMAGE
292    script:
293      - rustup show
294      - rustup component add clippy
295      - mv -f clippy-nontest.toml clippy.toml
296      - cargo clippy --all-features --workspace -- -D warnings
297  
298  rust-nightly:
299    stage: test
300    image: rustlang/rust:nightly
301    # In case there is a bug in rust:nightly, you can instead pin an older
302    # version of the Docker image until that bug is fixed.  To find the
303    # SHA256 ID of the last working version of nightly, look at the logs
304    # from the last successful CI run.  Here is an example of how to do so:
305    #
306    # image: rustlang/rust@sha256:415b7c22ab4a8a3ec3efc9cc8d7b018964f0c6757fff27bbd110e0ed92566321
307    allow_failure: true
308    script:
309      - rustup show
310      - cargo build --verbose --target x86_64-unknown-linux-gnu --all-features
311      - cargo test --verbose --target x86_64-unknown-linux-gnu --all-features
312      - rustup component add clippy
313      # We check these extra warnings on CI only, since we don't want to forbid them while developing.
314  
315      - (echo; cat clippy-nightly.toml) >>clippy.toml
316      - ./maint/add_warning --ci-nightly
317      - cargo clippy --all-features --tests -- -D clippy::dbg_macro
318      - RUSTDOCFLAGS="-Dwarnings --cfg docsrs" cargo doc --all-features --document-private-items --no-deps
319  
320  deb-source:
321    stage: test
322    image: $RECENT_RUST_IMAGE
323    script:
324      - git clean -xdff
325      - export DEB_VERSION_UPSTREAM=$(dpkg-parsechangelog -SVersion | sed -E 's/-[^-]*$$//')
326      - git archive -o ../arti_${DEB_VERSION_UPSTREAM}.orig.tar.gz --prefix arti-${DEB_VERSION_UPSTREAM}/ HEAD
327      - dpkg-source -b .
328      - mv ../arti*.tar.gz ../arti*.dsc ../arti*.tar.xz .
329    artifacts:
330      paths:
331        - "*.tar.gz"
332        - "*.dsc"
333        - "*.tar.xz"
334  
335  deb-binary-amd64:
336    stage: test
337    image: $RECENT_RUST_IMAGE
338    script:
339      - apt-get update && apt-get build-dep -y .
340      # TODO: re-enable testing (tests are currently killed for some unidentified reason)
341      - dpkg-buildpackage -uc -b --build-profiles=nocheck
342      - mv ../arti*.deb ../*.changes ../*.buildinfo .
343    artifacts:
344      paths:
345        - "*.deb"
346        - "*.changes"
347        - "*.buildinfo"
348    tags:
349      - amd64
350  
351  # Note: big-endian targets do not compile due to lack of support from the merlin
352  # crate, needed by the 'batch' feature of ed25519-dalek. A fix seems available
353  # (https://github.com/zkcrypto/merlin/pull/5) and forking merlin was discussed
354  # by the developers of ed25519-dalek (https://github.com/dalek-cryptography/ed25519-dalek/issues/228).
355  .deb-binary-cross-template:
356    stage: test
357    variables:
358      # To be overridden in template instantiations
359      CROSS_ARCH: UNDEFINED--BUG-IN-CI-YAML
360      RUST_CROSS_TARGET: UNDEFINED--BUG-IN-CI-YAML
361    image: $RECENT_RUST_IMAGE
362    script:
363      - dpkg --add-architecture ${CROSS_ARCH}
364      - maint/common/apt-install build-essential crossbuild-essential-${CROSS_ARCH} && apt-get build-dep -y -a${CROSS_ARCH} .
365      - rustup target add ${RUST_CROSS_TARGET}
366      - CONFIG_SITE=/etc/dpkg-cross/cross-config.${CROSS_ARCH} dpkg-buildpackage -uc -b -a${CROSS_ARCH} --build-profiles=cross,nocheck
367      - mv ../arti*.deb ../*.changes ../*.buildinfo .
368    artifacts:
369      paths:
370        - "*.deb"
371        - "*.changes"
372        - "*.buildinfo"
373    tags:
374      - amd64
375  
376  deb-binary-arm64:
377    extends: .deb-binary-cross-template
378    variables:
379      CROSS_ARCH: arm64
380      RUST_CROSS_TARGET: aarch64-unknown-linux-gnu
381  
382  cargo-miri:
383    stage: test
384    # for local testing,
385    #   rustup toolchain add nightly-2024-10-08
386    #   rustup component add --toolchain nightly-2024-10-08 miri
387    #   cargo +nightly-2024-10-08 miri setup
388    #   cargo +nightly-2024-10-08 miri test ...
389    # to update this
390    #  1. choose a new Nightly version, for example according to these instructions
391    #      https://gitlab.torproject.org/Diziet/rust-derive-deftly/-/blob/main/macros/HACKING.md?ref_type=heads#choosing-which-nightly-rust-version-to-update-to
392    #  2. insert the new image hash, and corresponding nightly date, above
393    image: rustlang/rust@sha256:b68e38306c8c67d7c95b88e99e75aeef3610e533ea69f64749e1adce818cf2e1
394    # ^ this is from tags.2024-10-08T13:08+00:00.gz (see HACKING.md)
395    script:
396      - rustup component add miri
397      # TOOD use miri test more of our crates-containing-unsafe
398      - cargo miri test --all-features -p tor-memquota -p tor-rtcompat -p tor-rtmock -p tor-persist
399  
400  coverage:
401    rules:
402      - if: $CI_PIPELINE_SOURCE == "schedule"
403    stage: test
404    image: $RECENT_RUST_IMAGE
405    script:
406      - maint/common/apt-install python3-pip python3-setuptools python3-bs4 python3-lxml
407      - rustup component add llvm-tools
408      - ./maint/common/via-cargo-install-in-ci grcov
409      # Generate report
410      - ./maint/with_coverage -f cobertura -o coverage.xml cargo test --verbose --all-features
411    cache:
412      paths:
413        - cache
414    artifacts:
415      reports:
416        coverage_report:
417          coverage_format: cobertura
418          path: coverage.xml
419    tags:
420      - tpa
421  
422  minimal-versions:
423    stage: test
424    # Using "amd64/" single-arch variant to work around https://gitlab.torproject.org/tpo/tpa/team/-/issues/41621.
425    image: amd64/rust:1.77
426    needs: ["rust-checks"]
427    script:
428      - rustup install nightly
429      - ./maint/downgrade_dependencies
430      - cargo test --verbose --target x86_64-unknown-linux-gnu --all-features
431  
432  .build-repro-template:
433    stage: test
434    variables:
435      # To be overridden in template instantiations
436      TARGET: UNDEFINED--BUG-IN-CI-YAML
437    # If you upgrade this image, also change the one in docker_reproducible_build.
438    # Using "amd64/" single-arch variant to work around https://gitlab.torproject.org/tpo/tpa/team/-/issues/41621.
439    image: amd64/rust:1.77.0-alpine3.18
440    script:
441      - apk add bash
442      - ./maint/reproducible_build $TARGET
443    # no after_script:, we don't build in the project dir
444    # TODO #1410: Maybe there is something we _can_ remove though?
445    artifacts:
446      expire_in: 1 day
447    tags:
448      - tpa
449      - amd64
450  
451  build-repro-linux:
452    extends: .build-repro-template
453    variables:
454      TARGET: linux
455    artifacts:
456      paths:
457        - arti-linux
458  
459  build-repro-windows:
460    extends: .build-repro-template
461    variables:
462      TARGET: windows
463    artifacts:
464      paths:
465        - arti-windows.exe
466  
467  build-repro-macos:
468    extends: .build-repro-template
469    variables:
470      TARGET: macos
471    artifacts:
472      paths:
473        - arti-macos
474    cache:
475      paths:
476        - osxcross/target
477  
478  # We use shadow in multiple tests. Build it here once.
479  build-shadow:
480    stage: build
481    variables:
482      JOB_SHADOW_REPO: "https://github.com/shadow/shadow.git"
483      JOB_SHADOW_BRANCH: "main"
484      # This commit has not-yet-released support for running scripts directly and
485      # for improved logging in the CI.
486      JOB_SHADOW_COMMIT: "4a1d8ac8d83266be2afa1f0c34fdc8a486688031"
487    artifacts:
488      paths:
489        - opt/shadow
490      # Intended for consumption later in the pipeline; no need to keep them
491      # around for longer.
492      expire_in: 1 day
493    cache:
494      - key: $CI_JOB_NAME-shadow-$JOB_SHADOW_COMMIT
495        paths:
496        - opt/shadow
497    tags:
498      - amd64
499    script:
500      # Build shadow
501      - |
502        if [ -f opt/shadow/bin/shadow ]
503        then
504          echo "Using shadow binary from cache"
505        else
506          echo "Building shadow"
507          maint/common/apt-install git
508          git clone --shallow-since=2021-08-01 -b $JOB_SHADOW_BRANCH $JOB_SHADOW_REPO ~/src/shadow
509          cd ~/src/shadow
510          git checkout $JOB_SHADOW_COMMIT
511          export CC=gcc CXX=g++ CONTAINER=debian:12-slim BUILDTYPE=release RUSTPROFILE=minimal
512          ci/container_scripts/install_deps.sh
513          ci/container_scripts/install_extra_deps.sh
514          export PATH="$HOME/.cargo/bin:${PATH}"
515          ./setup build --jobs $(nproc) --prefix $CI_PROJECT_DIR/opt/shadow
516          ./setup install
517        fi
518  
519  integration-chutney:
520    stage: test
521    rules:
522     # Job never runs.  See arti#810.
523     - when: never
524    script:
525      - ./maint/preserve -u
526      - maint/common/apt-install tor git python3 curl dnsutils python3-pip python3-venv
527  
528      # arti runtime dependencies
529      - maint/common/apt-install libsqlite3-0 libssl3
530  
531      # install chutney.
532      - python3 -m venv --system-site-packages $HOME/job-venv
533      - source $HOME/job-venv/bin/activate
534      - python3 -m pip install
535          git+https://gitlab.torproject.org/tpo/core/chutney.git@"$CHUTNEY_COMMIT"
536  
537      - tests/chutney/integration-e2e
538    artifacts:
539      paths:
540        - benchmark_results.json
541  
542  # Runs the chutney integration test under shadow.
543  integration-chutney-shadow:
544    stage: test
545    tags:
546      - amd64
547      # Non-TPA runners may not support running shadow.
548      - tpa
549    script:
550      - ./maint/preserve -u
551      - maint/common/apt-install
552          tor
553          git
554          python3
555          curl
556          dnsutils
557          stow
558          python3-yaml
559          python3-pip
560          python3-venv
561  
562      # arti runtime dependencies
563      - maint/common/apt-install libsqlite3-0 libssl3
564  
565      # install chutney.
566      - python3 -m venv --system-site-packages $HOME/job-venv
567      - source $HOME/job-venv/bin/activate
568      - python3 -m pip install
569          git+https://gitlab.torproject.org/tpo/core/chutney.git@"$CHUTNEY_COMMIT"
570  
571      # Set up shadow, built in build-shadow
572      - maint/common/apt-install libglib2.0-0
573      - stow -d opt -t $HOME/.local shadow
574  
575      - tests/chutney/integration-e2e-shadow
576    artifacts:
577      paths:
578        - benchmark_results.json
579        - shadow.chutney.yaml
580        - shadow.chutney.data/
581        - shadow.log
582      when: always
583      expire_in: 1 week
584  
585  integration-shadow:
586    variables:
587      JOB_TGEN_REPO: "https://github.com/shadow/tgen.git"
588      JOB_TGEN_BRANCH: "main"
589      JOB_TGEN_COMMIT: "v1.1.2"
590    stage: test
591    cache:
592      - key: $CI_JOB_NAME-shadow-$JOB_SHADOW_COMMIT
593        paths:
594        - opt/shadow
595      - key: $CI_JOB_NAME-tgen-$JOB_TGEN_COMMIT
596        paths:
597        - opt/tgen
598    script:
599      - ./maint/preserve -u
600  
601      - section_start "Install utility packages"
602      - maint/common/apt-install git tor obfs4proxy stow tshark
603  
604      - section_start "Install arti runtime dependencies"
605      - maint/common/apt-install libsqlite3-0 libssl3
606  
607      - section_start "Set up shadow, built in build-shadow"
608      - maint/common/apt-install libglib2.0-0
609      - stow -d opt -t $HOME/.local shadow
610  
611      - section_start "Setup tgen"
612      - |
613        if [ -f opt/tgen/bin/tgen ]
614        then
615          echo "Using tgen binary from cache"
616        else
617          echo "Building tgen"
618          maint/common/apt-install cmake gcc libglib2.0-0 libglib2.0-dev libigraph-dev make
619          git clone --shallow-since=2022-01-01 -b $JOB_TGEN_BRANCH $JOB_TGEN_REPO ~/src/tgen
620          pushd ~/src/tgen
621          git checkout $JOB_TGEN_COMMIT
622          mkdir build
623          cd build
624          cmake .. -DCMAKE_INSTALL_PREFIX=$CI_PROJECT_DIR/opt/tgen
625          make --jobs $(nproc)
626          make install
627          popd
628        fi
629      - maint/common/apt-install libigraph3 libglib2.0-0
630      - stow -d opt -t $HOME/.local tgen
631  
632      # Ensure newly installed executables can be found
633      - hash -r
634  
635      - section_start "Run shadow test"
636      - pushd tests/shadow
637      - ./run
638      - section_end
639    artifacts:
640      paths:
641        - tests/shadow
642      when: always
643      expire_in: 1 week
644    tags:
645      - amd64
646      # Non-TPA runners may not support running shadow.
647      - tpa
648  
649  rust-recent-test-all-features:
650    stage: test
651    image: $RECENT_RUST_IMAGE
652    script:
653      - rustup show
654      - cargo test --target x86_64-unknown-linux-gnu --locked --workspace --all-features
655  
656  every-crate:
657    stage: test
658    image: $RECENT_RUST_IMAGE
659    needs: ["rust-checks", "rust-recent-async-std-rustls"]
660    script:
661      - maint/common/apt-install python3-toml
662      - ./maint/every-crate
663  
664  matrix-check:
665    stage: test
666    image: $RECENT_RUST_IMAGE
667    needs: ["rust-checks", "rust-recent-async-std-rustls"]
668    script:
669      - maint/common/apt-install python3-toml
670      - ./maint/matrix-check
671  
672  minimal-features-test:
673    stage: test
674    image: $RECENT_RUST_IMAGE
675    script:
676      # See crates/arti/build.rs.  Here, rather than in `variables:`, so it appears in the log.
677      - export RUSTFLAGS="$RUSTFLAGS --cfg arti_features_precise"
678      - maint/common/apt-install python3-toml
679      - maint/test-all-crates --enable-conditional-options=minimal -- --target x86_64-unknown-linux-gnu --no-default-features
680  
681  matrix-test-cfg:
682    stage: test
683    image: $RECENT_RUST_IMAGE
684    script:
685      - ./maint/matrix_test_cfg
686  
687  # TODO: consider removing this in favor of cli-test
688  cli-help:
689    stage: test
690    image: $RECENT_RUST_IMAGE
691    script:
692      - ./maint/check-cli-help
693  
694  # TODO: this should be folded in one of the other test jobs.
695  #
696  # Since this is testing an additional combination of features,
697  # ideally it would be handled by the matrix_test script,
698  # but matrix_test runs cargo check, and we would like to cargo *test*.
699  cli-test:
700    stage: test
701    image: $RECENT_RUST_IMAGE
702    script:
703      # The rust-latest job runs the CLI tests with all features enabled.
704      # This job runs the CLI tests with various feature combinations that aren't
705      # covered by the other tests
706      - cargo test --verbose --target x86_64-unknown-linux-gnu -p arti cli_tests
707      - cargo test --verbose --target x86_64-unknown-linux-gnu -p arti --features experimental cli_tests
708  
709  coverage-aggregated:
710    rules:
711      - if: $CI_PIPELINE_SOURCE == "schedule"
712    stage: test
713    image: $RECENT_RUST_IMAGE
714    needs: []
715    script:
716      - maint/common/apt-install tor python3 python3-pip python3-setuptools curl python3-bs4 python3-lxml
717      - rustup component add llvm-tools
718      - ./maint/common/via-cargo-install-in-ci grcov
719      # Generate report
720      - ./maint/coverage unit
721    cache:
722      paths:
723        - cache
724    artifacts:
725      paths:
726        - coverage
727    tags:
728      - ipv6
729  
730  check-targets:
731    rules:
732      - if: $CI_PIPELINE_SOURCE == "schedule"
733    stage: test
734    image: $RECENT_RUST_IMAGE
735    script:
736      - ./maint/cargo_check_target -il
737  
738  pages:
739    rules:
740      - if: $CI_PIPELINE_SOURCE == "schedule" && $CI_COMMIT_REF_NAME == "main"
741    stage: deploy
742    script:
743      - maint/common/apt-install git
744      # Export report as website, while keeping the existing public page
745      - git fetch
746      - git checkout origin/pages -- public/
747      - mv coverage public/
748    artifacts:
749      paths:
750        - public