Skip to content
Open
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
34 changes: 23 additions & 11 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ jobs:
name: Check spelling
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v5
- name: Check spelling
uses: codespell-project/actions-codespell@v1
with:
Expand All @@ -19,15 +19,15 @@ jobs:
name: Check formatting
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v5
- name: Check formatting
run: cargo fmt --all -- --check
# Check that it builds with the Minimum Supported Rust Version
msrv:
name: Check minimum supported rust version (MSRV)
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v5
- name: Build the container
run: docker build -t ubuntucontainer tss-esapi/tests/ --file tss-esapi/tests/Dockerfile-ubuntu --target tpm2-tools
- name: Run the container
Expand All @@ -38,7 +38,7 @@ jobs:
name: Ubuntu tests
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v5
- name: Build the container
run: docker build -t ubuntucontainer tss-esapi/tests/ --file tss-esapi/tests/Dockerfile-ubuntu --target tpm2-tools
- name: Run the container
Expand All @@ -50,7 +50,7 @@ jobs:
name: Ubuntu tests on v4.x.y of tpm2-tss libraries found using pkg-config --target tpm2-tools
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v5
- name: Build the container
run: docker build -t ubuntucontainer tss-esapi/tests/ --build-arg TPM2_TSS_VERSION=4.1.3 --file tss-esapi/tests/Dockerfile-ubuntu --target tpm2-tools
- name: Run the container
Expand All @@ -60,7 +60,7 @@ jobs:
name: Ubuntu tests on v4.x.y of tpm2-tss libraries found using a path
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v5
- name: Build the container
run: docker build -t ubuntucontainer tss-esapi/tests/ --build-arg TPM2_TSS_VERSION=4.1.3 --file tss-esapi/tests/Dockerfile-ubuntu --target tpm2-tss-install-dir
- name: Run the container
Expand All @@ -71,7 +71,7 @@ jobs:
# We just build a container... GitHub doesn't like Fedora :(
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v5
- name: Build the container
run: docker build -t fedoracontainer tss-esapi/tests/ --file tss-esapi/tests/Dockerfile-fedora
- name: Run the tests
Expand All @@ -82,7 +82,7 @@ jobs:
# We just build a container... GitHub doesn't like Fedora :(
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v5
- name: Build the container
run: docker build -t fedoracontainer tss-esapi/tests/ --file tss-esapi/tests/Dockerfile-fedora-rawhide
- name: Run the tests
Expand All @@ -92,7 +92,7 @@ jobs:
name: Valgrind test run
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v5
- name: Build the container
run: docker build -t ubuntucontainer tss-esapi/tests/ --file tss-esapi/tests/Dockerfile-ubuntu --target tpm2-tools
- name: Run the tests
Expand All @@ -103,7 +103,7 @@ jobs:
name: Check documentation
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v5
- name: Build the container
run: docker build -t ubuntucontainer tss-esapi/tests/ --file tss-esapi/tests/Dockerfile-ubuntu --target tpm2-tools
- name: Check documentation
Expand All @@ -114,10 +114,22 @@ jobs:
name: Check Clippy lints
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v5
- name: Build the container
run: docker build -t ubuntucontainer tss-esapi/tests/ --file tss-esapi/tests/Dockerfile-ubuntu --target tpm2-tss
- name: Check Clippy lints MSRV
run: docker run -v $(pwd):/tmp/rust-tss-esapi -w /tmp/rust-tss-esapi/tss-esapi --env RUST_TOOLCHAIN_VERSION=1.74.0 ubuntucontainer /tmp/rust-tss-esapi/tss-esapi/tests/lint-checks.sh
- name: Check Clippy lints latest
run: docker run -v $(pwd):/tmp/rust-tss-esapi -w /tmp/rust-tss-esapi/tss-esapi ubuntucontainer /tmp/rust-tss-esapi/tss-esapi/tests/lint-checks.sh
# Check that it is possible to build the documentation the same way as it is done in Docs.rs
docs-rs:
name: Check Docs.rs compatibility
runs-on: ubuntu-latest
env:
RUSTDOCFLAGS: -Dwarnings
steps:
- uses: actions/checkout@v5
- uses: dtolnay/rust-toolchain@nightly
- uses: dtolnay/install@cargo-docs-rs
- run: cargo docs-rs -p tss-esapi
- run: cargo docs-rs -p tss-esapi-sys
18 changes: 13 additions & 5 deletions tss-esapi/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,26 @@
// SPDX-License-Identifier: Apache-2.0
use semver::{Version, VersionReq};

const TPM2_TSS_MINIMUM_VERSION: Version = Version::new(4, 1, 3);

fn main() {
println!("cargo:rustc-check-cfg=cfg(hierarchy_is_esys_tr)");
println!("cargo:rustc-check-cfg=cfg(has_tss_base_rc_values_28_to_51)");
println!("cargo:rustc-check-cfg=cfg(has_tss_base_rc_values_52_to_53)");
println!("cargo:rustc-check-cfg=cfg(has_tpmu_sensitive_create)");
println!("cargo:rustc-check-cfg=cfg(has_esys_tr_get_tpm_handle)");

let tss_version_string = std::env::var("DEP_TSS2_ESYS_VERSION")
.expect("Failed to parse ENV variable DEP_TSS2_ESYS_VERSION as string");

let tss_version = Version::parse(&tss_version_string)
.expect("Failed to parse the DEP_TSS2_ESYS_VERSION variable as a semver version");
// If documentation for Docs.rs is being built then the version is set
// to the minimum supported tpm2-tss version.
let tss_version = if std::env::var("DOCS_RS").is_ok() {
TPM2_TSS_MINIMUM_VERSION
} else {
let tss_version_string = std::env::var("DEP_TSS2_ESYS_VERSION")
.expect("Failed to parse ENV variable DEP_TSS2_ESYS_VERSION as string");

Version::parse(&tss_version_string)
.expect("Failed to parse the DEP_TSS2_ESYS_VERSION variable as a semver version")
};

let supported_tss_version =
VersionReq::parse("<5.0.0, >=2.3.3").expect("Failed to parse supported TSS version");
Expand Down