Skip to content

Commit 4de59db

Browse files
authored
Workaround rustup 1.28 (#96)
* Add test for rust-toolchain.toml * Always install * Fix test * Ugh * Fix test
1 parent d8395c1 commit 4de59db

5 files changed

Lines changed: 28 additions & 32 deletions

File tree

.cargo/deny.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
[licenses]
2-
allow = ["Unicode-DFS-2016", "MIT", "Apache-2.0"]
2+
allow = ["Unicode-3.0", "MIT", "Apache-2.0"]

.github/workflows/test.yml

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -38,12 +38,16 @@ jobs:
3838
check \
3939
""
4040
41-
# Ensures the action in the PR still works
42-
# test:
43-
# runs-on: ubuntu-22.04
44-
# if: github.event_name == 'pull_request'
45-
# steps:
46-
# - uses: actions/checkout@v4
47-
# - uses: EmbarkStudios/cargo-deny-action@prep-release # change branch name to PR branch if you are changing it
48-
# # with:
49-
# # manifest-path: test/Cargo.toml
41+
- name: Run check w/rust-toolchain.toml
42+
run: |
43+
mv ./test/rt.toml ./rust-toolchain.toml
44+
docker run -v $PWD:/test test-cargo-deny \
45+
"" \
46+
"" \
47+
"" \
48+
"" \
49+
"false" \
50+
--log-level warn \
51+
--manifest-path test/Cargo.toml \
52+
check \
53+
""

Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
[package]
22
name = "root"
33
version = "0.1.0"
4+
edition = "2024"
45

56
[dependencies]
67
openssl = "0.10"

entrypoint.sh

Lines changed: 10 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,14 @@
1-
#!/bin/sh -l
1+
#!/bin/bash
22
set -e
33

44
PATH=$PATH:/usr/local/cargo/bin
55

6-
if [ -n "$1" ]
7-
then
6+
if [ -n "$1" ]; then
87
rustup set profile minimal
98
rustup default "$1"
10-
else
11-
# Ensure active toolchain is installed if explicit rust-version is not passed.
12-
# Starting with v1.28, rustup is not going to install active toolchain by default,
13-
# and this is needed to install the active toolchain if it's not installed.
14-
# See https://blog.rust-lang.org/2025/03/02/Rustup-1.28.0.html#whats-new-in-rustup-1280
15-
rustup show active-toolchain || rustup toolchain install
169
fi
1710

18-
if [ -n "$2" ]
19-
then
11+
if [ -n "$2" ]; then
2012
git config --global credential.helper store
2113
git config --global --replace-all url.https://github.com/.insteadOf ssh://git@github.com/
2214
git config --global --add url.https://github.com/.insteadOf git@github.com:
@@ -25,35 +17,31 @@ then
2517
chmod 600 "$HOME/.git-credentials"
2618
fi
2719

28-
if [ -n "$3" ]
29-
then
20+
if [ -n "$3" ]; then
3021
mkdir -p "/root/.ssh"
3122
chmod 0700 "/root/.ssh"
3223
echo "${3}" > "/root/.ssh/id_rsa"
3324
chmod 0600 "/root/.ssh/id_rsa"
3425
fi
3526

36-
if [ -n "$4" ]
37-
then
27+
if [ -n "$4" ]; then
3828
mkdir -p "/root/.ssh"
3929
chmod 0700 "/root/.ssh"
4030
echo "${4}" > "/root/.ssh/known_hosts"
4131
chmod 0600 "/root/.ssh/known_hosts"
4232
fi
4333

44-
if [ -n "$5" ]
45-
then
34+
if [ -n "$5" ]; then
4635
export CARGO_NET_GIT_FETCH_WITH_CLI="$5"
4736
fi
4837

49-
shift
50-
shift
51-
shift
52-
shift
53-
shift
38+
shift 5
5439

5540
# Due to how github actions run containers we need to explicitly force colors
5641
# as TTY detection fails inside them
5742
export CARGO_TERM_COLOR="always"
5843

44+
# Workaround for rustup 1.28 completely breaking rust-toolchain.toml
45+
(cd "$(dirname "$4")"; rustup show || rustup toolchain install)
46+
5947
cargo-deny $*

test/rt.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
[toolchain]
2+
channel = "nightly-2025-01-03"
3+
components = ["rustfmt", "clippy"]

0 commit comments

Comments
 (0)