build: Check-in Cargo.lock files and lockdown .net (#384)

Use frozen and locked builds

Signed-off-by: Anand Krishnamoorthi <anakrish@microsoft.com>
This commit is contained in:
Anand Krishnamoorthi
2025-03-31 07:55:47 -07:00
committed by GitHub
parent 2858b63cd4
commit c28bde3f56
22 changed files with 10445 additions and 34 deletions

View File

@@ -18,24 +18,26 @@ jobs:
- uses: actions/checkout@v4
- name: Format Check
run: cargo fmt --check
- name: Fetch
run: cargo fetch
- name: Build (all features)
run: cargo build -r --all-features
run: cargo build -r --all-features --frozen
- name: Build
run: cargo build -r
run: cargo build -r --frozen
- name: Test no_std
run: cargo test -r --no-default-features
run: cargo test -r --no-default-features --frozen
- name: Build only std
run: cargo build -r --example regorus --no-default-features --features "std"
run: cargo build -r --example regorus --no-default-features --features "std" --frozen
- name: Doc Tests
run: cargo test -r --doc
run: cargo test -r --doc --frozen
- name: Run tests
run: cargo test -r
run: cargo test -r --frozen
- name: Run example
run: cargo run --example regorus -- eval -d examples/server/allowed_server.rego -i examples/server/input.json data.example
run: cargo run --example regorus --frozen -- eval -d examples/server/allowed_server.rego -i examples/server/input.json data.example
- name: Run tests (ACI)
run: cargo test -r --test aci
run: cargo test -r --test aci --frozen
- name: Run tests (KATA)
run: cargo test -r --test kata
run: cargo test -r --test kata --frozen
- name: Run tests (OPA Conformance)
run: >-
cargo test -r --test opa --features opa-testutil,serde_json/arbitrary_precision -- $(tr '\n' ' ' < tests/opa.passing)
cargo test -r --test opa --frozen --features opa-testutil,serde_json/arbitrary_precision -- $(tr '\n' ' ' < tests/opa.passing)

View File

@@ -48,7 +48,8 @@ jobs:
python-version: "3.11"
- if: ${{ matrix.build_cmd == 'zigbuild' }}
run: pip install cargo-zigbuild
- run: cargo ${{ matrix.build_cmd || 'build' }} --release --target ${{ matrix.target }}${{ matrix.glibc && format('.{0}', matrix.glibc) || '' }} --manifest-path ./bindings/java/Cargo.toml
- run: cargo fetch
- run: cargo ${{ matrix.build_cmd || 'build' }} --release --frozen --target ${{ matrix.target }}${{ matrix.glibc && format('.{0}', matrix.glibc) || '' }} --manifest-path ./bindings/java/Cargo.toml
- run: mkdir -p native/${{ matrix.target }}
- run: mv target/${{ matrix.target }}/release/*.${{ matrix.extension }} ./native/${{ matrix.target }}/
- uses: actions/upload-artifact@v4

View File

@@ -40,11 +40,15 @@ jobs:
- name: Install required cargo
run: cargo install clippy-sarif sarif-fmt
- name: Fetch
run: cargo fetch
- name: Run rust-clippy
run:
cargo clippy
--all-features
--message-format=json | clippy-sarif | tee rust-clippy-results.sarif | sarif-fmt
--frozen
continue-on-error: true
- name: Upload analysis results to GitHub

View File

@@ -20,7 +20,8 @@ jobs:
- name: Workaround to ensure that regorus.h is generated
run: |
cargo build -r
cargo fetch
cargo build -r --frozen
working-directory: ./bindings/ffi
- name: Test c binding

View File

@@ -36,7 +36,7 @@ jobs:
fetch-depth: 0
- name: Build Regorus binding
run: cargo build -r --target ${{ matrix.runtime.target }}
run: cargo build -r --target ${{ matrix.runtime.target }} --locked
working-directory: ./bindings/ffi
- name: Upload regorus ffi shared library
@@ -58,6 +58,10 @@ jobs:
with:
fetch-depth: 0
- uses: actions/setup-dotnet@v4
with:
global-json-file: ./bindings/csharp/global.json
- run: echo '${{ steps.stepid.outputs.dotnet-version }}'
- name: Download regorus ffi shared libraries
uses: actions/download-artifact@v4
@@ -108,6 +112,10 @@ jobs:
fetch-depth: 0
- uses: actions/setup-dotnet@v4
with:
global-json-file: ./bindings/csharp/global.json
- run: echo '${{ steps.stepid.outputs.dotnet-version }}'
- name: Download regorus nuget
uses: actions/download-artifact@v4

View File

@@ -17,6 +17,7 @@ jobs:
- name: Test FFI
run: |
cargo build -r
cargo fetch
cargo build -r --frozen
cargo clippy --all-targets --no-deps -- -Dwarnings
working-directory: ./bindings/ffi

View File

@@ -24,7 +24,7 @@ jobs:
- name: Building binding
run: |
cargo clippy --all-targets --no-deps -- -Dwarnings
cargo build --release --manifest-path bindings/java/Cargo.toml
cargo build --release --manifest-path bindings/java/Cargo.toml --locked
- name: Build jar
run: mvn package

View File

@@ -20,14 +20,16 @@ jobs:
run: rustup target add x86_64-unknown-linux-musl
- name: Install musl-gcc
run: sudo apt update && sudo apt install -y musl-tools
- name: Fetch
run: cargo fetch
- name: Build (MUSL)
run: cargo build --verbose --all-targets --target x86_64-unknown-linux-musl
run: cargo build --verbose --all-targets --target x86_64-unknown-linux-musl --frozen
- name: Run tests (MUSL)
run: cargo test -r --verbose --target x86_64-unknown-linux-musl
run: cargo test -r --verbose --target x86_64-unknown-linux-musl --frozen
- name: Run tests (MUSL ACI)
run: cargo test -r --test aci --target x86_64-unknown-linux-musl
run: cargo test -r --test aci --target x86_64-unknown-linux-musl --frozen
- name: Run tests (KATA ACI)
run: cargo test -r --test kata --target x86_64-unknown-linux-musl
run: cargo test -r --test kata --target x86_64-unknown-linux-musl --frozen
- 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)
cargo test -r --test opa --frozen --features opa-testutil,serde_json/arbitrary_precision --target x86_64-unknown-linux-musl -- $(tr '\n' ' ' < tests/opa.passing)

View File

@@ -18,7 +18,9 @@ jobs:
- uses: actions/checkout@v3
- name: Add no_std target
run: rustup target add thumbv7m-none-eabi
- name: Fetch
run: cargo fetch
- name: Build
run: cargo build -r --target thumbv7m-none-eabi
run: cargo build -r --target thumbv7m-none-eabi --frozen
working-directory: ./tests/ensure_no_std

View File

@@ -26,6 +26,7 @@ jobs:
- name: Test wasm binding
run: |
cd bindings/wasm
cargo fetch
cargo clippy --all-targets --no-deps -- -Dwarnings
wasm-pack build --target nodejs --release
# Enable when upstream issue is fixed.

View File

@@ -16,22 +16,24 @@ jobs:
steps:
- uses: actions/checkout@v4
- name: Fetch
run: cargo fetch
- name: Build (all features)
run: cargo build --all-features
run: cargo build --all-features --frozen
- name: Build
run: cargo build
run: cargo build --frozen
- name: Test no_std
run: cargo test --no-default-features
run: cargo test --no-default-features --frozen
- name: Build only std
run: cargo build --example regorus --no-default-features --features "std"
run: cargo build --example regorus --no-default-features --features "std" --frozen
- name: Doc Tests
run: cargo test --doc
run: cargo test --doc --frozen
- name: Run tests
run: cargo test
run: cargo test --frozen
- name: Run tests (ACI)
run: cargo test --test aci
run: cargo test --test aci --frozen
- name: Run tests (KATA)
run: cargo test --test kata
run: cargo test --test kata --frozen
- name: Run tests (OPA Conformance)
run: >-
cargo test --test opa --features opa-testutil,serde_json/arbitrary_precision -- $(tr '\n' ' ' < tests/opa.passing)
cargo test --test opa --frozen --features opa-testutil,serde_json/arbitrary_precision -- $(tr '\n' ' ' < tests/opa.passing)

4
.gitignore vendored
View File

@@ -4,10 +4,6 @@
**/wheels/
**/__pycache__/
# Remove Cargo.lock from gitignore if creating an executable, leave it for libraries
# More information here https://doc.rust-lang.org/cargo/guide/cargo-toml-vs-cargo-lock.html
Cargo.lock
# These are backup files generated by rustfmt
**/*.rs.bk

1812
Cargo.lock generated Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -32,6 +32,8 @@ corrosion_import_crate(
# See regorus/opa_no_std
FEATURES "custom_allocator,regorus/semver"
LOCKED
# Link statically
CRATE_TYPES staticlib FLAGS --crate-type=staticlib
)

View File

@@ -25,6 +25,8 @@ corrosion_import_crate(
# Select specific features in regorus.
FEATURES "regorus/semver"
LOCKED
# Link statically
CRATE_TYPES "cdylib"
)

View File

@@ -26,6 +26,8 @@ corrosion_import_crate(
# Select specific features in regorus.
FEATURES "regorus/semver"
LOCKED
# Link statically
CRATE_TYPES "cdylib")

View File

@@ -0,0 +1,10 @@
{
"msbuild-sdks": {
"Microsoft.Build.NoTargets": "3.7.56"
},
"sdk": {
"allowPrerelease": false,
"version": "8.0.407",
"rollForward": "disable"
}
}

1805
bindings/ffi/Cargo.lock generated Normal file

File diff suppressed because it is too large Load Diff

1706
bindings/java/Cargo.lock generated Normal file

File diff suppressed because it is too large Load Diff

1672
bindings/python/Cargo.lock generated Normal file

File diff suppressed because it is too large Load Diff

1718
bindings/ruby/Cargo.lock generated Normal file

File diff suppressed because it is too large Load Diff

1662
bindings/wasm/Cargo.lock generated Normal file

File diff suppressed because it is too large Load Diff