Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 12 additions & 9 deletions .github/workflows/test-csharp.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,17 +31,18 @@ jobs:
target: x86_64-unknown-linux-gnu
libpath: |
**/release/libregorus_ffi.so
# Disabled for now
#- os: macos-latest
# target: aarch64-apple-darwin
# libpath: |
# **/release/libregorus_ffi.dylib
- os: macos-latest
target: aarch64-apple-darwin
libpath: |
**/release/libregorus_ffi.dylib
steps:
- name: Checkout repository
uses: actions/checkout@08eba0b27e820071cde6df949e0beb9ba4906955 # v4
with:
fetch-depth: 0
- uses: ./.github/actions/toolchains/rust
with:
targets: ${{ matrix.runtime.target }}
- name: Cache cargo
uses: Swatinem/rust-cache@779680da715d629ac1d338a641029a2f4372abb5 # v2.8.2
with:
Expand Down Expand Up @@ -99,13 +100,15 @@ jobs:
run: ls -R ./bindings/csharp/Regorus/tmp

- name: Build Regorus nuget via xtask
run: cargo xtask build-csharp --release --clean --artifacts-dir ./bindings/csharp/Regorus/tmp/bindings/ffi/target --enforce-artifacts
run: cargo xtask build-csharp --release --clean --artifacts-dir ./bindings/csharp/Regorus/tmp/bindings/ffi/target --enforce-artifacts --repository-commit ${{ github.sha }} --include-symbols

- name: Upload Regorus nuget
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
with:
name: regorus-nuget
path: bindings/csharp/Regorus/bin/Release/Regorus*.nupkg
path: |
bindings/csharp/Regorus/bin/Release/Regorus*.nupkg
bindings/csharp/Regorus/bin/Release/Regorus*.snupkg
if-no-files-found: error
retention-days: 1

Expand All @@ -122,8 +125,8 @@ jobs:
target: x86_64-pc-windows-msvc
- os: ubuntu-latest
target: x86_64-unknown-linux-gnu
#- os: macos-latest
# target: aarch64-apple-darwin
- os: macos-latest
target: aarch64-apple-darwin
steps:
- name: Checkout repository
uses: actions/checkout@08eba0b27e820071cde6df949e0beb9ba4906955 # v4
Expand Down
13 changes: 13 additions & 0 deletions bindings/csharp/Regorus/Regorus.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,15 @@
<VersionPrefix>0.9.0</VersionPrefix>
<VersionSuffix>$(VersionSuffix)</VersionSuffix>
<PackageReadmeFile>README.md</PackageReadmeFile>
<PackageLicenseExpression>MIT AND Apache-2.0 AND BSD-3-Clause</PackageLicenseExpression>
<PackageProjectUrl>https://github.com/microsoft/regorus</PackageProjectUrl>
<RepositoryUrl>https://github.com/microsoft/regorus</RepositoryUrl>
<RepositoryType>git</RepositoryType>
<Authors>Microsoft</Authors>
<Company>Microsoft</Company>
<PackageTags>rego;policy;engine;authorization;opa;rust</PackageTags>
<Description>Fast, lightweight Rego interpreter and policy engine for .NET, powered by Rust.</Description>
<Copyright>Copyright (c) Microsoft Corporation.</Copyright>
</PropertyGroup>

<PropertyGroup>
Expand Down Expand Up @@ -46,10 +55,14 @@

<Error Text="$(RegorusFFIArtifactsDir)/x86_64-unknown-linux-gnu/$(RegorusFFIArtifactsProfile)/libregorus_ffi.so missing."
Condition="!Exists('$(RegorusFFIArtifactsDir)/x86_64-unknown-linux-gnu/$(RegorusFFIArtifactsProfile)/libregorus_ffi.so')" />

<Error Text="$(RegorusFFIArtifactsDir)/aarch64-apple-darwin/$(RegorusFFIArtifactsProfile)/libregorus_ffi.dylib missing."
Condition="!Exists('$(RegorusFFIArtifactsDir)/aarch64-apple-darwin/$(RegorusFFIArtifactsProfile)/libregorus_ffi.dylib')" />
</Target>

<ItemGroup>
<None Include="docs/README.md" Pack="true" PackagePath="/" />
<None Include="../../../LICENSE" Pack="true" PackagePath="/" />

<!-- Copy each binary to expected location within the package -->
<None Include="$(RegorusFFIArtifactsDir)/x86_64-pc-windows-msvc/$(RegorusFFIArtifactsProfile)/*.dll" Pack="true" PackagePath="runtimes/win-x64/native/" />
Expand Down
1 change: 1 addition & 0 deletions bindings/ffi/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
name = "regorus-ffi"
version = "0.9.0"
edition = "2021"
license = "MIT AND Apache-2.0 AND BSD-3-Clause"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[lib]
Expand Down
1 change: 1 addition & 0 deletions bindings/java/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ version = "0.9.0"
edition = "2021"
repository = "https://github.com/microsoft/regorus/bindings/java"
description = "Java bindings for Regorus - a fast, lightweight Rego interpreter written in Rust"
license = "MIT AND Apache-2.0 AND BSD-3-Clause"
keywords = ["interpreter", "opa", "policy-as-code", "rego"]

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
Expand Down
10 changes: 9 additions & 1 deletion bindings/java/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,15 @@
<licenses>
<license>
<name>MIT License</name>
<url>https://opensource.org/blog/license/mit</url>
<url>https://opensource.org/licenses/MIT</url>
</license>
<license>
<name>Apache License 2.0</name>
<url>https://www.apache.org/licenses/LICENSE-2.0</url>
</license>
<license>
<name>BSD 3-Clause License</name>
<url>https://opensource.org/licenses/BSD-3-Clause</url>
</license>
</licenses>

Expand Down
1 change: 1 addition & 0 deletions bindings/python/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ version = "0.9.0"
edition = "2021"
repository = "https://github.com/microsoft/regorus/bindings/python"
description = "Python bindings for Regorus - a fast, lightweight Rego interpreter written in Rust"
license = "MIT AND Apache-2.0 AND BSD-3-Clause"
keywords = ["interpreter", "opa", "policy-as-code", "rego"]


Expand Down
4 changes: 4 additions & 0 deletions bindings/python/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,11 @@ build-backend = "maturin"
[project]
name = "regorus"
requires-python = ">=3.8"
license = { text = "MIT AND Apache-2.0 AND BSD-3-Clause" }
classifiers = [
"License :: OSI Approved :: Apache Software License",
"License :: OSI Approved :: BSD License",
"License :: OSI Approved :: MIT License",
"Programming Language :: Rust",
"Programming Language :: Python :: Implementation :: CPython",
"Programming Language :: Python :: Implementation :: PyPy",
Expand Down
1 change: 1 addition & 0 deletions bindings/ruby/ext/regorusrb/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ name = "regorusrb"
version = "0.9.0"
edition = "2024"
description = "Ruby bindings for Regorus - a fast, lightweight Rego interpreter written in Rust"
license = "MIT AND Apache-2.0 AND BSD-3-Clause"
publish = false

[lib]
Expand Down
2 changes: 1 addition & 1 deletion bindings/ruby/regorusrb.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ Gem::Specification.new do |spec|

spec.summary = "Ruby bindings for Regorus - a fast, lightweight Rego interpreter written in Rust"
spec.homepage = "https://github.com/microsoft/regorus/blob/main/bindings/ruby"
spec.license = "MIT"
spec.licenses = ["MIT", "Apache-2.0", "BSD-3-Clause"]
spec.required_ruby_version = ">= 3.4.2"
spec.required_rubygems_version = ">= 3.6.5"

Expand Down
1 change: 1 addition & 0 deletions bindings/wasm/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ version = "0.9.0"
edition = "2021"
repository = "https://github.com/microsoft/regorus/bindings/wasm"
description = "WASM bindings for Regorus - a fast, lightweight Rego interpreter written in Rust"
license = "MIT AND Apache-2.0 AND BSD-3-Clause"
keywords = ["interpreter", "opa", "policy-as-code", "rego"]

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
Expand Down
2 changes: 2 additions & 0 deletions xtask/src/tasks/bindings/all.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ impl BuildAllBindingsCommand {
clean: false,
artifacts_dir: Some(ffi_dir.clone()),
enforce_artifacts: false,
repository_commit: None,
include_symbols: false,
})?;

if nuget_result.packages.is_empty() {
Expand Down
34 changes: 34 additions & 0 deletions xtask/src/tasks/bindings/csharp.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,14 @@ pub struct BuildNugetCommand {
/// Require all platform artefacts to exist before packing.
#[arg(long)]
pub enforce_artifacts: bool,

/// Include repository commit metadata in the package.
#[arg(long = "repository-commit", value_name = "SHA")]
pub repository_commit: Option<String>,

/// Build a symbols package (snupkg).
#[arg(long)]
pub include_symbols: bool,
}

/// Parsed build options shared across tasks that need a NuGet package.
Expand All @@ -45,6 +53,8 @@ pub struct BuildNugetConfig {
pub clean: bool,
pub artifacts_dir: Option<PathBuf>,
pub enforce_artifacts: bool,
pub repository_commit: Option<String>,
pub include_symbols: bool,
}

/// Result of a NuGet build, including generated artefacts.
Expand Down Expand Up @@ -86,6 +96,8 @@ pub fn build_nuget_package(config: &BuildNugetConfig) -> Result<BuildNugetResult
&profile,
!config.enforce_artifacts,
config.clean,
config.repository_commit.as_deref(),
config.include_symbols,
)?;

let packages = find_packages(&package_dir)?;
Expand Down Expand Up @@ -132,6 +144,8 @@ fn invoke_dotnet_pack(
profile: &str,
ignore_missing: bool,
clean: bool,
repository_commit: Option<&str>,
include_symbols: bool,
) -> Result<PathBuf> {
let project_dir = root.join("bindings/csharp/Regorus");
let artifacts_dir_str = artifacts_dir
Expand All @@ -140,6 +154,12 @@ fn invoke_dotnet_pack(

let profile_arg = format!("/p:RegorusFFIArtifactsProfile={}", profile);
let dir_arg = format!("/p:RegorusFFIArtifactsDir={}", artifacts_dir_str);
let repo_commit_arg = repository_commit.map(|sha| format!("/p:RepositoryCommit={}", sha));
let symbols_args = if include_symbols {
Some(("/p:IncludeSymbols=true", "/p:SymbolPackageFormat=snupkg"))
} else {
None
};

if clean {
clean_msbuild_project(&project_dir)?;
Expand Down Expand Up @@ -169,6 +189,9 @@ fn invoke_dotnet_pack(
build.arg("minimal");
build.arg(&dir_arg);
build.arg(&profile_arg);
if let Some(arg) = &repo_commit_arg {
build.arg(arg);
}
if ignore_missing {
build.arg("/p:IgnoreMissingArtifacts=true");
}
Expand All @@ -182,6 +205,13 @@ fn invoke_dotnet_pack(
pack.arg(configuration);
pack.arg(&dir_arg);
pack.arg(&profile_arg);
if let Some(arg) = &repo_commit_arg {
pack.arg(arg);
}
if let Some((include_symbols_arg, symbols_format_arg)) = symbols_args {
pack.arg(include_symbols_arg);
pack.arg(symbols_format_arg);
}
if ignore_missing {
pack.arg("/p:IgnoreMissingArtifacts=true");
}
Expand Down Expand Up @@ -217,6 +247,8 @@ impl BuildNugetCommand {
clean: self.clean,
artifacts_dir: self.artifacts_dir.clone(),
enforce_artifacts: self.enforce_artifacts,
repository_commit: self.repository_commit.clone(),
include_symbols: self.include_symbols,
}
}
}
Expand Down Expand Up @@ -307,6 +339,8 @@ impl TestCsharpCommand {
clean: self.clean,
artifacts_dir: self.artifacts_dir.clone(),
enforce_artifacts: self.enforce_artifacts,
repository_commit: None,
include_symbols: false,
};

let mut packages = find_packages(&package_dir)?;
Expand Down
Loading