Giter VIP home page Giter VIP logo

setup-rust's People

Contributors

g07cha avatar milesj avatar mlga avatar mozart409 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

setup-rust's Issues

allow building with `--locked`

tl;dr I would like to build bins with option --locked

From this failed build I got error

Run moonrepo/setup-rust@v1
  with:
    channel: 1.70.0
    bins: cross
    targets: aarch64-apple-ios
    cache: true
    cache-target: debug
    inherit-toolchain: false
    target-dirs: target

...

  WARN The package cargo-cache v0.8.3 will be installed from source (with cargo)
 WARN The package cross v0.2.5 will be installed from source (with cargo)

...

   Compiling cfg-if v1.0.0
error: failed to compile `cargo-cache v0.8.3`, intermediate artifacts can be found at `/var/folders/w3/xh1ngrc13bg46kmhfdprbpyw0000gn/T/cargo-installgoVcWl`

Caused by:
  package `cargo-platform v0.1.8` cannot be built because it requires rustc 1.73 or newer, while the currently active rustc version is 1.70.0
  Try re-running cargo install with `--locked`

From this rust.yml code

env:
  CARGO_TERM_COLOR: always
  RUST_BACKTRACE: 1
  MSRV_UPLOAD: "1.70.0"
jobs:
  job_cross_targets_macos:
    name: cross ${{ matrix.target }} on macos-13
    strategy:
      matrix:
        target:
          - x86_64-apple-darwin
          - aarch64-apple-darwin
          - aarch64-apple-ios
          - x86_64-apple-ios
    runs-on: macos-13
    steps:
      - uses: actions/checkout@v4
      - uses: moonrepo/setup-rust@v1
        with:
          channel: ${{ env.MSRV_UPLOAD }}
          bins: cross
          targets: ${{ matrix.target }}
      - run: |
          set -eux
          uname -a
          rustup show
          cross --version
          cross check --lib --bins --target ${{ matrix.target }}

The built-in advice from the error message above is pass CLI argument --locked.

Try re-running cargo install with --locked

Can you allow passing --locked to the cargo install command invoked by the with statement?

error: link.exe not found

image

Hey, this might just be me not knowing what I'm doing, but I've tried a fair bit of things and none of them seemed to help.
workflow:

      - uses: moonrepo/setup-rust@v1
        with:
          profile: complete
          targets: 'x86_64-pc-windows-msvc,x86_64-pc-windows-gnu'
      - name: Build exe/
        run: cargo build --release --all-features --manifest-path exe/Cargo.toml --target=x86_64-pc-windows-msvc

pre and post build cache hashes are different on windows-latest

before build;
Attempting to restore cache
Generating cache key
Cache does not exist using key setup-rustcargo-v1-win32-d94c355bca58aa4c0186140d125e989ab8395e82

after build:

Size changed 1.63 GB => 313.25 MB (-1.32 GB, -80.81%)
Cleaning target/release before saving
Removing examples and incremental directories
Removing dep-info files (*.d)
Saving cache with key setup-rustcargo-v1-win32-1dbfb78edf8a75329b6134312e65b3ad0c5c67d8

Fails to cache on macos-13

The post step of this github action fails on macos-13 with:

Error: Path Validation Error: Path(s) specified in the action for caching do(es) not exist, hence no cache is being saved.

No idea what command line is being tried, it is printed in the other 2 successful cases but not in this case.

Workflow (clipped):

# ...
jobs:
  build-linux:
    name: Linux
    runs-on: ubuntu-latest
    steps:
    # ...
    - name: Install dependencies (rust)
      uses: moonrepo/setup-rust@v1
      with:
        targets: x86_64-unknown-linux-gnu
        components: clippy,rustfmt
    # ...

  build-macos:
    name: MacOS
    runs-on: macos-13 # macos-latest/macos-14 has an ARM cpu (Apple M1) but we want an AMD64 cpu
    steps:
    # ...
    - name: Install dependencies (rust)
      uses: moonrepo/setup-rust@v1
      with:
        targets: x86_64-apple-darwin
        components: clippy,rustfmt
    # ...

  build-cygwin:
    name: Cygwin
    runs-on: windows-latest
    steps:
    # ...
    - name: Install dependencies (rust)
      uses: moonrepo/setup-rust@v1
      with:
        targets: x86_64-pc-windows-gnu
        components: clippy,rustfmt
    # ...

Unable to install cargo-binstall

Trying to use the action on host where rustup is missing leads to this error:

Run moonrepo/setup-rust@v1
  with:
    inherit-toolchain: true
    cache-target: release
    cache: true
  env:
    RUSTFLAGS: -D warnings --cfg tokio_unstable
Setting cargo environment variables
Adding ~/.cargo/bin to PATH
Detecting toolchain
Loading rust-toolchain.toml or rust-toolchain file
Inheriting toolchain settings from inputs
Installing toolchain with rustup
/home/ubuntu/.cargo/bin/rustup toolchain install nightly-[2](https://github.com/fluencelabs/nox/actions/runs/5738400881/job/15551917509?pr=1741#step:3:2)02[3](https://github.com/fluencelabs/nox/actions/runs/5738400881/job/15551917509?pr=1741#step:3:3)-06-1[4](https://github.com/fluencelabs/nox/actions/runs/5738400881/job/15551917509?pr=1741#step:3:4) --profile minimal --target x86_64-unknown-linux-gnu --target aarch64-unknown-linux-gnu --component rustfmt --component clippy --no-self-update
info: syncing channel updates for 'nightly-2023-06-14-x86_64-unknown-linux-gnu'
info: latest update on 2023-06-14, rust version 1.72.0-nightly (371994e0d 2023-06-13)
info: component 'clippy' for target 'x86_64-unknown-linux-gnu' is up to date
info: component 'rust-std' for target 'aarch64-unknown-linux-gnu' is up to date
info: component 'rust-std' for target 'x86_64-unknown-linux-gnu' is up to date
info: component 'rustfmt' for target 'x86_64-unknown-linux-gnu' is up to date

  nightly-2023-06-14-x86_64-unknown-linux-gnu unchanged - rustc 1.72.0-nightly (371994e0d 2023-06-13)

/home/ubuntu/.cargo/bin/rustup default nightly-2023-06-14
info: using existing install for 'nightly-2023-06-14-x86_64-unknown-linux-gnu'
info: default toolchain set to 'nightly-2023-06-14-x86_64-unknown-linux-gnu'

  nightly-2023-06-14-x86_64-unknown-linux-gnu unchanged - rustc 1.72.0-nightly (371994e0d 2023-06-13)

info: note that the toolchain 'nightly-2023-06-14-x86_64-unknown-linux-gnu' is currently in use (overridden by '/opt/actions-runner/_work/nox/nox/rust-toolchain.toml')
Logging installed toolchain versions
/home/ubuntu/.cargo/bin/rustc +nightly-2023-06-14 --version --verbose
rustc 1.72.0-nightly (371994e0d 2023-06-13)
binary: rustc
commit-hash: 371994e0d8380600ddda78ca1be937c7fb179b49
commit-date: 2023-06-13
host: x86_64-unknown-linux-gnu
release: 1.72.0-nightly
LLVM version: 16.0.[5](https://github.com/fluencelabs/nox/actions/runs/5738400881/job/15551917509?pr=1741#step:3:5)
Installing additional binaries
cargo-binstall does not exist, attempting to install
Error: Cannot find module './133.index.js'
Require stack:
- /opt/actions-runner/_work/_actions/moonrepo/setup-rust/v1/dist/index.js
node:internal/modules/cjs/loader:933
  const err = new Error(message);
              ^

Error: Cannot find module './133.index.js'
Require stack:
- /opt/actions-runner/_work/_actions/moonrepo/setup-rust/v1/dist/index.js
    at Function.Module._resolveFilename (node:internal/modules/cjs/loader:933:15)
    at Function.Module._load (node:internal/modules/cjs/loader:778:27)
    at Module.require (node:internal/modules/cjs/loader:1005:19)
    at require (node:internal/modules/cjs/helpers:102:18)
    at Object.__nccwpck_require__.f.require (/opt/actions-runner/_work/_actions/moonrepo/setup-rust/v1/dist/index.js:[6](https://github.com/fluencelabs/nox/actions/runs/5738400881/job/15551917509?pr=1741#step:3:6)3801:28)
    at /opt/actions-runner/_work/_actions/moonrepo/setup-rust/v1/dist/index.js:63[7](https://github.com/fluencelabs/nox/actions/runs/5738400881/job/15551917509?pr=1741#step:3:7)36:40
    at Array.reduce (<anonymous>)
    at Function.__nccwpck_require__.e (/opt/actions-runner/_work/_actions/moonrepo/setup-rust/v1/dist/index.js:63735:67)
    at downloadAndInstallBinstall (/opt/actions-runner/_work/_actions/moonrepo/setup-rust/v1/dist/index.js:63077:5[8](https://github.com/fluencelabs/nox/actions/runs/5738400881/job/15551917509?pr=1741#step:3:9))
    at installBins (/opt/actions-runner/_work/_actions/moonrepo/setup-rust/v1/dist/index.js:63[12](https://github.com/fluencelabs/nox/actions/runs/5738400881/job/15551917509?pr=1741#step:3:13)2:[15](https://github.com/fluencelabs/nox/actions/runs/5738400881/job/15551917509?pr=1741#step:3:16)) {
  code: 'MODULE_NOT_FOUND',
  requireStack: [
    '/opt/actions-runner/_work/_actions/moonrepo/setup-rust/v1/dist/index.js'
  ]
}

cache rustup binary

setup-rust action takes around 1min even though it is cached. Most likely the rustup binary and few other items are not cached.

setup-rust/src/cargo.ts

Lines 105 to 112 in deec13b

export function getCachePaths(): string[] {
return [
// ~/.cargo/registry
path.join(CARGO_HOME, 'registry'),
// /workspace/target/debug
path.join(WORKSPACE_ROOT, 'target', getCacheTarget()),
];
}

Setting cargo environment variables
Adding ~/.cargo/bin to PATH
rustup does not exist, attempting to install
Downloaded installation script to /tmp/rustup-init
[command]/tmp/rustup-init --default-toolchain none -y
info: downloading installer
info: profile set to 'default'
info: default host triple is x86_64-unknown-linux-gnu
info: skipping toolchain installation

Change behaviour of rust-toolchain config file

Hi,

I would like to ask if it would be possible to change the behaviour of the config file in regards to following

When loading a configuration file, only the channel field is used, while the other fields are ignored. We chose this approach, as those other fields are typically for develop/release workflows, but not for CI, which requires a minimal/granular setup.

Couldn't be the default to use the settings from the file and allow it to be overridden by the specific settings in the config of the action (components, targets and profile)?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.