Skip to content

Commit 2c9297d

Browse files
committed
Rework Toolchain model and drop relative file path overrides
Relative path overrides permit a freshly downloaded source tree to execute arbitrary code on any rustup command that executes a binary from the configured toolchain, and its a reasonable tradeoff for us to remove this feature. Absolute path overrides are kept intact - these were added to support users of large monorepo tool systems, and can be kept with reasonable safety. Introduce an interior model for toolchain names which allows the elimination of conditional code for custom vs named vs path based toolchains. Fixes #3130. Finishes the separation of Toolchain vs DistributableToolchain vs CustomToolchain started some time ago. Moves some test support into the src tree in order to keep symbols private and adds a 'test' feature required for self-testing, ensuring that that code doesn't affect production builds. Changes the CI debug builds to use the new test feature and also otel, so that otel doesn't bitrot.
1 parent 4b29b79 commit 2c9297d

File tree

73 files changed

+3663
-2449
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

73 files changed

+3663
-2449
lines changed

.github/workflows/all-features.yaml

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
name: AllFeatures (PR)
2+
3+
# This is an additional workflow to test building with all feature combinations.
4+
# Unlike our main workflows, this doesn't self-test the rustup install scripts,
5+
# nor run on the rust docker images. This permits a smaller workflow without the
6+
# templating and so on.
7+
8+
on:
9+
pull_request:
10+
branches:
11+
- "*"
12+
- renovate/*
13+
14+
jobs:
15+
build:
16+
name: Build
17+
runs-on: ubuntu-latest
18+
strategy:
19+
fail-fast: false
20+
matrix:
21+
# Might add more targets in future.
22+
target:
23+
- x86_64-unknown-linux-gnu
24+
steps:
25+
- name: Clone repo
26+
uses: actions/checkout@v3
27+
- name: Install rustup stable
28+
run: rustup toolchain install stable --profile minimal
29+
- name: Install Protoc
30+
uses: arduino/setup-protoc@v1
31+
with:
32+
version: "3.x"
33+
- name: Set environment variables appropriately for the build
34+
run: |
35+
echo "$HOME/.cargo/bin" >> $GITHUB_PATH
36+
echo "TARGET=${{ matrix.target }}" >> $GITHUB_ENV
37+
- name: Cache Cargo
38+
uses: Swatinem/rust-cache@v2
39+
- name: Install cargo-all-features
40+
run: cargo install cargo-all-features --git https://github.com/rbtcollins/cargo-all-features.git
41+
- name: Ensure we have our goal target installed
42+
run: |
43+
rustup target install "$TARGET"
44+
- name: Build every combination
45+
run: |
46+
cargo check-all-features --root-only

.github/workflows/centos-fmt-clippy-on-all.yaml

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,8 @@ jobs:
2222
strategy:
2323
fail-fast: false
2424
steps:
25-
- uses: actions/checkout@v3
25+
- name: Clone repo
26+
uses: actions/checkout@v3
2627
with:
2728
# v2 defaults to a shallow checkout, but we need at least to the previous tag
2829
fetch-depth: 0
@@ -71,6 +72,10 @@ jobs:
7172
run: |
7273
rustup component add rustfmt
7374
rustup component add clippy
75+
- name: Install Protoc
76+
uses: arduino/setup-protoc@v1
77+
with:
78+
version: '3.x'
7479
- name: Run the centos check within the docker image
7580
run: |
7681
docker run \
@@ -91,6 +96,6 @@ jobs:
9196
cargo fmt --all --check
9297
- name: Run cargo check and clippy
9398
run: |
94-
cargo check --all --all-targets
99+
cargo check --all --all-targets --features test
95100
git ls-files -- '*.rs' | xargs touch
96-
cargo clippy --all --all-targets
101+
cargo clippy --all --all-targets --features test

.github/workflows/linux-builds-on-master.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,10 @@ jobs:
9898
echo "DOCKER=$DOCKER" >> $GITHUB_ENV
9999
- name: Fetch the docker
100100
run: bash ci/fetch-rust-docker.bash "${TARGET}"
101+
- name: Install Protoc
102+
uses: arduino/setup-protoc@v1
103+
with:
104+
version: '3.x'
101105
- name: Maybe build a docker from there
102106
run: |
103107
if [ -f "ci/docker/$DOCKER/Dockerfile" ]; then

.github/workflows/linux-builds-on-pr.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,10 @@ jobs:
9292
echo "DOCKER=$DOCKER" >> $GITHUB_ENV
9393
- name: Fetch the docker
9494
run: bash ci/fetch-rust-docker.bash "${TARGET}"
95+
- name: Install Protoc
96+
uses: arduino/setup-protoc@v1
97+
with:
98+
version: '3.x'
9599
- name: Maybe build a docker from there
96100
run: |
97101
if [ -f "ci/docker/$DOCKER/Dockerfile" ]; then

.github/workflows/linux-builds-on-stable.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,10 @@ jobs:
121121
echo "DOCKER=$DOCKER" >> $GITHUB_ENV
122122
- name: Fetch the docker
123123
run: bash ci/fetch-rust-docker.bash "${TARGET}"
124+
- name: Install Protoc
125+
uses: arduino/setup-protoc@v1
126+
with:
127+
version: '3.x'
124128
- name: Maybe build a docker from there
125129
run: |
126130
if [ -f "ci/docker/$DOCKER/Dockerfile" ]; then

.github/workflows/windows-builds-on-master.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -113,9 +113,9 @@ jobs:
113113
TARGET: ${{ matrix.target }}
114114
# os-specific code leads to lints escaping if we only run this in one target
115115
run: |
116-
cargo check --all --all-targets
116+
cargo check --all --all-targets --features test
117117
git ls-files -- '*.rs' | xargs touch
118-
cargo clippy --workspace --all-targets
118+
cargo clippy --workspace --all-targets --features test
119119
- name: Upload the built artifact
120120
if: matrix.mode == 'release'
121121
uses: actions/upload-artifact@v3

.github/workflows/windows-builds-on-pr.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -107,9 +107,9 @@ jobs:
107107
TARGET: ${{ matrix.target }}
108108
# os-specific code leads to lints escaping if we only run this in one target
109109
run: |
110-
cargo check --all --all-targets
110+
cargo check --all --all-targets --features test
111111
git ls-files -- '*.rs' | xargs touch
112-
cargo clippy --workspace --all-targets
112+
cargo clippy --workspace --all-targets --features test
113113
- name: Upload the built artifact
114114
if: matrix.mode == 'release'
115115
uses: actions/upload-artifact@v3

.github/workflows/windows-builds-on-stable.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -116,9 +116,9 @@ jobs:
116116
TARGET: ${{ matrix.target }}
117117
# os-specific code leads to lints escaping if we only run this in one target
118118
run: |
119-
cargo check --all --all-targets
119+
cargo check --all --all-targets --features test
120120
git ls-files -- '*.rs' | xargs touch
121-
cargo clippy --workspace --all-targets
121+
cargo clippy --workspace --all-targets --features test
122122
- name: Upload the built artifact
123123
if: matrix.mode == 'release'
124124
uses: actions/upload-artifact@v3

CONTRIBUTING.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
1. Fork it!
44
2. Create your feature branch: `git checkout -b my-new-feature`
5-
3. Test it: `cargo test`
5+
3. Test it: `cargo test --features=test`
66
4. Lint it: `cargo +beta clippy --all --all-targets -- -D warnings`
77
> We use `cargo clippy` to ensure high-quality code and to enforce a set of best practices for Rust programming. However, not all lints provided by `cargo clippy` are relevant or applicable to our project.
88
> We may choose to ignore some lints if they are unstable, experimental, or specific to our project.
@@ -312,7 +312,7 @@ And [look in Jaeger for a trace](http://localhost:16686/search?service=rustup).
312312

313313
The custom macro `rustup_macros::test` adds a prelude and suffix to each test to
314314
ensure that there is a tracing context setup, that the test function is a span,
315-
and that the spans from the test are flushed. Build with features=otel to
315+
and that the spans from the test are flushed. Build with features=otel,test to
316316
use this feature.
317317

318318
### Adding instrumentation

Cargo.lock

Lines changed: 105 additions & 8 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)