mirror of
https://github.com/microsoft/regorus.git
synced 2026-08-05 02:16:11 +00:00
build: Support manually generating C# bindings via Github action and add a README (#423)
This commit is contained in:
4
.github/workflows/test-csharp.yml
vendored
4
.github/workflows/test-csharp.yml
vendored
@@ -1,6 +1,7 @@
|
|||||||
name: bindings/csharp
|
name: bindings/csharp
|
||||||
|
|
||||||
on:
|
on:
|
||||||
|
workflow_dispatch:
|
||||||
push:
|
push:
|
||||||
branches: [ "main" ]
|
branches: [ "main" ]
|
||||||
pull_request:
|
pull_request:
|
||||||
@@ -9,6 +10,9 @@ on:
|
|||||||
# Run at 8:00 AM every day
|
# Run at 8:00 AM every day
|
||||||
- cron: "0 8 * * *"
|
- cron: "0 8 * * *"
|
||||||
|
|
||||||
|
env:
|
||||||
|
VersionSuffix: ${{ github.event_name == 'workflow_dispatch' && 'manualtrigger' || null }}
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build-ffi:
|
build-ffi:
|
||||||
name: 'Build Regorus FFI: (${{ matrix.runtime.target }})'
|
name: 'Build Regorus FFI: (${{ matrix.runtime.target }})'
|
||||||
|
|||||||
32
bindings/csharp/README.md
Normal file
32
bindings/csharp/README.md
Normal file
@@ -0,0 +1,32 @@
|
|||||||
|
# Regorus CSharp
|
||||||
|
|
||||||
|
**Regorus** is
|
||||||
|
|
||||||
|
- *Rego*-*Rus(t)* - A fast, light-weight [Rego](https://www.openpolicyagent.org/docs/latest/policy-language/)
|
||||||
|
interpreter written in Rust.
|
||||||
|
- *Rigorous* - A rigorous enforcer of well-defined Rego semantics.
|
||||||
|
|
||||||
|
See main [Regorus page](https://github.com/microsoft/regorus) for more details about the project.
|
||||||
|
|
||||||
|
# Building
|
||||||
|
|
||||||
|
## Github Actions
|
||||||
|
|
||||||
|
The simplest way to build a Nuget for Regorus' C# bindings is to use Github Actions. The action to do so is named `bindings/csharp` and is defined in `.github/workflows/test-csharp.yml`.
|
||||||
|
|
||||||
|
There are two ways to trigger a Nuget build.
|
||||||
|
1. Runs are triggered automatically whenever a push or pull request is made to the `main` branch.
|
||||||
|
2. A run can be triggered manually by navigating to the action in the Github UI and clicking `Run workflow`. This option allows you to generate a Nuget for any branch, which is useful when testing the integration of in-progress changes to Regorus with other projects. Nuget files that are generated via this flow will have a `manualtrigger` suffix appended to their version number, making it easy to distinguish them from Nugets generated using the `main` branch.
|
||||||
|

|
||||||
|
|
||||||
|
Once the workflow run completes, the generated Nuget can be downloaded by following these steps:
|
||||||
|
1. Open the run.
|
||||||
|
2. Click on `Build Regorus nuget` on the left.
|
||||||
|
3. Expand the `Upload Regorus nuget` step.
|
||||||
|
4. Click the `Artifact download URL` link at the bottom.
|
||||||
|
5. Save and extract the downloaded zip file to find the `.nupkg` file.
|
||||||
|

|
||||||
|
|
||||||
|
## Local
|
||||||
|
|
||||||
|
TODO
|
||||||
@@ -7,6 +7,11 @@
|
|||||||
<TestingPlatformDotnetTestSupport>true</TestingPlatformDotnetTestSupport>
|
<TestingPlatformDotnetTestSupport>true</TestingPlatformDotnetTestSupport>
|
||||||
<TestingPlatformShowTestsFailure>true</TestingPlatformShowTestsFailure>
|
<TestingPlatformShowTestsFailure>true</TestingPlatformShowTestsFailure>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
|
<PropertyGroup>
|
||||||
|
<!-- If the environment variable is set (such as in a Github Action run), append the suffix to the version number -->
|
||||||
|
<RegorusPackageVersionSuffix Condition="'$(VersionSuffix)' != ''">-$(VersionSuffix)</RegorusPackageVersionSuffix>
|
||||||
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<None Include="../../../tests/**/*.*" Link="tests/%(RecursiveDir)%(Filename)%(Extension)" CopyToOutputDirectory="PreserveNewest" />
|
<None Include="../../../tests/**/*.*" Link="tests/%(RecursiveDir)%(Filename)%(Extension)" CopyToOutputDirectory="PreserveNewest" />
|
||||||
@@ -17,6 +22,6 @@
|
|||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="Regorus" Version="0.5.0"/>
|
<PackageReference Include="Regorus" Version="0.6.0$(RegorusPackageVersionSuffix)"/>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
</Project>
|
</Project>
|
||||||
BIN
bindings/csharp/docs/images/readme/downloadnuget.png
Normal file
BIN
bindings/csharp/docs/images/readme/downloadnuget.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 96 KiB |
BIN
bindings/csharp/docs/images/readme/manuallytriggeringrun.png
Normal file
BIN
bindings/csharp/docs/images/readme/manuallytriggeringrun.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 73 KiB |
Reference in New Issue
Block a user