diff --git a/.dockerignore b/.dockerignore index c864453bbd37..f3f06227a6bc 100644 --- a/.dockerignore +++ b/.dockerignore @@ -14,6 +14,7 @@ CHANGELOG* *.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/.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..09cad981d6aa 100644 --- a/.github/workflows/go-lint.yml +++ b/.github/workflows/go-lint.yml @@ -15,8 +15,8 @@ on: - main paths: - ".github/workflows/go-lint.yml" - - "Makefile" - "go.work" + - "mise.toml" - "f3-sidecar/**" - "interop-tests/src/tests/**" push: @@ -24,8 +24,8 @@ on: - main paths: - ".github/workflows/go-lint.yml" - - "Makefile" - "go.work" + - "mise.toml" - "f3-sidecar/**" - "interop-tests/src/tests/**" @@ -35,7 +35,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/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/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..e4b2bf3afdde 100644 --- a/Dockerfile +++ b/Dockerfile @@ -23,11 +23,14 @@ ENV PATH="/root/.cargo/bin:${PATH}" 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 \ - make install && \ + mise trust && \ + mise run install && \ mkdir /forest_out && \ cp /root/.cargo/bin/forest* /forest_out 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 - + + - - - - - + + + diff --git a/docs/dictionary.txt b/docs/dictionary.txt index 492b9802ca8c..5ef0e82e4db7 100644 --- a/docs/dictionary.txt +++ b/docs/dictionary.txt @@ -93,6 +93,7 @@ mainnet MDBX migrator migrators +mise-en-place multiaddress namespace Neo4j 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..c5454a19b762 --- /dev/null +++ b/mise.toml @@ -0,0 +1,176 @@ +[tasks.install] +description = "Installs all Forest binaries with a specified profile." +usage = ''' +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" +''' +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-check +''' + +[tasks.fmt] +description = "Format all supported code." +run = ''' +cargo fmt --all +taplo fmt +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 test --doc --profile ${usage_profile?} --features doctest-private --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 = "1.16.6" +go = "1.25.5" +yarn = "4.12" diff --git a/scripts/install_mise.sh b/scripts/install_mise.sh new file mode 100755 index 000000000000..ad05156df105 --- /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 ${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 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