diff --git a/.cargo/config.toml b/.cargo/config.toml new file mode 100644 index 000000000000..1b5d6a32c089 --- /dev/null +++ b/.cargo/config.toml @@ -0,0 +1,29 @@ +[alias] +b = "build" +c = "check" +d = "doc" +t = "test" +r = "run" + +[build] +incremental = true +# might be helpful but we don't enforce sccache installation atm +# https://github.com/mozilla/sccache +# rustc-wrapper = "sccache" + +# For details checkout https://jondot.medium.com/8-steps-for-troubleshooting-your-rust-build-times-2ffc965fd13e +[target.x86_64-unknown-linux-gnu] +# clang has been listed as prerequisite in the doc +linker = "clang" +rustflags = ["-Clink-arg=-fuse-ld=lld", "-Zshare-generics=y"] + +[target.x86_64-apple-darwin] +# zld might help here +# brew install michaeleisel/zld/zld +# "-Clink-arg=-fuse-ld=zld" +# For details checkout https://jondot.medium.com/8-steps-for-troubleshooting-your-rust-build-times-2ffc965fd13e +rustflags = ["-Zshare-generics=y"] + +[net] +git-fetch-with-cli = true +retry = 5 diff --git a/.github/workflows/coverage.yml b/.github/workflows/coverage.yml index 1fd638793893..5c822964ffcd 100644 --- a/.github/workflows/coverage.yml +++ b/.github/workflows/coverage.yml @@ -10,15 +10,13 @@ jobs: name: Cover runs-on: buildjet-8vcpu-ubuntu-2004 timeout-minutes: 30 - steps: - - name: Install Dependencies - run: | - sudo apt-get update - sudo apt-get install -y build-essential clang ocl-icd-opencl-dev + steps: - name: Checkout Sources uses: actions/checkout@v3 with: submodules: true + - name: Install Dependencies + run: sudo make install-deps - name: Rust Cache uses: Swatinem/rust-cache@v2 timeout-minutes: 5 diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml index b818142eeab7..516fc6a2d4a4 100644 --- a/.github/workflows/docs.yml +++ b/.github/workflows/docs.yml @@ -16,13 +16,11 @@ jobs: check-publish-docs: name: Publish runs-on: ubuntu-latest - steps: - - name: Apt Dependencies - run: | - sudo apt-get update - sudo apt-get install -y build-essential clang ocl-icd-opencl-dev + steps: - name: Checkout Sources uses: actions/checkout@v3 + - name: Apt Dependencies + run: sudo make install-deps - name: Link Checker (Repo) uses: lycheeverse/lychee-action@v1.5.1 with: diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 9956b3a1444a..06e90ec8dd7e 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -17,17 +17,15 @@ jobs: - os: macos-latest file: forest-${{ github.ref_name }}-macos-amd64.zip steps: + - name: Checkout Sources + uses: actions/checkout@v3 - name: Apt Dependencies if: startsWith(matrix.os, 'Ubuntu') - run: | - sudo apt-get update - sudo apt-get install -y build-essential clang ocl-icd-opencl-dev + run: sudo make install-deps - name: Homebrew Utils if: startsWith(matrix.os, 'macOS') run: | brew install --verbose coreutils - - name: Checkout Sources - uses: actions/checkout@v3 - name: Rust Cache uses: Swatinem/rust-cache@v2 timeout-minutes: 5 diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index 38b96b383865..0abe2ee9c48c 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -23,12 +23,10 @@ jobs: env: RUSTFLAGS: "-D warnings" steps: - - name: Install Dependencies - run: | - sudo apt-get update - sudo apt-get install -y build-essential clang ocl-icd-opencl-dev - name: Checkout Sources uses: actions/checkout@v3 + - name: Install Dependencies + run: sudo make install-deps - name: install nextest uses: taiki-e/install-action@nextest - name: Rust Cache @@ -44,12 +42,10 @@ jobs: name: Lint runs-on: ubuntu-latest steps: - - name: Apt Dependencies - run: | - sudo apt-get update - sudo apt-get install -y build-essential clang ocl-icd-opencl-dev - name: Checkout Sources uses: actions/checkout@v3 + - name: Apt Dependencies + run: sudo make install-deps - name: Rust Cache uses: Swatinem/rust-cache@v2 timeout-minutes: ${{ fromJSON(env.CACHE_TIMEOUT_MINUTES) }} @@ -110,36 +106,47 @@ jobs: strategy: matrix: os: [ubuntu-latest, macos-latest] - #rv: [1.58.1, stable, beta, nightly] - rv: [nightly] steps: - - name: Install Dependencies - if: startsWith(matrix.os, 'Ubuntu') - run: | - sudo apt-get update - sudo apt-get install -y build-essential clang ocl-icd-opencl-dev - name: Checkout Sources uses: actions/checkout@v3 + - uses: visvirial/sccache-action@v1 + if: startsWith(matrix.os, 'Ubuntu') + with: + arch: x86_64-unknown-linux-musl + - uses: visvirial/sccache-action@v1 + if: startsWith(matrix.os, 'macOS') + with: + arch: x86_64-apple-darwin + - name: Install Linux Dependencies + if: startsWith(matrix.os, 'Ubuntu') + run: | + lscpu # the job may run on different CPUs, list cpu here for analysing build time + sudo make install-deps - name: Rust Cache uses: Swatinem/rust-cache@v2 timeout-minutes: ${{ fromJSON(env.CACHE_TIMEOUT_MINUTES) }} continue-on-error: true + - uses: actions/cache@v3 + with: + path: | + ~/.cache/sccache/ + key: ${{ runner.os }}-sccache-${{ hashFiles('**/Cargo.lock') }} - name: Cargo Build run: cargo build --profile dev + env: + CC: "/tmp/sccache/sccache clang" calibnet-check: name: Calibnet sync check runs-on: buildjet-8vcpu-ubuntu-2004 timeout-minutes: 30 steps: - - name: Install Dependencies - run: | - sudo apt-get update - sudo apt-get install -y build-essential clang ocl-icd-opencl-dev - name: Checkout Sources uses: actions/checkout@v3 with: submodules: true + - name: Install Dependencies + run: sudo make install-deps - name: Rust Cache uses: Swatinem/rust-cache@v2 timeout-minutes: ${{ fromJSON(env.CACHE_TIMEOUT_MINUTES) }} diff --git a/.gitignore b/.gitignore index 388ae9912a7b..bf9879be92a0 100644 --- a/.gitignore +++ b/.gitignore @@ -9,6 +9,7 @@ config*.toml *.orig criterion genesis.json -/.cargo +/.cargo/* +!/.cargo/*.toml node/rpc-api/static/ast.ron documentation/book/**/* \ No newline at end of file diff --git a/Cargo.lock b/Cargo.lock index 38f8713bfc00..efdf49aecb68 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3807,9 +3807,9 @@ checksum = "1847abb9cb65d566acd5942e94aea9c8f547ad02c98e1649326fc0e8910b8b1e" [[package]] name = "futures" -version = "0.3.24" +version = "0.3.25" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7f21eda599937fba36daeb58a22e8f5cee2d14c4a17b5b7739c7c8e5e3b8230c" +checksum = "38390104763dc37a5145a53c29c63c1290b5d316d6086ec32c293f6736051bb0" dependencies = [ "futures-channel", "futures-core", @@ -3822,9 +3822,9 @@ dependencies = [ [[package]] name = "futures-channel" -version = "0.3.24" +version = "0.3.25" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "30bdd20c28fadd505d0fd6712cdfcb0d4b5648baf45faef7f852afb2399bb050" +checksum = "52ba265a92256105f45b719605a571ffe2d1f0fea3807304b522c1d778f79eed" dependencies = [ "futures-core", "futures-sink", @@ -3832,15 +3832,15 @@ dependencies = [ [[package]] name = "futures-core" -version = "0.3.24" +version = "0.3.25" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4e5aa3de05362c3fb88de6531e6296e85cde7739cccad4b9dfeeb7f6ebce56bf" +checksum = "04909a7a7e4633ae6c4a9ab280aeb86da1236243a77b694a49eacd659a4bd3ac" [[package]] name = "futures-executor" -version = "0.3.24" +version = "0.3.25" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9ff63c23854bee61b6e9cd331d523909f238fc7636290b96826e9cfa5faa00ab" +checksum = "7acc85df6714c176ab5edf386123fafe217be88c0840ec11f199441134a074e2" dependencies = [ "futures-core", "futures-task", @@ -3850,9 +3850,9 @@ dependencies = [ [[package]] name = "futures-io" -version = "0.3.24" +version = "0.3.25" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bbf4d2a7a308fd4578637c0b17c7e1c7ba127b8f6ba00b29f717e9655d85eb68" +checksum = "00f5fb52a06bdcadeb54e8d3671f8888a39697dcb0b81b23b55174030427f4eb" [[package]] name = "futures-lite" @@ -3871,9 +3871,9 @@ dependencies = [ [[package]] name = "futures-macro" -version = "0.3.24" +version = "0.3.25" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "42cd15d1c7456c04dbdf7e88bcd69760d74f3a798d6444e16974b505b0e62f17" +checksum = "bdfb8ce053d86b91919aad980c220b1fb8401a9394410e1c289ed7e66b61835d" dependencies = [ "proc-macro2 1.0.47", "quote 1.0.21", @@ -3893,15 +3893,15 @@ dependencies = [ [[package]] name = "futures-sink" -version = "0.3.24" +version = "0.3.25" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "21b20ba5a92e727ba30e72834706623d94ac93a725410b6a6b6fbc1b07f7ba56" +checksum = "39c15cf1a4aa79df40f1bb462fb39676d0ad9e366c2a33b590d7c66f4f81fcf9" [[package]] name = "futures-task" -version = "0.3.24" +version = "0.3.25" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a6508c467c73851293f390476d4491cf4d227dbabcd4170f3bb6044959b294f1" +checksum = "2ffb393ac5d9a6eaa9d3fdf37ae2776656b706e200c8e16b1bdb227f5198e6ea" [[package]] name = "futures-timer" @@ -3911,9 +3911,9 @@ checksum = "e64b03909df88034c26dc1547e8970b91f98bdb65165d6a4e9110d94263dbb2c" [[package]] name = "futures-util" -version = "0.3.24" +version = "0.3.25" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "44fb6cb1be61cc1d2e43b262516aafcf63b241cffdb1d3fa115f91d9c7b09c90" +checksum = "197676987abd2f9cadff84926f410af1c183608d36641465df73ae8211dc65d6" dependencies = [ "futures-channel", "futures-core", @@ -7721,9 +7721,9 @@ dependencies = [ [[package]] name = "serde_json" -version = "1.0.86" +version = "1.0.87" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "41feea4228a6f1cd09ec7a3593a682276702cd67b5273544757dae23c096f074" +checksum = "6ce777b7b150d76b9cf60d28b55f5847135a003f7d7350c6be7a773508ce7d45" dependencies = [ "itoa", "ryu", diff --git a/Dockerfile b/Dockerfile index 3f8bac33952d..7c276f7382fe 100644 --- a/Dockerfile +++ b/Dockerfile @@ -18,7 +18,7 @@ FROM rust:1-buster AS build-env # Install dependencies -RUN apt-get update && apt-get install --no-install-recommends -y build-essential clang ocl-icd-opencl-dev cmake +RUN apt-get update && apt-get install --no-install-recommends -y build-essential clang lld ocl-icd-opencl-dev cmake WORKDIR /usr/src/forest COPY . . diff --git a/Makefile b/Makefile index 4c184d6ff3ff..b18346581454 100644 --- a/Makefile +++ b/Makefile @@ -8,6 +8,10 @@ install-daemon: install: install-cli install-daemon +install-deps: + apt-get update -y + apt-get install --no-install-recommends -y build-essential clang lld ocl-icd-opencl-dev cmake + clean-all: cargo clean @@ -115,4 +119,4 @@ mdbook-build: rustdoc: cargo doc --workspace --all-features --no-deps -.PHONY: clean clean-all lint build release test test-all test-release license test-vectors run-vectors pull-serialization-tests install-cli install-daemon install docs run-serialization-vectors rustdoc +.PHONY: clean clean-all lint build release test test-all test-release license test-vectors run-vectors pull-serialization-tests install-cli install-daemon install install-deps docs run-serialization-vectors rustdoc diff --git a/README.md b/README.md index 51dd72698d19..21609f9d35fc 100644 --- a/README.md +++ b/README.md @@ -63,6 +63,8 @@ rustup install nightly ```shell # Ubuntu +sudo make install-deps +# Or sudo apt install build-essential clang ocl-icd-opencl-dev libssl-dev # Archlinux