Skip to content

Failed to find rust-toolchain.toml in mono repo when use self-hosted GitHub Actions runner #74

@hongbo-miao

Description

@hongbo-miao

I have a mono repo. Inside, I have a Rust app at my-app folder.
When I use self-hosted GitHub Actions runner, it seems cannot find rust-toolchain.toml even I already used rust-src-dir.
Any guide to help further locate the issue would be appreciate, thanks! ☺️

Experiments

Experiment 1 (failed): Self-hosted GitHub Actions runner + my-app/rust-toolchain.toml (I hope this work)

  my-app-test:
    name: my-app | Test
    if: ${{ inputs.workflow || inputs.my-app }}
    runs-on:
      - self-hosted
      - linux
    timeout-minutes: 10
    steps:
      - name: Checkout
        uses: actions/checkout@v5.0.0
      - name: Set up Rust
        uses: actions-rust-lang/setup-rust-toolchain@v1.15.0
        with:
          cache: true
          rust-src-dir: my-app

rust-toolchain.toml

[toolchain]
channel = "1.87.0"
profile = "minimal"
components = ["clippy", "rustfmt"]
Click to see log!
Run actions-rust-lang/setup-rust-toolchain@v1.15.0
with:
  cache: true
  rust-src-dir: my-app
  cache-on-failure: true
  cache-bin: true
  cache-provider: github
  cache-all-crates: false
  cache-workspace-crates: false
  matcher: true
  rustflags: -D warnings
  override: true
Run : construct rustup command line
: construct rustup command line
echo "targets=$(for t in ${targets//,/ }; do echo -n ' --target' $t; done)" >> $GITHUB_OUTPUT
echo "components=$(for c in ${components//,/ }; do echo -n ' --component' $c; done)" >> $GITHUB_OUTPUT
echo "downgrade=" >> $GITHUB_OUTPUT
shell: /usr/bin/bash --noprofile --norc -e -o pipefail {0}
env:
  targets: 
  components: 
Run if [[ ! -v CARGO_INCREMENTAL ]]; then
if [[ ! -v CARGO_INCREMENTAL ]]; then
  echo "CARGO_INCREMENTAL=0" >> $GITHUB_ENV
fi
if [[ ! -v CARGO_PROFILE_DEV_DEBUG ]]; then
  echo "CARGO_PROFILE_DEV_DEBUG=0" >> $GITHUB_ENV
fi
if [[ ! -v CARGO_TERM_COLOR ]]; then
  echo "CARGO_TERM_COLOR=always" >> $GITHUB_ENV
fi
if [[ ! -v RUST_BACKTRACE ]]; then
  echo "RUST_BACKTRACE=short" >> $GITHUB_ENV
fi
if [[ ( ! -v RUSTFLAGS ) && $NEW_RUSTFLAGS != "" ]]; then
  echo "RUSTFLAGS=$NEW_RUSTFLAGS" >> $GITHUB_ENV
fi
# Enable faster sparse index on nightly
# The value is ignored on stable and causes no problems
# https://internals.rust-lang.org/t/call-for-testing-cargo-sparse-registry/16862
if [[ ! -v CARGO_UNSTABLE_SPARSE_REGISTRY ]]; then
  echo "CARGO_UNSTABLE_SPARSE_REGISTRY=true" >> $GITHUB_ENV
fi
if [[ ! -v CARGO_REGISTRIES_CRATES_IO_PROTOCOL ]]; then
  echo "CARGO_REGISTRIES_CRATES_IO_PROTOCOL=sparse" >> $GITHUB_ENV
fi
shell: /usr/bin/bash --noprofile --norc -e -o pipefail {0}
env:
info: latest update on 2025-05-15, rust version 1.87.0 (17067e9ac 2025-05-09)
info: downloading component 'cargo'
info: downloading component 'clippy'
info: downloading component 'rust-std'
info: downloading component 'rustc'
info: downloading component 'rustfmt'
info: installing component 'cargo'
info: installing component 'clippy'
info: installing component 'rust-std'
info: installing component 'rustc'
info: installing component 'rustfmt'
1.87.0-x86_64-unknown-linux-gnu (overridden by '/tmp/github-actions-runner/work/sky-ai/sky-ai/my-app/rust-toolchain.toml')
Run echo "rustc-version=$(rustc --version)" >> $GITHUB_OUTPUT
echo "rustc-version=$(rustc --version)" >> $GITHUB_OUTPUT
rustc --version --verbose
echo "cargo-version=$(cargo --version)" >> $GITHUB_OUTPUT
cargo --version --verbose
echo "rustup-version=$(rustup --version)" >> $GITHUB_OUTPUT
rustup --version

DATE=$(rustc --version --verbose | sed -ne 's/^commit-date: \(20[0-9][0-9]\)-\([01][0-9]\)-\([0-3][0-9]\)$/\1\2\3/p')
HASH=$(rustc --version --verbose | sed -ne 's/^commit-hash: //p')
echo "cachekey=$(echo $DATE$HASH | head -c12)" >> $GITHUB_OUTPUT
shell: /usr/bin/bash --noprofile --norc -e -o pipefail {0}
env:
  CARGO_INCREMENTAL: 0
  CARGO_PROFILE_DEV_DEBUG: 0
  CARGO_TERM_COLOR: always
  RUST_BACKTRACE: short
  RUSTFLAGS: -D warnings
  CARGO_UNSTABLE_SPARSE_REGISTRY: true
  CARGO_REGISTRIES_CRATES_IO_PROTOCOL: sparse
error: rustup could not choose a version of rustc to run, because one wasn't specified explicitly, and no default is configured.
help: run 'rustup default stable' to download the latest stable release of Rust and set it as your default toolchain.
error: rustup could not choose a version of rustc to run, because one wasn't specified explicitly, and no default is configured.
help: run 'rustup default stable' to download the latest stable release of Rust and set it as your default toolchain.

Stack backtrace:
 0: anyhow::error::<impl core::convert::From<E> for anyhow::Error>::from
 1: rustup::config::Cfg::local_toolchain::{{closure}}
 2: rustup::cli::proxy_mode::main::{{closure}}::{{closure}}
 3: rustup_init::run_rustup_inner::{{closure}}::{{closure}}
 4: rustup_init::run_rustup::{{closure}}::{{closure}}
 5: rustup_init::main::{{closure}}
 6: rustup_init::main
 7: std::sys::backtrace::__rust_begin_short_backtrace
 8: main
 9: <unknown>
10: __libc_start_main
11: <unknown>
Error: Process completed with exit code 1.

Experiment 2 (succeed): Self-hosted GitHub Actions runner + toolchain: stable

  my-app-test:
    name: my-app | Test
    if: ${{ inputs.workflow || inputs.my-app }}
    runs-on:
      - self-hosted
      - linux
    timeout-minutes: 10
    steps:
      - name: Checkout
        uses: actions/checkout@v5.0.0
      - name: Set up Rust
        uses: actions-rust-lang/setup-rust-toolchain@v1.15.0
        with:
          cache: true
          rust-src-dir: my-app
          toolchain: stable # <- I added this in this experiment
Click to see log!
Run actions-rust-lang/setup-rust-toolchain@v1.15.0
with:
  cache: true
  rust-src-dir: my-app
  toolchain: stable
  cache-on-failure: true
  cache-bin: true
  cache-provider: github
  cache-all-crates: false
  cache-workspace-crates: false
  matcher: true
  rustflags: -D warnings
  override: true
Run : construct rustup command line
: construct rustup command line
echo "targets=$(for t in ${targets//,/ }; do echo -n ' --target' $t; done)" >> $GITHUB_OUTPUT
echo "components=$(for c in ${components//,/ }; do echo -n ' --component' $c; done)" >> $GITHUB_OUTPUT
echo "downgrade=" >> $GITHUB_OUTPUT
shell: /usr/bin/bash --noprofile --norc -e -o pipefail {0}
env:
  targets: 
  components: 
Run if [[ ! -v CARGO_INCREMENTAL ]]; then
if [[ ! -v CARGO_INCREMENTAL ]]; then
  echo "CARGO_INCREMENTAL=0" >> $GITHUB_ENV
fi
if [[ ! -v CARGO_PROFILE_DEV_DEBUG ]]; then
  echo "CARGO_PROFILE_DEV_DEBUG=0" >> $GITHUB_ENV
fi
if [[ ! -v CARGO_TERM_COLOR ]]; then
  echo "CARGO_TERM_COLOR=always" >> $GITHUB_ENV
fi
if [[ ! -v RUST_BACKTRACE ]]; then
  echo "RUST_BACKTRACE=short" >> $GITHUB_ENV
fi
if [[ ( ! -v RUSTFLAGS ) && $NEW_RUSTFLAGS != "" ]]; then
  echo "RUSTFLAGS=$NEW_RUSTFLAGS" >> $GITHUB_ENV
fi
# Enable faster sparse index on nightly
# The value is ignored on stable and causes no problems
# https://internals.rust-lang.org/t/call-for-testing-cargo-sparse-registry/16862
if [[ ! -v CARGO_UNSTABLE_SPARSE_REGISTRY ]]; then
  echo "CARGO_UNSTABLE_SPARSE_REGISTRY=true" >> $GITHUB_ENV
fi
if [[ ! -v CARGO_REGISTRIES_CRATES_IO_PROTOCOL ]]; then
  echo "CARGO_REGISTRIES_CRATES_IO_PROTOCOL=sparse" >> $GITHUB_ENV
fi
shell: /usr/bin/bash --noprofile --norc -e -o pipefail {0}
info: syncing channel updates for 'stable-x86_64-unknown-linux-gnu'
info: latest update on 2025-09-18, rust version 1.90.0 (1159e78c4 2025-09-14)
info: downloading component 'cargo'
info: downloading component 'rust-std'
info: downloading component 'rustc'
info: installing component 'cargo'
info: installing component 'rust-std'
info: installing component 'rustc'

info: default toolchain set to 'stable-x86_64-unknown-linux-gnu'
stable-x86_64-unknown-linux-gnu installed - rustc 1.90.0 (1159e78c4 2025-09-14)

info: override toolchain for '/tmp/github-actions-runner/work/sky-ai/sky-ai/my-app' set to 'stable-x86_64-unknown-linux-gnu'
Run echo "rustc-version=$(rustc --version)" >> $GITHUB_OUTPUT
echo "rustc-version=$(rustc --version)" >> $GITHUB_OUTPUT
rustc --version --verbose
echo "cargo-version=$(cargo --version)" >> $GITHUB_OUTPUT
cargo --version --verbose
echo "rustup-version=$(rustup --version)" >> $GITHUB_OUTPUT
rustup --version

DATE=$(rustc --version --verbose | sed -ne 's/^commit-date: \(20[0-9][0-9]\)-\([01][0-9]\)-\([0-3][0-9]\)$/\1\2\3/p')
HASH=$(rustc --version --verbose | sed -ne 's/^commit-hash: //p')
echo "cachekey=$(echo $DATE$HASH | head -c12)" >> $GITHUB_OUTPUT
shell: /usr/bin/bash --noprofile --norc -e -o pipefail {0}
env:
  CARGO_INCREMENTAL: 0
  CARGO_PROFILE_DEV_DEBUG: 0
  CARGO_TERM_COLOR: always
  RUST_BACKTRACE: short
  RUSTFLAGS: -D warnings
  CARGO_UNSTABLE_SPARSE_REGISTRY: true
  CARGO_REGISTRIES_CRATES_IO_PROTOCOL: sparse
rustc 1.90.0 (1159e78c4 2025-09-14)
binary: rustc
commit-hash: 1159e78c4747b02ef996e55082b704c09b970588
commit-date: 2025-09-14
host: x86_64-unknown-linux-gnu
release: 1.90.0
LLVM version: 20.1.8
cargo 1.90.0 (840b83a10 2025-07-30)
release: 1.90.0
commit-hash: 840b83a10fb0e039a83f4d70ad032892c287570a
commit-date: 2025-07-30
host: x86_64-unknown-linux-gnu
libgit2: 1.9.1 (sys:0.20.2 vendored)
libcurl: 8.14.1-DEV (sys:0.4.82+curl-8.14.1 vendored ssl:OpenSSL/3.5.0)
ssl: OpenSSL 3.5.0 8 Apr 2025
os: Ubuntu 24.4.0 (noble) [64-bit]
info: This is the version for the rustup toolchain manager, not the rustc compiler.
info: The currently active `rustc` version is `rustc 1.90.0 (1159e78c4 2025-09-14)`
rustup 1.28.2 (e4f3ad6f8 2025-04-28)
info: This is the version for the rustup toolchain manager, not the rustc compiler.
info: The currently active `rustc` version is `rustc 1.90.0 (1159e78c4 2025-09-14)`
Run # Not all versions support setting CARGO_REGISTRIES_CRATES_IO_PROTOCOL
Run Swatinem/rust-cache@98c8021b550208e191a6a3145459bfc9fb29c4c0
Cache Configuration

... Restoring cache ...
Warning: Cache not found for keys: v0-rust-my-app-test-Linux-x64-f25ac25e-251ef7b5, v0-rust-my-app-test-Linux-x64-f25ac25e
No cache found.

Experiment 3 (succeed): Official GitHub Actions runner + my-app/rust-toolchain.toml

Exact same configs to Experiment 1, but use official GitHub Actions runner.

  my-app-test:
    name: my-app | Test
    if: ${{ inputs.workflow || inputs.my-app }}
    runs-on:
      - self-hosted
      - linux
    timeout-minutes: 10
    steps:
      - name: Checkout
        uses: actions/checkout@v5.0.0
      - name: Set up Rust
        uses: actions-rust-lang/setup-rust-toolchain@v1.15.0
        with:
          cache: true
          rust-src-dir: my-app

rust-toolchain.toml

[toolchain]
channel = "1.87.0"
profile = "minimal"
components = ["clippy", "rustfmt"]
Click to see log!
Run actions-rust-lang/setup-rust-toolchain@v1.15.0
with:
  cache: true
  rust-src-dir: my-app
  cache-on-failure: true
  cache-bin: true
  cache-provider: github
  cache-all-crates: false
  cache-workspace-crates: false
  matcher: true
  rustflags: -D warnings
  override: true
Run : construct rustup command line
: construct rustup command line
echo "targets=$(for t in ${targets//,/ }; do echo -n ' --target' $t; done)" >> $GITHUB_OUTPUT
echo "components=$(for c in ${components//,/ }; do echo -n ' --component' $c; done)" >> $GITHUB_OUTPUT
echo "downgrade=" >> $GITHUB_OUTPUT
shell: /usr/bin/bash --noprofile --norc -e -o pipefail {0}
env:
  targets: 
  components: 
Run if [[ ! -v CARGO_INCREMENTAL ]]; then
if [[ ! -v CARGO_INCREMENTAL ]]; then
  echo "CARGO_INCREMENTAL=0" >> $GITHUB_ENV
fi
if [[ ! -v CARGO_PROFILE_DEV_DEBUG ]]; then
  echo "CARGO_PROFILE_DEV_DEBUG=0" >> $GITHUB_ENV
fi
if [[ ! -v CARGO_TERM_COLOR ]]; then
  echo "CARGO_TERM_COLOR=always" >> $GITHUB_ENV
fi
if [[ ! -v RUST_BACKTRACE ]]; then
  echo "RUST_BACKTRACE=short" >> $GITHUB_ENV
fi
if [[ ( ! -v RUSTFLAGS ) && $NEW_RUSTFLAGS != "" ]]; then
  echo "RUSTFLAGS=$NEW_RUSTFLAGS" >> $GITHUB_ENV
fi
# Enable faster sparse index on nightly
# The value is ignored on stable and causes no problems
# https://internals.rust-lang.org/t/call-for-testing-cargo-sparse-registry/16862
if [[ ! -v CARGO_UNSTABLE_SPARSE_REGISTRY ]]; then
  echo "CARGO_UNSTABLE_SPARSE_REGISTRY=true" >> $GITHUB_ENV
fi
if [[ ! -v CARGO_REGISTRIES_CRATES_IO_PROTOCOL ]]; then
  echo "CARGO_REGISTRIES_CRATES_IO_PROTOCOL=sparse" >> $GITHUB_ENV
fi
shell: /usr/bin/bash --noprofile --norc -e -o pipefail {0}
env:
  RUSTFLAGS: -D warnings
  CARGO_UNSTABLE_SPARSE_REGISTRY: true
  CARGO_REGISTRIES_CRATES_IO_PROTOCOL: sparse
Run Swatinem/rust-cache@98c8021b550208e191a6a3145459bfc9fb29c4c0
with:
  workspaces: my-app
  cache-on-failure: true
  cache-bin: true
  cache-provider: github
  cache-all-crates: false
  cache-workspace-crates: false
  prefix-key: v0-rust
  cache-targets: true
  save-if: true
  lookup-only: false
env:
  CARGO_INCREMENTAL: 0
  CARGO_PROFILE_DEV_DEBUG: 0
  CARGO_TERM_COLOR: always
  RUST_BACKTRACE: short
  RUSTFLAGS: -D warnings
  CARGO_UNSTABLE_SPARSE_REGISTRY: true
  CARGO_REGISTRIES_CRATES_IO_PROTOCOL: sparse
Cache Configuration
Cache Provider:
    github
Workspaces:
    /home/runner/work/sky-ai/sky-ai/my-app
Cache Paths:
    /home/runner/.cargo/bin
    /home/runner/.cargo/.crates.toml
    /home/runner/.cargo/.crates2.json
    /home/runner/.cargo/registry
    /home/runner/.cargo/git
    /home/runner/work/sky-ai/sky-ai/my-app/target
Restore Key:
    v0-rust-my-app-test-Linux-x64-3dfd62ae
Cache Key:
    v0-rust-my-app-test-Linux-x64-3dfd62ae-251ef7b5
.. Prefix:
  - v0-rust-my-app-test-Linux-x64
.. Environment considered:
  - Rust Version: 1.89.0 x86_64-unknown-linux-gnu (29483883eed69d5fb4db01964cdf2af4d86e9cb2)
  - CARGO_INCREMENTAL
  - CARGO_PROFILE_DEV_DEBUG
  - CARGO_REGISTRIES_CRATES_IO_PROTOCOL
  - CARGO_TERM_COLOR
  - CARGO_UNSTABLE_SPARSE_REGISTRY
  - RUST_BACKTRACE
  - RUSTFLAGS
.. Lockfiles considered:
  - /home/runner/work/sky-ai/sky-ai/my-app/Cargo.lock
  - /home/runner/work/sky-ai/sky-ai/my-app/Cargo.toml
  - /home/runner/work/sky-ai/sky-ai/my-app/rust-toolchain.toml

... Restoring cache ...
Cache hit for: v0-rust-my-app-test-Linux-x64-3dfd62ae-251ef7b5
Received 130023424 of 281555470 (46.2%), 123.9 MBs/sec
Received 277361166 of 281555470 (98.5%), 132.3 MBs/sec
Received 281555470 of 281555470 (100.0%), 132.9 MBs/sec
Cache Size: ~269 MB (281555470 B)
/usr/bin/tar -xf /home/runner/work/_temp/359793e0-bd0c-4a84-84ce-f5557293e70b/cache.tzst -P -C /home/runner/work/sky-ai/sky-ai --use-compress-program unzstd
Cache restored successfully
Restored from cache key "v0-rust-my-app-test-Linux-x64-3dfd62ae-251ef7b5" full match: true.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions