mirror of
https://github.com/microsoft/regorus.git
synced 2026-08-05 02:16:11 +00:00
Fix bindings and add CI tests (#247)
Also update version numbers of binding Rust projects to match Regorus Signed-off-by: Anand Krishnamoorthi <anakrish@microsoft.com>
This commit is contained in:
committed by
GitHub
parent
495e91c75a
commit
9894f00829
31
.github/workflows/pr.yml
vendored
31
.github/workflows/pr.yml
vendored
@@ -1,4 +1,4 @@
|
||||
name: Rust
|
||||
name: tests/release
|
||||
|
||||
on:
|
||||
push:
|
||||
@@ -10,26 +10,18 @@ env:
|
||||
CARGO_TERM_COLOR: always
|
||||
|
||||
jobs:
|
||||
build:
|
||||
test:
|
||||
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- name: Add musl target
|
||||
run: rustup target add x86_64-unknown-linux-musl
|
||||
- name: Add no_std target
|
||||
run: rustup target add thumbv7m-none-eabi
|
||||
- name: Install musl-gcc
|
||||
run: sudo apt update && sudo apt install -y musl-tools
|
||||
- uses: actions/checkout@v4
|
||||
- name: Format Check
|
||||
run: cargo fmt --check
|
||||
- name: Build (all features)
|
||||
run: cargo build -r --all-features --verbose
|
||||
run: cargo build -r --all-features
|
||||
- name: Build
|
||||
run: cargo build -r --verbose
|
||||
- name: Build no_std
|
||||
run: cd tests/ensure_no_std && cargo build -r --target thumbv7m-none-eabi
|
||||
run: cargo build -r
|
||||
- name: Test no_std
|
||||
run: cargo test -r --no-default-features
|
||||
- name: Build only std
|
||||
@@ -37,7 +29,7 @@ jobs:
|
||||
- name: Doc Tests
|
||||
run: cargo test -r --doc
|
||||
- name: Run tests
|
||||
run: cargo test -r --verbose
|
||||
run: cargo test -r
|
||||
- name: Run tests (ACI)
|
||||
run: cargo test -r --test aci
|
||||
- name: Run tests (KATA)
|
||||
@@ -45,14 +37,3 @@ jobs:
|
||||
- name: Run tests (OPA Conformance)
|
||||
run: >-
|
||||
cargo test -r --test opa --features opa-testutil,serde_json/arbitrary_precision -- $(tr '\n' ' ' < tests/opa.passing)
|
||||
- name: Build (MUSL)
|
||||
run: cargo build --verbose --all-targets --target x86_64-unknown-linux-musl
|
||||
- name: Run tests (MUSL)
|
||||
run: cargo test -r --verbose --target x86_64-unknown-linux-musl
|
||||
- name: Run tests (MUSL ACI)
|
||||
run: cargo test -r --test aci --target x86_64-unknown-linux-musl
|
||||
- name: Run tests (KATA ACI)
|
||||
run: cargo test -r --test kata --target x86_64-unknown-linux-musl
|
||||
- name: Run tests (MUSL OPA Conformance)
|
||||
run: >-
|
||||
cargo test -r --test opa --features opa-testutil,serde_json/arbitrary_precision --target x86_64-unknown-linux-musl -- $(tr '\n' ' ' < tests/opa.passing)
|
||||
|
||||
10
.github/workflows/publish-python.yml
vendored
10
.github/workflows/publish-python.yml
vendored
@@ -23,7 +23,7 @@ jobs:
|
||||
with:
|
||||
python-version: '3.10'
|
||||
- name: Build wheels
|
||||
uses: PyO3/maturin-action@v1
|
||||
uses: PyO3/maturin-action@63b75c597b83e247fbf4fb7719801cc4220ae9f3 # v1.43.0
|
||||
with:
|
||||
target: ${{ matrix.target }}
|
||||
args: --release --out dist --find-interpreter --manifest-path bindings/python/Cargo.toml
|
||||
@@ -47,7 +47,7 @@ jobs:
|
||||
python-version: '3.10'
|
||||
architecture: ${{ matrix.target }}
|
||||
- name: Build wheels
|
||||
uses: PyO3/maturin-action@v1
|
||||
uses: PyO3/maturin-action@63b75c597b83e247fbf4fb7719801cc4220ae9f3 # v1.43.0
|
||||
with:
|
||||
target: ${{ matrix.target }}
|
||||
args: --release --out dist --find-interpreter --manifest-path bindings/python/Cargo.toml
|
||||
@@ -69,7 +69,7 @@ jobs:
|
||||
with:
|
||||
python-version: '3.10'
|
||||
- name: Build wheels
|
||||
uses: PyO3/maturin-action@v1
|
||||
uses: PyO3/maturin-action@63b75c597b83e247fbf4fb7719801cc4220ae9f3 # v1.43.0
|
||||
with:
|
||||
target: ${{ matrix.target }}
|
||||
args: --release --out dist --find-interpreter --manifest-path bindings/python/Cargo.toml
|
||||
@@ -85,7 +85,7 @@ jobs:
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- name: Build sdist
|
||||
uses: PyO3/maturin-action@v1
|
||||
uses: PyO3/maturin-action@63b75c597b83e247fbf4fb7719801cc4220ae9f3 # v1.43.0
|
||||
with:
|
||||
command: sdist
|
||||
args: --out dist --manifest-path bindings/python/Cargo.toml
|
||||
@@ -106,7 +106,7 @@ jobs:
|
||||
with:
|
||||
name: wheels
|
||||
- name: Publish to PyPI
|
||||
uses: PyO3/maturin-action@v1
|
||||
uses: PyO3/maturin-action@63b75c597b83e247fbf4fb7719801cc4220ae9f3 # v1.43.0
|
||||
env:
|
||||
MATURIN_PYPI_TOKEN: ${{ secrets.PYPI_API_TOKEN }}
|
||||
with:
|
||||
|
||||
2
.github/workflows/release-plz.yml
vendored
2
.github/workflows/release-plz.yml
vendored
@@ -18,7 +18,7 @@ jobs:
|
||||
- name: Install Rust toolchain
|
||||
uses: dtolnay/rust-toolchain@stable
|
||||
- name: Run release-plz
|
||||
uses: MarcoIeni/release-plz-action@v0.5
|
||||
uses: MarcoIeni/release-plz-action@a10be9933e46ab5005d79ce8b1eafca2ecdcd844 #v0.3.68
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}
|
||||
|
||||
43
.github/workflows/test-c-cpp.yml
vendored
Normal file
43
.github/workflows/test-c-cpp.yml
vendored
Normal file
@@ -0,0 +1,43 @@
|
||||
name: bindings/c-cpp
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [ "main" ]
|
||||
pull_request:
|
||||
branches: [ "main" ]
|
||||
|
||||
jobs:
|
||||
test:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Setup gcc, g++, cmake, ninja
|
||||
run: sudo apt update && sudo apt install -y gcc g++ cmake ninja-build
|
||||
|
||||
- name: Test c binding
|
||||
run: |
|
||||
mkdir bindings/c/build
|
||||
cd bindings/c/build
|
||||
cmake -G Ninja ..
|
||||
ninja
|
||||
./regorus_test
|
||||
|
||||
- name: Test c-nostd binding
|
||||
run: |
|
||||
mkdir bindings/c-nostd/build
|
||||
cd bindings/c-nostd/build
|
||||
cmake -G Ninja ..
|
||||
ninja
|
||||
./regorus_test
|
||||
|
||||
- name: Test cpp binding
|
||||
run: |
|
||||
mkdir bindings/cpp/build
|
||||
cd bindings/cpp/build
|
||||
cmake -G Ninja ..
|
||||
ninja
|
||||
./regorus_test
|
||||
26
.github/workflows/test-csharp.yml
vendored
Normal file
26
.github/workflows/test-csharp.yml
vendored
Normal file
@@ -0,0 +1,26 @@
|
||||
name: bindings/csharp
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [ "main" ]
|
||||
pull_request:
|
||||
branches: [ "main" ]
|
||||
|
||||
jobs:
|
||||
test:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
- uses: actions/setup-dotnet@v4
|
||||
|
||||
- name: Build
|
||||
run: dotnet build
|
||||
working-directory: ./bindings/csharp
|
||||
|
||||
- name: Run
|
||||
run: LD_LIBRARY_PATH=. dotnet run
|
||||
working-directory: ./bindings/csharp
|
||||
33
.github/workflows/test-go.yml
vendored
Normal file
33
.github/workflows/test-go.yml
vendored
Normal file
@@ -0,0 +1,33 @@
|
||||
name: bindings/go
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [ "main" ]
|
||||
pull_request:
|
||||
branches: [ "main" ]
|
||||
|
||||
jobs:
|
||||
test:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
|
||||
- uses: actions/setup-go@v5
|
||||
with:
|
||||
python-version: ${{ env.PYTHON_VERSION }}
|
||||
architecture: x64
|
||||
|
||||
- name: Build ffi
|
||||
run: cargo build -r
|
||||
working-directory: ./bindings/ffi
|
||||
|
||||
- name: Test go
|
||||
run: |
|
||||
go mod tidy
|
||||
go build
|
||||
LD_LIBRARY_PATH=../../target/release ./regorus_test
|
||||
working-directory: ./bindings/go
|
||||
35
.github/workflows/test-java.yml
vendored
Normal file
35
.github/workflows/test-java.yml
vendored
Normal file
@@ -0,0 +1,35 @@
|
||||
name: bindings/java
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [ "main" ]
|
||||
pull_request:
|
||||
branches: [ "main" ]
|
||||
|
||||
jobs:
|
||||
test:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
- uses: actions/setup-java@v4
|
||||
with:
|
||||
java-version: 8
|
||||
distribution: "corretto"
|
||||
- uses: dtolnay/rust-toolchain@stable
|
||||
|
||||
- name: Building binding
|
||||
run: cargo build --release --manifest-path bindings/java/Cargo.toml
|
||||
|
||||
- name: Build jar
|
||||
run: mvn package
|
||||
working-directory: ./bindings/java
|
||||
|
||||
- name: Test jar
|
||||
run: |
|
||||
javac -cp target/regorus-java-0.1.5.jar Test.java
|
||||
java -Djava.library.path=../../target/release -cp target/regorus-java-0.1.5.jar:. Test
|
||||
working-directory: ./bindings/java
|
||||
33
.github/workflows/test-musl.yml
vendored
Normal file
33
.github/workflows/test-musl.yml
vendored
Normal file
@@ -0,0 +1,33 @@
|
||||
name: musl
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [ "main" ]
|
||||
pull_request:
|
||||
branches: [ "main" ]
|
||||
|
||||
env:
|
||||
CARGO_TERM_COLOR: always
|
||||
|
||||
jobs:
|
||||
test:
|
||||
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- name: Add musl target
|
||||
run: rustup target add x86_64-unknown-linux-musl
|
||||
- name: Install musl-gcc
|
||||
run: sudo apt update && sudo apt install -y musl-tools
|
||||
- name: Build (MUSL)
|
||||
run: cargo build --verbose --all-targets --target x86_64-unknown-linux-musl
|
||||
- name: Run tests (MUSL)
|
||||
run: cargo test -r --verbose --target x86_64-unknown-linux-musl
|
||||
- name: Run tests (MUSL ACI)
|
||||
run: cargo test -r --test aci --target x86_64-unknown-linux-musl
|
||||
- name: Run tests (KATA ACI)
|
||||
run: cargo test -r --test kata --target x86_64-unknown-linux-musl
|
||||
- name: Run tests (MUSL OPA Conformance)
|
||||
run: >-
|
||||
cargo test -r --test opa --features opa-testutil,serde_json/arbitrary_precision --target x86_64-unknown-linux-musl -- $(tr '\n' ' ' < tests/opa.passing)
|
||||
24
.github/workflows/test-no-std.yml
vendored
Normal file
24
.github/workflows/test-no-std.yml
vendored
Normal file
@@ -0,0 +1,24 @@
|
||||
name: bindings/no-std
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [ "main" ]
|
||||
pull_request:
|
||||
branches: [ "main" ]
|
||||
|
||||
env:
|
||||
CARGO_TERM_COLOR: always
|
||||
|
||||
jobs:
|
||||
build:
|
||||
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- name: Add no_std target
|
||||
run: rustup target add thumbv7m-none-eabi
|
||||
- name: Build
|
||||
run: cargo build -r --target thumbv7m-none-eabi
|
||||
working-directory: ./tests/ensure_no_std
|
||||
|
||||
37
.github/workflows/test-python.yml
vendored
Normal file
37
.github/workflows/test-python.yml
vendored
Normal file
@@ -0,0 +1,37 @@
|
||||
name: bindings/python
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [ "main" ]
|
||||
pull_request:
|
||||
branches: [ "main" ]
|
||||
|
||||
env:
|
||||
PYTHON_VERSION: "3.10"
|
||||
|
||||
jobs:
|
||||
test:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
- uses: actions/setup-python@v4
|
||||
with:
|
||||
python-version: ${{ env.PYTHON_VERSION }}
|
||||
architecture: x64
|
||||
|
||||
- name: Build wheels
|
||||
uses: PyO3/maturin-action@63b75c597b83e247fbf4fb7719801cc4220ae9f3 # v1.43.0
|
||||
with:
|
||||
target: x86_64
|
||||
args: --release --out dist --manifest-path bindings/python/Cargo.toml
|
||||
sccache: 'true'
|
||||
|
||||
- name: Test wheel
|
||||
run: |
|
||||
pip3 install dist/regorus-*.whl
|
||||
cd bindings/python
|
||||
python3 test.py
|
||||
6
.github/workflows/test-ruby.yml
vendored
6
.github/workflows/test-ruby.yml
vendored
@@ -1,4 +1,4 @@
|
||||
name: test-ruby
|
||||
name: bindings/ruby
|
||||
|
||||
on:
|
||||
push:
|
||||
@@ -7,7 +7,7 @@ on:
|
||||
branches: [ "main" ]
|
||||
|
||||
jobs:
|
||||
setup:
|
||||
test:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
@@ -16,7 +16,7 @@ jobs:
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Setup Ruby and Rust
|
||||
uses: oxidize-rb/actions/setup-ruby-and-rust@v1
|
||||
uses: oxidize-rb/actions/setup-ruby-and-rust@7ca44a16e287e5ff7dd72ab53f4bd41cbf34a571 #v1.26
|
||||
with:
|
||||
ruby-version: "3.3.1"
|
||||
rustup-toolchain: "stable"
|
||||
|
||||
30
.github/workflows/test-wasm.yml
vendored
Normal file
30
.github/workflows/test-wasm.yml
vendored
Normal file
@@ -0,0 +1,30 @@
|
||||
name: bindings/wasm
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [ "main" ]
|
||||
pull_request:
|
||||
branches: [ "main" ]
|
||||
|
||||
jobs:
|
||||
test:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Setup Node
|
||||
uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: 18
|
||||
|
||||
- name: Install wasmlpack
|
||||
run: cargo install wasm-pack
|
||||
|
||||
- name: Test wasm binding
|
||||
run: |
|
||||
cd bindings/wasm
|
||||
wasm-pack build --target nodejs --release
|
||||
node test.js
|
||||
37
.github/workflows/tests-debug.yml
vendored
Normal file
37
.github/workflows/tests-debug.yml
vendored
Normal file
@@ -0,0 +1,37 @@
|
||||
name: tests/debug
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [ "main" ]
|
||||
pull_request:
|
||||
branches: [ "main" ]
|
||||
|
||||
env:
|
||||
CARGO_TERM_COLOR: always
|
||||
|
||||
jobs:
|
||||
test:
|
||||
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- name: Build (all features)
|
||||
run: cargo build --all-features
|
||||
- name: Build
|
||||
run: cargo build
|
||||
- name: Test no_std
|
||||
run: cargo test --no-default-features
|
||||
- name: Build only std
|
||||
run: cargo build --example regorus --no-default-features --features "std"
|
||||
- name: Doc Tests
|
||||
run: cargo test --doc
|
||||
- name: Run tests
|
||||
run: cargo test
|
||||
- name: Run tests (ACI)
|
||||
run: cargo test --test aci
|
||||
- name: Run tests (KATA)
|
||||
run: cargo test --test kata
|
||||
- name: Run tests (OPA Conformance)
|
||||
run: >-
|
||||
cargo test --test opa --features opa-testutil,serde_json/arbitrary_precision -- $(tr '\n' ' ' < tests/opa.passing)
|
||||
Reference in New Issue
Block a user