Skip to content

Commit 8647029

Browse files
authored
[ci] Fix Rust toolchain roller (#3068)
gherrit-pr-id: Gzl33f6ysumidym5su2pyyxp4nak4e7je
1 parent da90333 commit 8647029

File tree

1 file changed

+11
-27
lines changed

1 file changed

+11
-27
lines changed

.github/workflows/roll-pinned-toolchain-versions.yml

Lines changed: 11 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,10 @@ jobs:
6565
# worry about what time of day this job runs.
6666
echo "ZC_TARGET_TOOLCHAIN=nightly-$(date -d '-1 day' +%Y-%m-%d)" >> $GITHUB_ENV
6767
fi
68+
- name: Install stable Rust for use in 'cargo.sh'
69+
uses: dtolnay/rust-toolchain@e97e2d8cc328f1b50210efc529dca0028893a2d9 # v1
70+
with:
71+
toolchain: stable
6872
- name: Install Rust with ${{ env.ZC_TARGET_TOOLCHAIN }} toolchain
6973
uses: dtolnay/rust-toolchain@e97e2d8cc328f1b50210efc529dca0028893a2d9 # v1
7074
with:
@@ -89,11 +93,7 @@ jobs:
8993
function update-pinned-version {
9094
VERSION_NAME="$1"
9195
VERSION="$2"
92-
# For nightly, this is the same as `$VERSION`. For stable, it's
93-
# `stable` because `rustup` doesn't recognize that `x.y.z` refers to
94-
# the same thing as `stable` even if they're the same toolchain.
95-
VERSION_FOR_CARGO="$3"
96-
ZEROCOPY_FEATURES="$4"
96+
ZEROCOPY_FEATURES="$3"
9797
9898
# Confirm that `Cargo.toml` lists the pinned version in the expected
9999
# format. This is a prerequisite for the subsequent `sed` command.
@@ -104,40 +104,24 @@ jobs:
104104
# Confirm that the update didn't bork `Cargo.toml`.
105105
validate-file "$REGEX" Cargo.toml
106106
107-
export RUSTFLAGS='--cfg zerocopy_derive_union_into_bytes'
108-
109107
# Run `cargo fix` in case there are any warnings or errors
110108
# introduced on this new toolchain that we can fix automatically.
111109
# This is best-effort, so we don't let failure cause the whole job
112110
# to fail.
113-
#
114-
# We use the full package filepaths here since our dev-dependencies
115-
# sometimes depend on zerocopy. When this happens, the names
116-
# `zerocopy` and `zerocopy-derive` alone are ambiguous (they refer
117-
# both to the local filesystem versions and to the crates.io
118-
# versions).
119-
cargo "+$VERSION_FOR_CARGO" fix --allow-dirty --tests --package file:///home/runner/work/zerocopy/zerocopy $ZEROCOPY_FEATURES || true
120-
cargo "+$VERSION_FOR_CARGO" fix --allow-dirty --tests --package file:///home/runner/work/zerocopy/zerocopy/zerocopy-derive || true
121-
122-
# Update `.stderr` files as needed for the new version.
123-
#
124-
# We use the full package filepaths here since our dev-dependencies
125-
# sometimes depend on zerocopy. When this happens, the names
126-
# `zerocopy` and `zerocopy-derive` alone are ambiguous (they refer
127-
# both to the local filesystem versions and to the crates.io
128-
# versions).
129-
TRYBUILD=overwrite cargo "+$VERSION_FOR_CARGO" test --package file:///home/runner/work/zerocopy/zerocopy $ZEROCOPY_FEATURES
130-
TRYBUILD=overwrite cargo "+$VERSION_FOR_CARGO" test --package file:///home/runner/work/zerocopy/zerocopy/zerocopy-derive
111+
./cargo.sh "+$VERSION_NAME" fix --allow-dirty --tests --package zerocopy $ZEROCOPY_FEATURES || true
112+
./cargo.sh "+$VERSION_NAME" fix --allow-dirty --tests --package zerocopy-derive || true
113+
114+
./tools/update-expected-test-output.sh
131115
}
132116
133117
if [ "$TOOLCHAIN" == stable ]; then
134118
STABLE_VERSION="$(cargo +stable version | sed -e 's/^cargo \([0-9\.]*\) .*/\1/')"
135-
update-pinned-version stable "$STABLE_VERSION" stable '--features __internal_use_only_features_that_work_on_stable'
119+
update-pinned-version stable "$STABLE_VERSION" '--features __internal_use_only_features_that_work_on_stable'
136120
137121
# Used as part of the branch name created by the "Submit PR" step.
138122
echo "ZC_VERSION_FOR_BRANCH_NAME=$STABLE_VERSION" >> $GITHUB_ENV
139123
else
140-
update-pinned-version nightly "$ZC_TARGET_TOOLCHAIN" "$ZC_TARGET_TOOLCHAIN" --all-features
124+
update-pinned-version nightly "$ZC_TARGET_TOOLCHAIN" --all-features
141125
echo "ZC_VERSION_FOR_BRANCH_NAME=$ZC_TARGET_TOOLCHAIN" >> $GITHUB_ENV
142126
fi
143127

0 commit comments

Comments
 (0)