From 461d6a77953c14d9d273f76d430a9d56c2c6d26b Mon Sep 17 00:00:00 2001 From: Hubert Bugaj Date: Thu, 18 Dec 2025 20:06:53 +0100 Subject: [PATCH 1/9] chore: move from Makefile to mise --- .github/workflows/butterflynet.yml | 6 +- .github/workflows/cargo-advisories.yml | 2 +- .github/workflows/coverage.yml | 6 +- .github/workflows/docker.yml | 12 +- .github/workflows/forest.yml | 15 +- .github/workflows/go-lint.yml | 12 +- .github/workflows/rust-lint.yml | 23 +-- .github/workflows/scripts-lint.yml | 30 ++-- .github/workflows/unit-tests.yml | 4 +- CONTRIBUTING.md | 6 +- Dockerfile | 5 +- README.md | 61 ++----- docs/dictionary.txt | 1 + docs/docs/users/getting_started/install.md | 4 +- {scripts => mise-tasks}/add_license.sh | 4 +- mise-tasks/lint/lists.sh | 21 +++ mise.toml | 183 +++++++++++++++++++++ scripts/linters/find_unused_deps.rb | 2 +- 18 files changed, 261 insertions(+), 136 deletions(-) rename {scripts => mise-tasks}/add_license.sh (83%) create mode 100755 mise-tasks/lint/lists.sh create mode 100644 mise.toml diff --git a/.github/workflows/butterflynet.yml b/.github/workflows/butterflynet.yml index 9b7b5f4c6487..c3487956fde2 100644 --- a/.github/workflows/butterflynet.yml +++ b/.github/workflows/butterflynet.yml @@ -24,14 +24,12 @@ jobs: uses: mozilla-actions/sccache-action@v0.0.9 timeout-minutes: ${{ fromJSON(env.CACHE_TIMEOUT_MINUTES) }} continue-on-error: true - - uses: actions/setup-go@v6 - with: - go-version-file: "go.work" + - uses: jdx/mise-action@v3 - name: Build and install Forest binaries env: # To minimize compile times: https://nnethercote.github.io/perf-book/build-configuration.html#minimizing-compile-times RUSTFLAGS: "-C linker=clang -C link-arg=-fuse-ld=lld" - run: make install-slim-quick + run: mise run install --slim - name: Run butterflynet checks run: ./scripts/tests/butterflynet_check.sh timeout-minutes: ${{ fromJSON(env.SCRIPT_TIMEOUT_MINUTES) }} diff --git a/.github/workflows/cargo-advisories.yml b/.github/workflows/cargo-advisories.yml index d19f21c32aa5..e8dc2b6ebf01 100644 --- a/.github/workflows/cargo-advisories.yml +++ b/.github/workflows/cargo-advisories.yml @@ -8,7 +8,7 @@ jobs: runs-on: ubuntu-24.04-arm steps: - uses: actions/checkout@v6 - - run: make install-cargo-binstall + - uses: jdx/mise-action@v3 - run: cargo binstall --no-confirm cargo-deny - run: cargo deny check advisories - name: Set WORKFLOW_URL diff --git a/.github/workflows/coverage.yml b/.github/workflows/coverage.yml index dc7459d93eaa..847a8db4060a 100644 --- a/.github/workflows/coverage.yml +++ b/.github/workflows/coverage.yml @@ -59,9 +59,7 @@ jobs: uses: mozilla-actions/sccache-action@v0.0.9 timeout-minutes: ${{ fromJSON(env.CACHE_TIMEOUT_MINUTES) }} continue-on-error: true - - uses: actions/setup-go@v6 - with: - go-version-file: "go.work" + - uses: jdx/mise-action@v3 - uses: taiki-e/install-action@cargo-llvm-cov - uses: taiki-e/install-action@nextest - name: Fetch proof params and RPC test snapshots @@ -69,7 +67,7 @@ jobs: cargo run --bin forest-dev --no-default-features --profile quick -- fetch-rpc-tests ls -ahl $FIL_PROOFS_PARAMETER_CACHE - name: Generate code coverage - run: make codecov + run: mise codecov # Save lcov.info as an artifact for debugging purposes - uses: actions/upload-artifact@v6 with: diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index 00447ba52f82..58858aa9ed8f 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -59,14 +59,12 @@ jobs: uses: mozilla-actions/sccache-action@v0.0.9 timeout-minutes: ${{ fromJSON(env.CACHE_TIMEOUT_MINUTES) }} continue-on-error: true - - uses: actions/setup-go@v6 - with: - go-version-file: "go.work" + - uses: jdx/mise-action@v3 - name: Cargo Install env: # To minimize compile times: https://nnethercote.github.io/perf-book/build-configuration.html#minimizing-compile-times RUSTFLAGS: "-C linker=clang -C link-arg=-fuse-ld=lld" - run: make install + run: mise run install release - uses: actions/upload-artifact@v6 with: name: "forest-linux-amd64" @@ -104,13 +102,11 @@ jobs: if: github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/v') timeout-minutes: ${{ fromJSON(env.CACHE_TIMEOUT_MINUTES) }} continue-on-error: true - - uses: actions/setup-go@v6 + - uses: jdx/mise-action@v3 if: github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/v') - with: - go-version-file: "go.work" - name: Cargo Install if: github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/v') - run: make install + run: mise run install release - uses: actions/upload-artifact@v6 if: github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/v') with: diff --git a/.github/workflows/forest.yml b/.github/workflows/forest.yml index 93914817933b..2c8de2a73a20 100644 --- a/.github/workflows/forest.yml +++ b/.github/workflows/forest.yml @@ -82,17 +82,15 @@ jobs: uses: mozilla-actions/sccache-action@v0.0.9 timeout-minutes: ${{ fromJSON(env.CACHE_TIMEOUT_MINUTES) }} continue-on-error: true - - uses: actions/setup-go@v6 - with: - go-version-file: "go.work" + - uses: jdx/mise-action@v3 - name: Go tests run: | go test -v ./tools/prometheus_metrics_validator - - name: Cargo Install + - name: Install Forest env: # To minimize compile times: https://nnethercote.github.io/perf-book/build-configuration.html#minimizing-compile-times RUSTFLAGS: "-C linker=clang -C link-arg=-fuse-ld=lld" - run: make install-slim-quick + run: mise run install --slim - uses: actions/upload-artifact@v6 with: name: "forest-${{ runner.os }}" @@ -108,12 +106,7 @@ jobs: uses: mozilla-actions/sccache-action@v0.0.9 timeout-minutes: ${{ fromJSON(env.CACHE_TIMEOUT_MINUTES) }} continue-on-error: true - - name: Install Apt Dependencies - run: | - sudo make install-deps - - uses: actions/setup-go@v6 - with: - go-version-file: "go.work" + - uses: jdx/mise-action@v3 - run: cargo publish --dry-run forest-cli-check: needs: diff --git a/.github/workflows/go-lint.yml b/.github/workflows/go-lint.yml index b6dcf7148fb2..8da6412441b1 100644 --- a/.github/workflows/go-lint.yml +++ b/.github/workflows/go-lint.yml @@ -15,8 +15,7 @@ on: - main paths: - ".github/workflows/go-lint.yml" - - "Makefile" - - "go.work" + - "mise.toml" - "f3-sidecar/**" - "interop-tests/src/tests/**" push: @@ -24,8 +23,7 @@ on: - main paths: - ".github/workflows/go-lint.yml" - - "Makefile" - - "go.work" + - "mise.toml" - "f3-sidecar/**" - "interop-tests/src/tests/**" @@ -35,7 +33,5 @@ jobs: runs-on: ubuntu-24.04-arm steps: - uses: actions/checkout@v6 - - uses: actions/setup-go@v6 - with: - go-version-file: "go.work" - - run: make lint-go + - uses: jdx/mise-action@v3 + - run: mise lint:golang diff --git a/.github/workflows/rust-lint.yml b/.github/workflows/rust-lint.yml index fdb5d4dfa432..fa63c6cc1f53 100644 --- a/.github/workflows/rust-lint.yml +++ b/.github/workflows/rust-lint.yml @@ -50,9 +50,7 @@ jobs: uses: mozilla-actions/sccache-action@v0.0.9 timeout-minutes: ${{ fromJSON(env.CACHE_TIMEOUT_MINUTES) }} continue-on-error: true - - uses: actions/setup-go@v6 - with: - go-version-file: "go.work" + - uses: jdx/mise-action@v3 - name: Apt Dependencies uses: nick-fields/retry@v3 with: @@ -60,23 +58,10 @@ jobs: max_attempts: 3 command: | sudo apt-get install -y libclang-dev # required dep for cargo-spellcheck - - name: Install Lint tools - run: make install-lint-tools-ci + - name: Lint env: RUSTFLAGS: "-Cstrip=symbols" GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - - run: make lint-all - - dependencies-check: - name: Check cargo files - runs-on: ubuntu-24.04-arm - steps: - - uses: actions/checkout@v6 - - name: Set up Ruby - uses: ruby/setup-ruby@v1 - with: - ruby-version: "3.0" - - name: Run dependencies checks run: | - gem install toml-rb --no-document - ruby scripts/linters/find_unused_deps.rb + mise install-lint-tools + mise lint:all-rust diff --git a/.github/workflows/scripts-lint.yml b/.github/workflows/scripts-lint.yml index be7e652013a0..2ebd2aff4f86 100644 --- a/.github/workflows/scripts-lint.yml +++ b/.github/workflows/scripts-lint.yml @@ -16,25 +16,19 @@ on: jobs: shellcheck: - runs-on: ubuntu-24.04 + runs-on: ubuntu-24.04-arm steps: - uses: actions/checkout@v6 + - uses: jdx/mise-action@v3 - name: Run shellcheck - uses: ludeeus/action-shellcheck@2.0.0 - env: - SHELLCHECK_OPTS: --external-sources --source-path=SCRIPTDIR + run: mise lint:shellcheck + rubocop: runs-on: ubuntu-24.04-arm steps: - uses: actions/checkout@v6 - - name: Set up Ruby - uses: ruby/setup-ruby@v1 - with: - ruby-version: "3.0" - - name: Run rubocop - run: | - gem install rubocop -v 1.58 --no-document - rubocop scripts/ + - uses: jdx/mise-action@v3 + - run: mise lint:ruby python-lint: if: ${{ !startsWith(github.ref, 'refs/heads/gh-readonly-queue/') }} runs-on: ubuntu-24.04-arm @@ -75,18 +69,14 @@ jobs: runs-on: ubuntu-24.04-arm steps: - uses: actions/checkout@v6 - - uses: actions/setup-node@v6 - with: - node-version: 20 - package-manager-cache: false - - run: corepack enable - - run: yarn --immutable - - run: yarn yaml-check + - uses: jdx/mise-action@v3 + - run: mise lint:yaml lists-lint: runs-on: ubuntu-24.04-arm steps: - uses: actions/checkout@v6 + - uses: jdx/mise-action@v3 - name: Sort and verify lists run: | - make sort-lists + mise lint:lists git diff --exit-code diff --git a/.github/workflows/unit-tests.yml b/.github/workflows/unit-tests.yml index 7ae5cc27776b..8ee9c6cb00f1 100644 --- a/.github/workflows/unit-tests.yml +++ b/.github/workflows/unit-tests.yml @@ -77,9 +77,9 @@ jobs: run: | cargo run --bin forest-dev --no-default-features --profile quick -- fetch-rpc-tests ls -ahl $FIL_PROOFS_PARAMETER_CACHE + - uses: jdx/mise-action@v3 - run: | - make test-release-docs - make test-release + mise test release env: # To minimize compile times: https://nnethercote.github.io/perf-book/build-configuration.html#minimizing-compile-times RUSTFLAGS: "-C linker=clang -C link-arg=-fuse-ld=lld" diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index b7b51c843615..660960bcb5fb 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -187,7 +187,7 @@ You will also need to install Go - the toolchain version is specified in the the [Go website](https://golang.org/doc/install). We also use linters and tools to work with the code - you can install them by -running `make install-lint-tools`. +running `mise install-lint-tools`. #### 👥Fork and clone the repository @@ -198,7 +198,7 @@ your local machine. You can read more in the #### ✅Check that everything works Before you start making changes, you should make sure that everything works. You -can do this by running the tests with `make test`. Note that you need to have +can do this by running the tests with `mise test`. Note that you need to have [cargo nextest](https://nexte.st/) installed to run the tests. #### 💻Make your changes @@ -241,7 +241,7 @@ public functions and structs. Please refer to the Forest team's Formatting is standardised via various formatting tools for different technologies. Please make sure to run the appropriate formatter before submitting your code, otherwise it will not pass the CI checks. You can format -the code, including markdown files, with `make fmt`. +the code, including markdown files, with `mise fmt`. ### 💬 Commit Messages diff --git a/Dockerfile b/Dockerfile index a207eb2d33d4..0474d94fea95 100644 --- a/Dockerfile +++ b/Dockerfile @@ -20,6 +20,9 @@ ENV CC=clang-14 CXX=clang++-14 RUN curl https://sh.rustup.rs -sSf | sh -s -- -y --no-modify-path --profile minimal ENV PATH="/root/.cargo/bin:${PATH}" +# install mise-en-place +RUN curl https://mise.run | sh + WORKDIR /forest COPY . . @@ -27,7 +30,7 @@ COPY . . RUN --mount=type=cache,sharing=private,target=/root/.cargo/registry \ --mount=type=cache,sharing=private,target=/root/.rustup \ --mount=type=cache,sharing=private,target=/forest/target \ - make install && \ + mise install && \ mkdir /forest_out && \ cp /root/.cargo/bin/forest* /forest_out diff --git a/README.md b/README.md index 412a6a3c6b2c..589dfc79ea06 100644 --- a/README.md +++ b/README.md @@ -67,30 +67,21 @@ Install [Go](https://go.dev/doc/install) - OS Base-Devel/Build-Essential - Clang compiler +The project also uses [mise-en-place](https://mise.jdx.dev/) to handle builds and +installations. + ### Ubuntu (20.04) ``` sudo apt install build-essential clang ``` -### Archlinux - -``` -sudo pacman -S base-devel clang -``` - ### Fedora (36) ``` sudo dnf install -y clang-devel ``` -### Alpine - -``` -apk add git curl make gcc clang clang-dev musl-dev -``` - ## Installation ```shell @@ -99,25 +90,12 @@ git clone --recursive https://github.com/chainsafe/forest cd forest # Install binary to $HOME/.cargo/bin -make install +mise install # Run the node on mainnet forest ``` -To create release binaries, checkout the latest tag and compile with the release -feature. -[![GitHub release (latest by date)](https://img.shields.io/github/v/release/ChainSafe/forest?style=for-the-badge)](https://github.com/ChainSafe/forest/releases/latest) - -```shell -git checkout $TAG -make build # make debug build of forest daemon and cli -# or -make release # make release build of forest daemon and cli -# or -make install # install forest daemon and cli -``` - ### Config #### Keystore @@ -187,11 +165,10 @@ cargo install cargo-nextest --locked ``` ```bash -# To run base tests -cargo nextest run # use `make test-release` for longer compilation but faster execution - -# To run all tests and all features enabled -make test-all +# To run all tests +mise test +# Or, with a different profile +mise test release ``` Chain synchronization checks are run after every merge to `main`. This code is @@ -204,26 +181,8 @@ secure in an automated fashion. While the CI will have them installed, if you want to run them yourself before submitting a PR (recommended), you should install a few of them. -```bash -# You can install those linters also with other package managers or by manually grabbing the binaries from the projects' repositories. - -# Rust code linter -rustup component add clippy - -# Rust code formatter -rustup component add rustfmt - -# TOML linter -cargo install taplo-cli --locked - -# Scanning dependencies for security vulnerabilities -cargo install cargo-audit - -# Spellcheck -cargo install cargo-spellcheck -``` - -After everything is installed, you can run `make lint-all`. +You can install required linters with `mise install-lint-tools`. +After everything is installed, you can run `mise lint`. ### Joining the testnet diff --git a/docs/dictionary.txt b/docs/dictionary.txt index 6410f70e2363..39e72491b173 100644 --- a/docs/dictionary.txt +++ b/docs/dictionary.txt @@ -76,6 +76,7 @@ M2 macOS Mainnet mainnet +mise-en-place multiaddress namespace NetworkEvents diff --git a/docs/docs/users/getting_started/install.md b/docs/docs/users/getting_started/install.md index 09ac1184fae3..485c9f305860 100644 --- a/docs/docs/users/getting_started/install.md +++ b/docs/docs/users/getting_started/install.md @@ -99,8 +99,10 @@ cargo install forest-filecoin git clone --depth 1 https://github.com/ChainSafe/forest.git && cd forest ``` +Use [mise-en-place](https://mise.jdx.dev/) to handle the build and installation: + ```shell -make install +mise install ``` Both approaches will compile and install `forest` and `forest-cli` to diff --git a/scripts/add_license.sh b/mise-tasks/add_license.sh similarity index 83% rename from scripts/add_license.sh rename to mise-tasks/add_license.sh index d61238326823..0f68fde3036d 100755 --- a/scripts/add_license.sh +++ b/mise-tasks/add_license.sh @@ -1,6 +1,6 @@ #!/bin/bash -# -# Checks if the source code contains required license and adds it if necessary. +#MISE description="Checks if the source code contains required license and adds it if necessary." + # Returns 1 if there was a missing license, 0 otherwise. PAT_APA="^// Copyright 2019-2025 ChainSafe Systems// SPDX-License-Identifier: Apache-2.0, MIT$" diff --git a/mise-tasks/lint/lists.sh b/mise-tasks/lint/lists.sh new file mode 100755 index 000000000000..c24a213fa546 --- /dev/null +++ b/mise-tasks/lint/lists.sh @@ -0,0 +1,21 @@ +#!/bin/bash +#MISE description="Sorts specified list files in place to ensure consistent ordering." + +LISTS=( + "./src/tool/subcommands/api_cmd/test_snapshots_ignored.txt" + "./src/tool/subcommands/api_cmd/test_snapshots.txt" +) + +export LC_ALL=C + +# Sort each list file in place +for FILE in "${LISTS[@]}"; do + if [[ -f "$FILE" ]]; then + sort --unique -o "$FILE" "$FILE" + echo "Sorted $FILE" + else + echo "File $FILE does not exist." + fi + done +echo "All specified list files have been sorted." + diff --git a/mise.toml b/mise.toml new file mode 100644 index 000000000000..fc28fe0d9b48 --- /dev/null +++ b/mise.toml @@ -0,0 +1,183 @@ +[tasks.install] +description = "Installs all Forest binaries with a specified profile." +usage = ''' +arg "" help="Installation profile (quick, release, etc.)" default="quick" { + choices "quick" "release" "dev" +} +flag "--slim" help="Install a slim version" +flag "-v --verbose" help="Enable verbose output" +''' +run = ''' +echo "Installing Forest binaries with profile: ${usage_profile?}" +[[ -n "${usage_verbose}" ]] && set -x +if [ "${usage_slim}" = true ]; then + SLIM_FLAGS="--no-default-features --features slim" +fi +cargo install --profile ${usage_profile} ${SLIM_FLAGS} --locked --path . --force +''' +alias = 'i' + +[tasks.install-lint-tools] +description = "Installs linting tools for CI" +tools.cargo-binstall = "latest" +run = "cargo binstall --no-confirm taplo-cli cargo-spellcheck cargo-deny" + +[tasks."lint:deny"] +description = "Run cargo-deny to check for license and security issues." +run = ''' +cargo deny check bans licenses sources || (echo "See deny.toml"; false) +''' + +[tasks."lint:spellcheck"] +description = "Run cargo-spellcheck to check for spelling errors." +run = ''' +cargo spellcheck --code 1 || (echo "See .config/spellcheck.md for tips"; false) +''' + +[tasks."lint:toml"] +description = "Run taplo-cli to check TOML files." +run = ''' +taplo fmt --check +taplo lint +''' + +[tasks."lint:rust-fmt"] +description = "Run cargo-fmt to check Rust code formatting." +run = ''' +cargo fmt --all -- --check +''' + +[tasks."lint:clippy"] +description = "Run cargo-clippy to check Rust code for common mistakes." +run = ''' +cargo clippy --all-targets --quiet --no-deps -- --deny=warnings +cargo clippy --all-targets --no-default-features --features slim --quiet --no-deps -- --deny=warnings +cargo clippy --all-targets --no-default-features --quiet --no-deps -- --deny=warnings +cargo clippy --benches --features benchmark-private --quiet --no-deps -- --deny=warnings +# check docs.rs build +DOCS_RS=1 cargo clippy --all-targets --quiet --no-deps -- --deny=warnings +''' + +[tasks."lint:unused-deps"] +description = "Check for unused dependencies in Rust code." +tools.ruby = "latest" +run = ''' +gem install --no-document toml-rb +ruby scripts/linters/find_unused_deps.rb +''' + +[tasks."lint:dockerfile"] +description = "Lint Dockerfiles using hadolint." +tools.hadolint = "latest" +run = ''' +hadolint Dockerfile* +''' + +[tasks."lint:shellcheck"] +description = "Lint shell scripts using shellcheck." +tools.shellcheck = "latest" +run = ''' +shellcheck --external-sources --source-path=SCRIPTDIR **/*.sh +''' + +[tasks."lint:golang"] +description = "Lint Go code using golangci-lint." +tools.golangci-lint = "latest" +run = ''' +golangci-lint run ./f3-sidecar ./interop-tests/src/tests/go_app +''' + +[tasks."lint:ruby"] +description = "Lint Ruby code using rubocop." +tools.ruby = "latest" +tools."gem:rubocop" = "1.58" +run = ''' +rubocop scripts/ +''' + +[tasks.lint] +description = "Run all linting tasks." +depends = ["lint:*"] + +[tasks."lint:all-rust"] +description = "Run all Rust linting tasks." +depends = [ + "lint:deny", + "lint:spellcheck", + "lint:rust-fmt", + "lint:clippy", + "lint:unused-deps", +] + +[tasks."lint:yaml"] +description = "Lint YAML files." +run = ''' +corepack enable && yarn && yarn install +yarn yaml-fmt +yarn yaml-check +''' + +[tasks.fmt] +description = "Format all supported code." +run = ''' +cargo fmt --all +taplo fmt --write +corepack enable && yarn && yarn install +yarn md-fmt +yarn yaml-fmt +''' + +[tasks.clean] +description = "Cleanup all build artifacts and dependencies." +run = ''' +cargo clean +rm -rf node_modules +''' + +[tasks."test:docs"] +# nextest doesn't run doctests https://github.com/nextest-rs/nextest/issues/16 +# We need to run them separately. +description = "Run doctests." +usage = ''' +arg "" help="Build profile (quick, release, etc.)" default="quick" { + choices "quick" "release" "dev" +} +''' +run = ''' +cargo nextest run --cargo-profile ${usage_profile?} --workspace --no-fail-fast +''' + +[tasks."test:rust"] +description = "Run Rust unit and integration tests." +usage = ''' +arg "" help="Build profile (quick, release, etc.)" default="quick" { + choices "quick" "release" "dev" +} +''' +run = ''' +echo "Running tests with profile: ${usage_profile?}" +cargo nextest run --cargo-profile ${usage_profile?} --workspace --no-fail-fast +''' + +[tasks.test] +description = "Run all tests." +usage = ''' +arg "" help="Build profile (quick, release, etc.)" default="quick" { + choices "quick" "release" "dev" +} +''' +run = ''' +mise task run test:rust ${usage_profile?} +mise task run test:docs ${usage_profile?} +''' + +[tasks.codecov] +description = "Generate codecov report" +run = ''' +cargo llvm-cov -p forest-filecoin --codecov --output-path lcov.info +''' + +[tools] +cargo-binstall = "latest" +go = "latest" +yarn = "latest" diff --git a/scripts/linters/find_unused_deps.rb b/scripts/linters/find_unused_deps.rb index 0b93469fb067..284353e18441 100644 --- a/scripts/linters/find_unused_deps.rb +++ b/scripts/linters/find_unused_deps.rb @@ -16,7 +16,7 @@ def excluded?(crates, crate) crate == 'quickcheck' && crates.include?('quickcheck_macros') end -Dir.glob('**/*.toml').each do |file| +Dir.glob('**/Cargo.toml').each do |file| crate_dir = File.dirname(file) toml = TomlRB.load_file(file) crates = Set.new From e9f96872528df650248221c7134eaf0dcf0200aa Mon Sep 17 00:00:00 2001 From: Hubert Bugaj Date: Thu, 8 Jan 2026 13:18:01 +0100 Subject: [PATCH 2/9] chore: rm Makefile --- Makefile | 173 ------------------------------------------------------ mise.toml | 4 +- 2 files changed, 2 insertions(+), 175 deletions(-) delete mode 100644 Makefile diff --git a/Makefile b/Makefile deleted file mode 100644 index 1bb104ae1e4a..000000000000 --- a/Makefile +++ /dev/null @@ -1,173 +0,0 @@ -install: - cargo install --locked --path . --force - -install-quick: - cargo install --profile quick --locked --path . --force - -install-slim: - cargo install --no-default-features --features slim --locked --path . --force - -install-slim-quick: - cargo install --profile quick --no-default-features --features slim --locked --path . --force - -install-minimum: - cargo install --no-default-features --locked --path . --force - -install-lto-fat: - cargo install --locked --force --profile release-lto-fat --path . - -install-minimum-quick: - cargo install --profile quick --no-default-features --locked --path . --force - -# Installs Forest binaries with default rust global allocator -install-with-rustalloc: - cargo install --locked --path . --force --no-default-features --features rustalloc - -install-lint-tools: - cargo install --locked taplo-cli - cargo install --locked cargo-deny - cargo install --locked cargo-spellcheck - -# Denotes the architecture of the machine. This is required for direct binary downloads. -# Note that some repositories might use different names for the same architecture. -CPU_ARCH := $(shell \ - ARCH=$$(uname -m); \ - if [ "$$ARCH" = "arm64" ]; then \ - ARCH="aarch64"; \ - fi; \ - echo "$$ARCH" \ -) - -install-cargo-binstall: - wget https://github.com/cargo-bins/cargo-binstall/releases/latest/download/cargo-binstall-$(CPU_ARCH)-unknown-linux-musl.tgz - tar xzf cargo-binstall-$(CPU_ARCH)-unknown-linux-musl.tgz - cp cargo-binstall ~/.cargo/bin/cargo-binstall - -install-lint-tools-ci: install-cargo-binstall - cargo binstall --no-confirm taplo-cli cargo-spellcheck cargo-deny - -clean: - cargo clean - -# Lints with everything we have in our CI arsenal -lint-all: lint deny spellcheck - -deny: - cargo deny check bans licenses sources || (echo "See deny.toml"; false) - -spellcheck: - cargo spellcheck --code 1 || (echo "See .config/spellcheck.md for tips"; false) - -lint: license clean lint-clippy - cargo fmt --all --check - taplo fmt --check - taplo lint - -# Don't bother linting different allocators -# --quiet: don't show build logs -lint-clippy: - cargo clippy --all-targets --quiet --no-deps -- --deny=warnings - cargo clippy --all-targets --no-default-features --features slim --quiet --no-deps -- --deny=warnings - cargo clippy --all-targets --no-default-features --quiet --no-deps -- --deny=warnings - cargo clippy --benches --features benchmark-private --quiet --no-deps -- --deny=warnings - # check docs.rs build - DOCS_RS=1 cargo clippy --all-targets --quiet --no-deps -- --deny=warnings - -DOCKERFILES=$(wildcard Dockerfile*) -lint-docker: $(DOCKERFILES) - docker run --rm -i hadolint/hadolint < $< - -lint-go: - go run github.com/golangci/golangci-lint/v2/cmd/golangci-lint@v2.3.1 run ./f3-sidecar ./interop-tests/src/tests/go_app - -# Formats Rust, TOML and Markdown files. -fmt: - cargo fmt --all - taplo fmt - corepack enable && yarn && yarn md-fmt - -md-check: - corepack enable && yarn && yarn md-check - -build: - cargo build - -release: - cargo build --release - -docker-run: - docker build -t forest:latest -f ./Dockerfile . && docker run forest - -test: - cargo nextest run --workspace --no-fail-fast - -test-docs: - # nextest doesn't run doctests https://github.com/nextest-rs/nextest/issues/16 - # see also lib.rs::doctest_private - cargo test --doc --features doctest-private - -test-release: - cargo nextest run --cargo-profile quick --workspace --no-fail-fast - -test-release-docs: - # nextest doesn't run doctests https://github.com/nextest-rs/nextest/issues/16 - # see also lib.rs::doctest_private - cargo test --profile quick --doc --features doctest-private - -codecov: - cargo llvm-cov -p forest-filecoin --codecov --output-path lcov.info - -# Checks if all headers are present and adds if not -license: - ./scripts/add_license.sh - -docs: - cargo doc --no-deps - -# Lexicographical sort of lists in various config files -LIST_FILES = \ - ./src/tool/subcommands/api_cmd/test_snapshots_ignored.txt \ - ./src/tool/subcommands/api_cmd/test_snapshots.txt - -sort-lists: $(LIST_FILES) - -$(LIST_FILES): - LC_ALL=C sort --unique $@ -o $@ - -.PHONY: sort-lists $(LIST_FILES) - -## -## Memory Profiling -## - -# Read up on memory profiling in Forest: https://rumcajs.dev/posts/memory-analysis-in-rust/ - -# Memory profiling is done with the `profiling` profile. There's no silver bullet for memory profiling, so we provide a few options here. - -### Gperftools -# https://github.com/gperftools/gperftools - -# Profile with gperftools (Memory/Heap profiler) -# There is a workaround there, as outlined in https://github.com/gperftools/gperftools/issues/1603 -gperfheapprofile = FOREST_PROFILING_GPERFTOOLS_BUILD=1 cargo build --no-default-features --features system-alloc --profile=profiling --bin $(1); \ - ulimit -n 8192; \ - HEAPPROFILE_USE_PID=t HEAPPROFILE=/tmp/gperfheap.$(1).prof target/profiling/$(1) $(2) - -gperfheapprofile.forest: - $(call gperfheapprofile,forest, --chain calibnet --encrypt-keystore=false) - -# To visualize the heap profile, run: -# pprof -http=localhost:8080 " help="Installation profile (quick, release, etc.)" default="quick" { - choices "quick" "release" "dev" +arg "" help="Installation profile (quick, release, etc.)" default="release" { + choices "quick" "release" "release-lto-fat" "dev" "debugging" "profiling" } flag "--slim" help="Install a slim version" flag "-v --verbose" help="Enable verbose output" From 16762a000dc705ac1cf5250199ac984561d33280 Mon Sep 17 00:00:00 2001 From: Hubert Bugaj Date: Thu, 8 Jan 2026 14:11:34 +0100 Subject: [PATCH 3/9] chore: mise install more solid --- .dockerignore | 1 + CHANGELOG.md | 2 ++ Dockerfile | 8 ++++---- build/vendored-docs-redirect.index.html | 15 ++++++++------- mise.toml | 12 +++--------- scripts/install_mise.sh | 13 +++++++++++++ 6 files changed, 31 insertions(+), 20 deletions(-) create mode 100755 scripts/install_mise.sh diff --git a/.dockerignore b/.dockerignore index 8994ff54dec8..bf24cafe8f80 100644 --- a/.dockerignore +++ b/.dockerignore @@ -5,6 +5,7 @@ Dockerfile *.md target/ scripts/ +!scripts/install_mise.sh # Ignore CAR files fetched to the project directory which tends to happen during development. # Without it, the Docker context may bloat to hundreds of gigabytes of data. diff --git a/CHANGELOG.md b/CHANGELOG.md index 841bb1f890fa..48719cf1305e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -39,6 +39,8 @@ ### Changed +- [#6368](https://github.com/ChainSafe/forest/pull/6368): Migrated build and development tooling from Makefile to `mise`. Contributors should install `mise` and use `mise run` commands instead of `make` commands. + ### Removed ### Fixed diff --git a/Dockerfile b/Dockerfile index 0474d94fea95..e4b2bf3afdde 100644 --- a/Dockerfile +++ b/Dockerfile @@ -20,17 +20,17 @@ ENV CC=clang-14 CXX=clang++-14 RUN curl https://sh.rustup.rs -sSf | sh -s -- -y --no-modify-path --profile minimal ENV PATH="/root/.cargo/bin:${PATH}" -# install mise-en-place -RUN curl https://mise.run | sh - WORKDIR /forest COPY . . +RUN ./scripts/install_mise.sh + # Install Forest. Move it out of the cache for the prod image. RUN --mount=type=cache,sharing=private,target=/root/.cargo/registry \ --mount=type=cache,sharing=private,target=/root/.rustup \ --mount=type=cache,sharing=private,target=/forest/target \ - mise install && \ + mise trust && \ + mise run install && \ mkdir /forest_out && \ cp /root/.cargo/bin/forest* /forest_out diff --git a/build/vendored-docs-redirect.index.html b/build/vendored-docs-redirect.index.html index 1a458e5982cd..f852768348f8 100644 --- a/build/vendored-docs-redirect.index.html +++ b/build/vendored-docs-redirect.index.html @@ -1,9 +1,10 @@ - - + + - - - - - + + + diff --git a/mise.toml b/mise.toml index 500c1f533600..7887b6871b78 100644 --- a/mise.toml +++ b/mise.toml @@ -101,13 +101,7 @@ depends = ["lint:*"] [tasks."lint:all-rust"] description = "Run all Rust linting tasks." -depends = [ - "lint:deny", - "lint:spellcheck", - "lint:rust-fmt", - "lint:clippy", - "lint:unused-deps", -] +depends = ["lint:deny", "lint:spellcheck", "lint:rust-fmt", "lint:clippy", "lint:unused-deps"] [tasks."lint:yaml"] description = "Lint YAML files." @@ -121,7 +115,7 @@ yarn yaml-check description = "Format all supported code." run = ''' cargo fmt --all -taplo fmt --write +taplo fmt corepack enable && yarn && yarn install yarn md-fmt yarn yaml-fmt @@ -144,7 +138,7 @@ arg "" help="Build profile (quick, release, etc.)" default="quick" { } ''' run = ''' -cargo nextest run --cargo-profile ${usage_profile?} --workspace --no-fail-fast +cargo test --doc --profile ${usage_profile?} --workspace --no-fail-fast ''' [tasks."test:rust"] diff --git a/scripts/install_mise.sh b/scripts/install_mise.sh new file mode 100755 index 000000000000..1f1305dfea21 --- /dev/null +++ b/scripts/install_mise.sh @@ -0,0 +1,13 @@ +#!/bin/bash +set -euo pipefail +# Install mise securely by verifying the signature. It is meant to be run exclusively for installing mise in a Docker image. + +export GPG_KEY=24853EC9F655CE80B48E6C3A8B81C9D17413A06D +export MISE_VERSION=v2025.12.0 +export MISE_INSTALL_PATH=/bin/mise + +gpg --keyserver hkps://keys.openpgp.org --recv-keys 24853EC9F655CE80B48E6C3A8B81C9D17413A06D +curl https://mise.jdx.dev/install.sh.sig | gpg --decrypt > install-mise.sh +# ensure the above is signed with the mise release key +sh ./install-mise.sh +rm install-mise.sh From 664739d60bf1389b60da9e221775dca514ebff0a Mon Sep 17 00:00:00 2001 From: Hubert Bugaj Date: Thu, 8 Jan 2026 19:15:29 +0100 Subject: [PATCH 4/9] harden install script --- scripts/install_mise.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/install_mise.sh b/scripts/install_mise.sh index 1f1305dfea21..ad05156df105 100755 --- a/scripts/install_mise.sh +++ b/scripts/install_mise.sh @@ -6,8 +6,8 @@ export GPG_KEY=24853EC9F655CE80B48E6C3A8B81C9D17413A06D export MISE_VERSION=v2025.12.0 export MISE_INSTALL_PATH=/bin/mise -gpg --keyserver hkps://keys.openpgp.org --recv-keys 24853EC9F655CE80B48E6C3A8B81C9D17413A06D -curl https://mise.jdx.dev/install.sh.sig | gpg --decrypt > install-mise.sh +gpg --keyserver hkps://keys.openpgp.org --recv-keys ${GPG_KEY} +curl --fail https://mise.jdx.dev/install.sh.sig | gpg --decrypt > install-mise.sh # ensure the above is signed with the mise release key sh ./install-mise.sh rm install-mise.sh From 5df7e32649555eef6d5ab3e499da8a15ab4be31a Mon Sep 17 00:00:00 2001 From: Hubert Bugaj Date: Thu, 8 Jan 2026 19:18:11 +0100 Subject: [PATCH 5/9] fix package --- mise.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mise.toml b/mise.toml index 7887b6871b78..15e3a59cc77a 100644 --- a/mise.toml +++ b/mise.toml @@ -138,7 +138,7 @@ arg "" help="Build profile (quick, release, etc.)" default="quick" { } ''' run = ''' -cargo test --doc --profile ${usage_profile?} --workspace --no-fail-fast +cargo test --doc --profile ${usage_profile?} --features doctest-private --no-fail-fast ''' [tasks."test:rust"] From f4d384f162b127a05958d47a30c9870a1360e9f3 Mon Sep 17 00:00:00 2001 From: Hubert Bugaj Date: Thu, 8 Jan 2026 19:28:42 +0100 Subject: [PATCH 6/9] pin versions --- mise.toml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/mise.toml b/mise.toml index 15e3a59cc77a..50f94402eab0 100644 --- a/mise.toml +++ b/mise.toml @@ -172,6 +172,6 @@ cargo llvm-cov -p forest-filecoin --codecov --output-path lcov.info ''' [tools] -cargo-binstall = "latest" -go = "latest" -yarn = "latest" +cargo-binstall = "1.16.6" +go = "1.25.5" +yarn = "4.12" From 64e8fab568db6f67db232ec4b0cf6e6fb5e4c80b Mon Sep 17 00:00:00 2001 From: Hubert Bugaj Date: Fri, 9 Jan 2026 10:41:29 +0100 Subject: [PATCH 7/9] revert go.work ignore in go-lint --- .github/workflows/go-lint.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/go-lint.yml b/.github/workflows/go-lint.yml index 8da6412441b1..09cad981d6aa 100644 --- a/.github/workflows/go-lint.yml +++ b/.github/workflows/go-lint.yml @@ -15,6 +15,7 @@ on: - main paths: - ".github/workflows/go-lint.yml" + - "go.work" - "mise.toml" - "f3-sidecar/**" - "interop-tests/src/tests/**" @@ -23,6 +24,7 @@ on: - main paths: - ".github/workflows/go-lint.yml" + - "go.work" - "mise.toml" - "f3-sidecar/**" - "interop-tests/src/tests/**" From 06c7c399b9f137b7fc239c6adba1d69ffddcca28 Mon Sep 17 00:00:00 2001 From: Hubert Bugaj Date: Fri, 9 Jan 2026 10:43:46 +0100 Subject: [PATCH 8/9] no fmt before check in yaml lint --- mise.toml | 1 - 1 file changed, 1 deletion(-) diff --git a/mise.toml b/mise.toml index 50f94402eab0..c5454a19b762 100644 --- a/mise.toml +++ b/mise.toml @@ -107,7 +107,6 @@ depends = ["lint:deny", "lint:spellcheck", "lint:rust-fmt", "lint:clippy", "lint description = "Lint YAML files." run = ''' corepack enable && yarn && yarn install -yarn yaml-fmt yarn yaml-check ''' From 46f7ba88e3319efc3768cfc542dc751d8f97464d Mon Sep 17 00:00:00 2001 From: Hubert Bugaj Date: Fri, 9 Jan 2026 10:47:47 +0100 Subject: [PATCH 9/9] fix: sort dict --- docs/dictionary.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/dictionary.txt b/docs/dictionary.txt index 1b8c7a089abd..5ef0e82e4db7 100644 --- a/docs/dictionary.txt +++ b/docs/dictionary.txt @@ -90,10 +90,10 @@ M2 macOS Mainnet mainnet -mise-en-place MDBX migrator migrators +mise-en-place multiaddress namespace Neo4j