diff --git a/.editorconfig b/.editorconfig index f33ec25..c9b0c1e 100644 --- a/.editorconfig +++ b/.editorconfig @@ -65,3 +65,8 @@ resharper_csharp_namespace_body = block_scoped # Code-block preferences csharp_prefer_braces = true:warning csharp_prefer_simple_using_statement = true:suggestion + + +[*.yml] + +indent_size = 2 \ No newline at end of file diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 0000000..5b85191 --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,25 @@ +name: Build & Test + +on: + workflow_call: + workflow_dispatch: + +concurrency: + group: build-${{ github.event.number }} + cancel-in-progress: true + +jobs: + build: + runs-on: macos-latest + steps: + - uses: actions/checkout@v3 + - name: Setup .NET + uses: actions/setup-dotnet@v3 + with: + dotnet-version: 7.0.x + - name: Restore dependencies + run: dotnet restore + - name: Build + run: dotnet build --no-restore + - name: Test + run: dotnet test --no-build --verbosity normal diff --git a/.github/workflows/dotnet.yml b/.github/workflows/dotnet.yml deleted file mode 100644 index 724499d..0000000 --- a/.github/workflows/dotnet.yml +++ /dev/null @@ -1,26 +0,0 @@ -# This workflow will build a .NET project -# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-net - -name: Build & Test - -on: - push: - branches: [ "master" ] - pull_request: - branches: [ "master" ] - -jobs: - build: - runs-on: macos-latest - steps: - - uses: actions/checkout@v3 - - name: Setup .NET - uses: actions/setup-dotnet@v3 - with: - dotnet-version: 7.0.x - - name: Restore dependencies - run: dotnet restore - - name: Build - run: dotnet build --no-restore - - name: Test - run: dotnet test --no-build --verbosity normal diff --git a/.github/workflows/format.yml b/.github/workflows/format.yml new file mode 100644 index 0000000..f5a85d7 --- /dev/null +++ b/.github/workflows/format.yml @@ -0,0 +1,39 @@ +name: Format + +on: + push: + branches: [ "master" ] + pull_request: + branches: [ "master" ] + workflow_dispatch: + +permissions: + pull-requests: write + checks: write + +concurrency: + group: format-${{ github.event.number }} + cancel-in-progress: true + +jobs: + format: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - name: Setup .NET + uses: actions/setup-dotnet@v3 + with: + dotnet-version: 7.0.x + - run: dotnet restore + - name: Format + run: dotnet format --verify-no-changes --report ./report.json -v d + - name: Upload report + if: failure() + uses: actions/upload-artifact@v3 + with: + name: dotnet-format + path: ./report.json + build: + uses: ./.github/workflows/build.yml + needs: format + secrets: inherit diff --git a/README.md b/README.md index 89ff369..b283994 100644 --- a/README.md +++ b/README.md @@ -3,8 +3,8 @@ # SharpMetal *Metal bindings for C#.* -![](https://img.shields.io/github/actions/workflow/status/IsaacMarovitz/SharpMetal/dotnet.yml?style=for-the-badge) - +![](https://img.shields.io/github/actions/workflow/status/IsaacMarovitz/SharpMetal/build.yml?style=for-the-badge) +![](https://img.shields.io/github/actions/workflow/status/IsaacMarovitz/SharpMetal/format.yml?style=for-the-badge) primitive @@ -24,7 +24,7 @@ Wonderful! SharpMetal is built with .NET 7.0, and follows a couple of specific g - Source Generated P/Invokes - `LibraryImport` not `DllImport` - Use C# types where possible - - `NSInteger` -> `long` + - `NSInteger` -> `long` - `NSUInteger` -> `ulong` - Mark structs and classes with `SupportedOSPlatform` attribute - SharpMetal is built for macOS primarily, so when there are platform-specific differences, use the macOS option