Workflow updates

This commit is contained in:
Isaac Marovitz 2023-07-26 13:19:00 -04:00
parent fdb77a9172
commit 015071f8e0
No known key found for this signature in database
GPG key ID: 97250B2B09A132E1
5 changed files with 72 additions and 29 deletions

View file

@ -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

25
.github/workflows/build.yml vendored Normal file
View file

@ -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

View file

@ -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

39
.github/workflows/format.yml vendored Normal file
View file

@ -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

View file

@ -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/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)
<img width="624" alt="primitive" src="https://github.com/IsaacMarovitz/SharpMetal/assets/42140194/478e2341-7c5d-47ad-9638-615b3091cef1">
</div>
@ -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