foundry-rs / foundry

Foundry is a blazing fast, portable and modular toolkit for Ethereum application development written in Rust.
https://getfoundry.sh
Apache License 2.0
8.18k stars 1.7k forks source link

Optimize installation speed when building from source on Windows #5483

Open pcaversaccio opened 1 year ago

pcaversaccio commented 1 year ago

Component

Other (please describe)

Describe the feature you would like

The current installation time on Windows OS (i.e. building Foundry from source) is crazy long. In order to replicate the normal installation behaviour, you can run the following GH CI action on any test repo:

name: 🛠 Test Native Windows Foundry Build

on: [workflow_dispatch]

jobs:
  build:
    name: Foundry
    runs-on: windows-latest

    steps:
      - name: Checkout
        uses: actions/checkout@v3

      - name: Set up Rust
        uses: actions-rs/toolchain@v1
        with:
          toolchain: stable

      - name: Build Foundry from source
        run: cargo install --git https://github.com/foundry-rs/foundry --profile local --force foundry-cli anvil chisel

image

For foundry-cli, anvil, and chisel together you usually have +90mins build time, which is honestly not acceptable. WSL works of course as an alternative, but I would like to still discuss potential remediations here.

Additional context

My current local installation time:

image

DaniPopes commented 1 year ago

You can use the pre-compiled binaries for your CI, but here's our timings:

In general Rust binaries are slow to compile, even more so when done with optimizations. We can maybe shave off a few minutes on top of that, but this is probably the best you'll get

pcaversaccio commented 1 year ago

thanks for the references, and I'm aware of the slow Rust compilation time. All I'm saying is that 30min is still a lot compared to foundryup and I'm not sure how much can be shaved off, but whatever can be shaved off should be done imo.