Skip to content

Commit

Permalink
feat: Check for rust version in Makefile
Browse files Browse the repository at this point in the history
- Enhanced MSRV check in GitHub workflow to include Makefile updates.
- Added a new target in Makefile to ensure Rust version compliance.
- Updated dependencies and formatting targets to include Rust version check.
- Fixed minor formatting issues in Makefile comments.
  • Loading branch information
derrix060 committed Oct 15, 2024
1 parent f83a70e commit 6937def
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 5 deletions.
10 changes: 9 additions & 1 deletion .github/workflows/find-smallest-rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,14 @@ jobs:
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: 'Minimum supported Rust version is `' + msrv + '`, previous `' + previous_msrv + '`. Please update the README file and this workflow.'
body: 'Minimum supported Rust version is `' + msrv + '`, previous `' + previous_msrv + '`. Please update the README file, the Makefile, and this workflow.'
})
}
- name: "Check README and Makefile"
run: |
set -euxo pipefail
echo "Checking if version is set in README"
cat README.md | grep "\[Rust\]" | grep "${{ steps.rust-version.outputs.highest-msrv }}"
echo "Checking makefile"
cat Makefile | grep "MINIMUM_RUST_VERSION = ${{ steps.rust-version.outputs.highest-msrv }}"
15 changes: 11 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ endif
ifeq ($(shell uname -s),Darwin)
export CGO_LDFLAGS=-framework Foundation -framework SystemConfiguration

# Set macOS deployment target in order to avoid linker warnings linke
# "ld: warning: object file XX was built for newer macOS version (14.4) than being linked (14.0)"
# Set macOS deployment target in order to avoid linker warnings linke
# "ld: warning: object file XX was built for newer macOS version (14.4) than being linked (14.0)"
export MACOSX_DEPLOYMENT_TARGET=$(shell sw_vers --productVersion)

# for test-race we need to pass -ldflags to fix linker warnings on macOS
Expand All @@ -31,7 +31,7 @@ endif

MAKEFLAGS += -j$(NPROCS)

rustdeps: vm core-rust compiler
rustdeps: check-rust vm core-rust compiler

juno: rustdeps ## compile
@mkdir -p build
Expand All @@ -41,6 +41,13 @@ juno-cached:
@mkdir -p build
@go build $(GO_TAGS) -ldflags="-X main.Version=$(shell git describe --tags)" -o build/juno ./cmd/juno/


MINIMUM_RUST_VERSION = 1.80.1
CURR_RUST_VERSION = $(shell rustc --version | grep -o '[0-9.]\+' | head -n1)
check-rust: ## Ensure rust version is greater than minimum
@echo "Checking if current rust version >= $(MINIMUM_RUST_VERSION)"
@bash -c '[[ $(CURR_RUST_VERSION) < $(MINIMUM_RUST_VERSION) ]] && (echo "Rust version must be >= $(MINIMUM_RUST_VERSION). Found version $(CURR_RUST_VERSION)" && exit 1) || echo "Current rust version is $(CURR_RUST_VERSION)"'

vm:
$(MAKE) -C vm/rust $(VM_TARGET)

Expand Down Expand Up @@ -74,7 +81,7 @@ test-cover: clean-testcache rustdeps ## tests with coverage
go test $(GO_TAGS) -coverpkg=./... -coverprofile=coverage/coverage.out -covermode=atomic ./...
go tool cover -html=coverage/coverage.out -o coverage/coverage.html

install-deps: | install-gofumpt install-mockgen install-golangci-lint## install some project dependencies
install-deps: | install-gofumpt install-mockgen install-golangci-lint check-rust ## install some project dependencies

install-gofumpt:
go install mvdan.cc/gofumpt@latest
Expand Down

0 comments on commit 6937def

Please sign in to comment.