-
Notifications
You must be signed in to change notification settings - Fork 15
Added a top-level Makefile in dotnet-sdk to simplify running tests and linters #149
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
Abishek-Newar
wants to merge
2
commits into
openfga:main
Choose a base branch
from
Abishek-Newar:main
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 1 commit
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,66 @@ | ||
| .PHONY: help test test-net48 test-net8 test-net9 lint fmt check | ||
|
|
||
| # Default target when running just 'make' | ||
| help: | ||
| @echo "Available targets:" | ||
| @echo " test - Run all tests" | ||
| @echo " test-net48 - Run tests for .NET Framework 4.8" | ||
| @echo " test-net8 - Run tests for .NET 8.0" | ||
| @echo " test-net9 - Run tests for .NET 9.0" | ||
| @echo " lint - Verify code formatting and style" | ||
| @echo " fmt - Apply code formatting" | ||
| @echo " check - Run all checks (lint + test)" | ||
|
|
||
| # Run tests for all supported frameworks | ||
| test: test-net48 test-net8 test-net9 | ||
| @echo "✅ All tests completed successfully!" | ||
|
|
||
| # Run tests for .NET Framework 4.8 | ||
| test-net48: | ||
| @echo "🚀 Running tests for .NET Framework 4.8..." | ||
| @dotnet test --framework net48 --no-restore | ||
|
|
||
| # Run tests for .NET 8.0 | ||
| test-net8: | ||
| @echo "🚀 Running tests for .NET 8.0..." | ||
| @dotnet test --framework net8.0 --no-restore | ||
|
|
||
| # Run tests for .NET 9.0 | ||
| test-net9: | ||
| @echo "🚀 Running tests for .NET 9.0..." | ||
| @dotnet test --framework net9.0 --no-restore | ||
|
|
||
| # Verify code formatting and analyzers | ||
| lint: | ||
| @echo "🔍 Checking code formatting..." | ||
| @dotnet format --verify-no-changes --severity info || (echo "❌ Code formatting issues found. Run 'make fmt' to fix." && exit 1) | ||
| @echo "✅ Code formatting looks good!" | ||
|
|
||
| # Apply formatting fixes | ||
| fmt: | ||
| @echo "🎨 Applying code formatting..." | ||
| @# Create backups of project files | ||
| @cp src/OpenFga.Sdk/OpenFga.Sdk.csproj src/OpenFga.Sdk/OpenFga.Sdk.csproj.bak | ||
| @cp src/OpenFga.Sdk.Test/OpenFga.Sdk.Test.csproj src/OpenFga.Sdk.Test/OpenFga.Sdk.Test.csproj.bak | ||
|
|
||
| @# Use sed with appropriate flags for platform compatibility | ||
| @if [ "$$(uname)" = "Darwin" ]; then \ | ||
| sed -i '' "s/<TargetFrameworks>.*<\\/TargetFrameworks>/<TargetFramework>net8.0<\\/TargetFramework>/" src/OpenFga.Sdk/OpenFga.Sdk.csproj && \ | ||
| sed -i '' "s/<TargetFrameworks>.*<\\/TargetFrameworks>/<TargetFramework>net8.0<\\/TargetFramework>/" src/OpenFga.Sdk.Test/OpenFga.Sdk.Test.csproj; \ | ||
| else \ | ||
| sed -i "s/<TargetFrameworks>.*<\\/TargetFrameworks>/<TargetFramework>net8.0<\\/TargetFramework>/" src/OpenFga.Sdk/OpenFga.Sdk.csproj && \ | ||
| sed -i "s/<TargetFrameworks>.*<\\/TargetFrameworks>/<TargetFramework>net8.0<\\/TargetFramework>/" src/OpenFga.Sdk.Test/OpenFga.Sdk.Test.csproj; \ | ||
| fi | ||
|
|
||
| @# Run formatting | ||
| @dotnet restore ./OpenFga.Sdk.sln | ||
| @dotnet format ./OpenFga.Sdk.sln || true | ||
|
|
||
| @# Restore original project files | ||
| @mv src/OpenFga.Sdk/OpenFga.Sdk.csproj.bak src/OpenFga.Sdk/OpenFga.Sdk.csproj | ||
| @mv src/OpenFga.Sdk.Test/OpenFga.Sdk.Test.csproj.bak src/OpenFga.Sdk.Test/OpenFga.Sdk.Test.csproj | ||
| @echo "✅ Code formatting applied successfully!" | ||
|
|
||
| # Convenience target to run all checks | ||
| check: lint test | ||
| @echo "✨ All checks completed successfully!" | ||
Abishek-Newar marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.