diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index d7d3484..592221c 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -107,10 +107,57 @@ jobs: path: native-assets/${{ matrix.rid }}/${{ matrix.library }} if-no-files-found: error + managed: + name: Build .NET managed bindings + needs: version + runs-on: ubuntu-latest + env: + NUGET_PACKAGES: ${{ github.workspace }}/nuget-packages + + steps: + - name: Check out repository + uses: actions/checkout@v7 + with: + persist-credentials: false + + - name: Set up .NET + uses: actions/setup-dotnet@v6 + with: + dotnet-version: 10.0.x + + - name: Restore managed bindings + shell: pwsh + run: >- + dotnet restore bindings/csharp/Expressif.Syntax/Expressif.Syntax.csproj + -p:Version='${{ needs.version.outputs.semver }}' + -p:PackageVersion='${{ needs.version.outputs.semver }}' + + - name: Build managed bindings + shell: pwsh + run: >- + dotnet build bindings/csharp/Expressif.Syntax/Expressif.Syntax.csproj + --configuration Release + --no-restore + -p:Version='${{ needs.version.outputs.semver }}' + -p:PackageVersion='${{ needs.version.outputs.semver }}' + -p:BuildNativeGrammar=false + + - name: Upload managed bindings + uses: actions/upload-artifact@v7 + with: + name: managed-${{ needs.version.outputs.semver }} + path: | + bindings/csharp/Expressif.Syntax/bin/Release + bindings/csharp/Expressif.Syntax/obj + nuget-packages + if-no-files-found: error + package: - name: Build C# package - needs: [version, native] + name: Pack NuGet package + needs: [version, native, managed] runs-on: ubuntu-latest + env: + NUGET_PACKAGES: ${{ github.workspace }}/nuget-packages steps: - name: Check out repository @@ -123,6 +170,12 @@ jobs: with: dotnet-version: 10.0.x + - name: Download managed bindings + uses: actions/download-artifact@v8 + with: + name: managed-${{ needs.version.outputs.semver }} + path: . + - name: Download Windows native grammar library uses: actions/download-artifact@v8 with: @@ -159,10 +212,10 @@ jobs: name: native-osx-arm64 path: native-assets/osx-arm64 - - name: Build NuGet package + - name: Pack NuGet package shell: pwsh run: >- - ./scripts/Build-NuGetPackage.ps1 + ./scripts/Pack-NuGetPackage.ps1 -Version '${{ needs.version.outputs.semver }}' -NativeAssetsDirectory 'native-assets' @@ -273,36 +326,10 @@ jobs: path: artifacts/* if-no-files-found: error - gate: - name: CI gate - if: always() - needs: [version, parser, native, package, consume, native-archive, collect] - runs-on: ubuntu-latest - - steps: - - name: Require every validation job to succeed - shell: pwsh - run: | - $results = @{ - version = '${{ needs.version.result }}' - parser = '${{ needs.parser.result }}' - native = '${{ needs.native.result }}' - package = '${{ needs.package.result }}' - consume = '${{ needs.consume.result }}' - nativeArchive = '${{ needs.native-archive.result }}' - collect = '${{ needs.collect.result }}' - } - $failed = @($results.GetEnumerator() | Where-Object Value -ne 'success') - if ($failed.Count -gt 0) { - $failed | ForEach-Object { Write-Error "$($_.Key) finished with result '$($_.Value)'." } - exit 1 - } - Write-Output 'All required CI validations succeeded.' - publish: name: Publish patch-zero release if: github.ref == 'refs/heads/main' && needs.version.outputs.patch == '0' - needs: [version, gate] + needs: [version, collect] runs-on: ubuntu-latest permissions: contents: write diff --git a/bindings/csharp/Expressif.Syntax/Expressif.Syntax.csproj b/bindings/csharp/Expressif.Syntax/Expressif.Syntax.csproj index 609bc0c..d4ff520 100644 --- a/bindings/csharp/Expressif.Syntax/Expressif.Syntax.csproj +++ b/bindings/csharp/Expressif.Syntax/Expressif.Syntax.csproj @@ -6,6 +6,7 @@ libtree-sitter-expressif.so libtree-sitter-expressif.dylib tree-sitter + true $(MSBuildThisFileDirectory)..\..\..\node_modules\.bin\tree-sitter.cmd $(MSBuildThisFileDirectory)../../../node_modules/.bin/tree-sitter @@ -56,7 +57,7 @@ Text="The macOS ARM64 native grammar library was not found in '$(NativeAssetsDirectory)/osx-arm64'." /> - + diff --git a/scripts/Build-NuGetPackage.ps1 b/scripts/Pack-NuGetPackage.ps1 similarity index 79% rename from scripts/Build-NuGetPackage.ps1 rename to scripts/Pack-NuGetPackage.ps1 index edb08aa..2a73548 100644 --- a/scripts/Build-NuGetPackage.ps1 +++ b/scripts/Pack-NuGetPackage.ps1 @@ -24,16 +24,12 @@ $properties = @( "/p:NativeAssetsDirectory=$nativeAssetsPath" ) -dotnet restore $projectPath @properties -if ($LASTEXITCODE -ne 0) { throw 'NuGet restore failed.' } - -dotnet build $projectPath --configuration Release --no-restore @properties -if ($LASTEXITCODE -ne 0) { throw 'Managed assembly build failed.' } - dotnet pack $projectPath ` --configuration Release ` --output $outputPath ` --no-build ` --no-restore ` + --disable-build-servers ` + -m:1 ` @properties if ($LASTEXITCODE -ne 0) { throw 'NuGet packaging failed.' }