Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 2 additions & 4 deletions .github/workflows/butterflynet.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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) }}
2 changes: 1 addition & 1 deletion .github/workflows/cargo-advisories.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 2 additions & 4 deletions .github/workflows/coverage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,13 +46,11 @@ 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: Generate code coverage
run: make codecov
run: mise codecov
# Save lcov.info as an artifact for debugging purposes
- uses: actions/upload-artifact@v6
with:
Expand Down
12 changes: 4 additions & 8 deletions .github/workflows/docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 --profile release
- uses: actions/upload-artifact@v6
with:
name: "forest-linux-amd64"
Expand Down Expand Up @@ -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 --profile release
- uses: actions/upload-artifact@v6
if: github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/v')
with:
Expand Down
15 changes: 4 additions & 11 deletions .github/workflows/forest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}"
Expand All @@ -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:
Expand Down
12 changes: 4 additions & 8 deletions .github/workflows/go-lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,17 +15,15 @@ on:
- main
paths:
- ".github/workflows/go-lint.yml"
- "Makefile"
- "go.work"
- "mise.toml"
- "f3-sidecar/**"
- "interop-tests/src/tests/**"
push:
branches:
- main
paths:
- ".github/workflows/go-lint.yml"
- "Makefile"
- "go.work"
- "mise.toml"
- "f3-sidecar/**"
- "interop-tests/src/tests/**"

Expand All @@ -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
23 changes: 4 additions & 19 deletions .github/workflows/rust-lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,33 +50,18 @@ 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:
timeout_minutes: 5
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
30 changes: 10 additions & 20 deletions .github/workflows/scripts-lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
4 changes: 2 additions & 2 deletions .github/workflows/unit-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -61,9 +61,9 @@ jobs:
go-version-file: "go.work"
- name: install nextest
uses: taiki-e/install-action@nextest
- uses: jdx/mise-action@v3
- run: |
make test-release-docs
make test-release
mise test
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"
Expand Down
138 changes: 0 additions & 138 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,141 +1,3 @@
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 --workspace --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
##
Expand Down
4 changes: 2 additions & 2 deletions scripts/add_license.sh → mise-tasks/add_license.sh
Original file line number Diff line number Diff line change
@@ -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$"
Expand Down
Loading
Loading