From 4de59db63a066737e557c2c4dd3d1f70206de781 Mon Sep 17 00:00:00 2001 From: Jake Shadle Date: Tue, 4 Mar 2025 14:06:57 +0100 Subject: [PATCH] Workaround rustup 1.28 (#96) * Add test for rust-toolchain.toml * Always install * Fix test * Ugh * Fix test --- .cargo/deny.toml | 2 +- .github/workflows/test.yml | 22 +++++++++++++--------- Cargo.toml | 1 + entrypoint.sh | 32 ++++++++++---------------------- test/rt.toml | 3 +++ 5 files changed, 28 insertions(+), 32 deletions(-) create mode 100644 test/rt.toml diff --git a/.cargo/deny.toml b/.cargo/deny.toml index 95a34ed..77126b3 100644 --- a/.cargo/deny.toml +++ b/.cargo/deny.toml @@ -1,2 +1,2 @@ [licenses] -allow = ["Unicode-DFS-2016", "MIT", "Apache-2.0"] +allow = ["Unicode-3.0", "MIT", "Apache-2.0"] diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 7622eb8..491722a 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -38,12 +38,16 @@ jobs: check \ "" - # Ensures the action in the PR still works - # test: - # runs-on: ubuntu-22.04 - # if: github.event_name == 'pull_request' - # steps: - # - uses: actions/checkout@v4 - # - uses: EmbarkStudios/cargo-deny-action@prep-release # change branch name to PR branch if you are changing it - # # with: - # # manifest-path: test/Cargo.toml + - name: Run check w/rust-toolchain.toml + run: | + mv ./test/rt.toml ./rust-toolchain.toml + docker run -v $PWD:/test test-cargo-deny \ + "" \ + "" \ + "" \ + "" \ + "false" \ + --log-level warn \ + --manifest-path test/Cargo.toml \ + check \ + "" \ No newline at end of file diff --git a/Cargo.toml b/Cargo.toml index 1dcfb7d..1621bf7 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,7 @@ [package] name = "root" version = "0.1.0" +edition = "2024" [dependencies] openssl = "0.10" diff --git a/entrypoint.sh b/entrypoint.sh index e7f51e9..ba9fa82 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -1,22 +1,14 @@ -#!/bin/sh -l +#!/bin/bash set -e PATH=$PATH:/usr/local/cargo/bin -if [ -n "$1" ] -then +if [ -n "$1" ]; then rustup set profile minimal rustup default "$1" -else - # Ensure active toolchain is installed if explicit rust-version is not passed. - # Starting with v1.28, rustup is not going to install active toolchain by default, - # and this is needed to install the active toolchain if it's not installed. - # See https://blog.rust-lang.org/2025/03/02/Rustup-1.28.0.html#whats-new-in-rustup-1280 - rustup show active-toolchain || rustup toolchain install fi -if [ -n "$2" ] -then +if [ -n "$2" ]; then git config --global credential.helper store git config --global --replace-all url.https://github.com/.insteadOf ssh://git@github.com/ git config --global --add url.https://github.com/.insteadOf git@github.com: @@ -25,35 +17,31 @@ then chmod 600 "$HOME/.git-credentials" fi -if [ -n "$3" ] -then +if [ -n "$3" ]; then mkdir -p "/root/.ssh" chmod 0700 "/root/.ssh" echo "${3}" > "/root/.ssh/id_rsa" chmod 0600 "/root/.ssh/id_rsa" fi -if [ -n "$4" ] -then +if [ -n "$4" ]; then mkdir -p "/root/.ssh" chmod 0700 "/root/.ssh" echo "${4}" > "/root/.ssh/known_hosts" chmod 0600 "/root/.ssh/known_hosts" fi -if [ -n "$5" ] -then +if [ -n "$5" ]; then export CARGO_NET_GIT_FETCH_WITH_CLI="$5" fi -shift -shift -shift -shift -shift +shift 5 # Due to how github actions run containers we need to explicitly force colors # as TTY detection fails inside them export CARGO_TERM_COLOR="always" +# Workaround for rustup 1.28 completely breaking rust-toolchain.toml +(cd "$(dirname "$4")"; rustup show || rustup toolchain install) + cargo-deny $* diff --git a/test/rt.toml b/test/rt.toml new file mode 100644 index 0000000..f12a31a --- /dev/null +++ b/test/rt.toml @@ -0,0 +1,3 @@ +[toolchain] +channel = "nightly-2025-01-03" +components = ["rustfmt", "clippy"]