-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 74c25af
Showing
90 changed files
with
11,028 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,261 @@ | ||
name: "Cargo CI/CD pipeline" | ||
on: | ||
workflow_call: | ||
inputs: | ||
MAKE_RELEASE: | ||
required: false | ||
type: string | ||
default: "false" | ||
TOOLCHAIN_MIN: | ||
required: false | ||
type: string | ||
default: "1.79.0" | ||
TOOLCHAIN_MAX: | ||
required: false | ||
type: string | ||
default: "1.80.1" | ||
OS_VERS_MIN: | ||
required: false | ||
type: string | ||
default: "22.04" | ||
OS_VERS_MAX: | ||
required: false | ||
type: string | ||
default: "24.04" | ||
|
||
jobs: | ||
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ||
# Code formatting | ||
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ||
format: | ||
name: cargo fmt | ||
runs-on: ubuntu-${{ inputs.OS_VERS_MAX }} | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: actions-rust-lang/setup-rust-toolchain@v1 | ||
with: | ||
toolchain: ${{ inputs.TOOLCHAIN_MAX }} | ||
rustflags: "-D warnings" | ||
components: rustfmt | ||
- uses: actions-rust-lang/rustfmt@v1 | ||
|
||
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ||
# Code checks | ||
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ||
checks: | ||
name: cargo check | ||
strategy: | ||
matrix: | ||
platform: ["${{ inputs.OS_VERS_MIN }}", "${{ inputs.OS_VERS_MAX }}"] | ||
rust: ["${{ inputs.TOOLCHAIN_MIN }}", "${{ inputs.TOOLCHAIN_MAX }}"] | ||
runs-on: ubuntu-${{ matrix.platform }} | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: actions-rust-lang/setup-rust-toolchain@v1 | ||
with: | ||
toolchain: ${{ matrix.rust }} | ||
rustflags: "-D warnings" | ||
- uses: awalsh128/cache-apt-pkgs-action@v1 | ||
with: | ||
packages: libtss2-dev uuid-dev libjson-c-dev libcurl4-openssl-dev | ||
- run: cargo check | ||
|
||
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ||
# Integeration tests | ||
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ||
tests: | ||
name: cargo test | ||
needs: [format, checks] | ||
strategy: | ||
matrix: | ||
platform: ["${{ inputs.OS_VERS_MIN }}", "${{ inputs.OS_VERS_MAX }}"] | ||
rust: ["${{ inputs.TOOLCHAIN_MIN }}", "${{ inputs.TOOLCHAIN_MAX }}"] | ||
profile: [RSA2048SHA256, ECCP256SHA256] | ||
runs-on: ubuntu-${{ matrix.platform }} | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: actions-rust-lang/setup-rust-toolchain@v1 | ||
with: | ||
toolchain: ${{ matrix.rust }} | ||
rustflags: "-D warnings" | ||
- uses: awalsh128/cache-apt-pkgs-action@v1 | ||
with: | ||
packages: libtss2-dev uuid-dev libjson-c-dev libcurl4-openssl-dev | ||
- run: | | ||
make -C tools/docker/swtpm DETACH=1 | ||
RUST_LOG=info TSS2_LOG=all+none FAPI_RS_TEST_PROF=${{ matrix.profile }} cargo test --tests | ||
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ||
# Code coverage analysis (codecov) | ||
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ||
codecov: | ||
name: codecov | ||
needs: [format, checks] | ||
runs-on: ubuntu-${{ inputs.OS_VERS_MAX }} | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: actions-rust-lang/setup-rust-toolchain@v1 | ||
with: | ||
toolchain: ${{ inputs.TOOLCHAIN_MAX }} | ||
rustflags: "-D warnings" | ||
components: llvm-tools-preview | ||
- uses: taiki-e/install-action@cargo-llvm-cov | ||
- uses: awalsh128/cache-apt-pkgs-action@v1 | ||
with: | ||
packages: libtss2-dev uuid-dev libjson-c-dev libcurl4-openssl-dev | ||
- run: | | ||
make -C tools/docker/swtpm DETACH=1 | ||
TSS2_LOG=all+none ./tools/codecov/code-coverage.sh ccov target/fapi-rs-codecov-output.json | ||
- uses: actions/upload-artifact@v4 | ||
with: | ||
name: code-coverage-analysis | ||
path: target/fapi-rs-codecov-output.json | ||
- uses: codecov/codecov-action@v4 | ||
with: | ||
files: target/fapi-rs-codecov-output.json | ||
verbose: true | ||
token: ${{ secrets.CODECOV_TOKEN }} | ||
|
||
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ||
# Build binaries | ||
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ||
build: | ||
name: cargo build | ||
needs: tests | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
platform: ["${{ inputs.OS_VERS_MIN }}", "${{ inputs.OS_VERS_MAX }}"] | ||
rust: ["${{ inputs.TOOLCHAIN_MIN }}", "${{ inputs.TOOLCHAIN_MAX }}"] | ||
runs-on: ubuntu-${{ matrix.platform }} | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: actions-rust-lang/setup-rust-toolchain@v1 | ||
with: | ||
toolchain: ${{ matrix.rust }} | ||
rustflags: "-D warnings" | ||
- uses: awalsh128/cache-apt-pkgs-action@v1 | ||
with: | ||
packages: libtss2-dev uuid-dev libjson-c-dev libcurl4-openssl-dev | ||
- run: cargo build --release | ||
- run: cp -vf README.md LICENSE target/release/ | ||
- run: | | ||
printf "%s\n%s\n%s\n%s\n%s\n" "${GITHUB_REF} @ ${GITHUB_SHA:0:12}" \ | ||
"$(date -R)" "$(lsb_release -s -d)" "$(rustc --version)" \ | ||
"$(pkg-config --print-provides tss2-fapi)" > target/release/BUILD_INFO | ||
- uses: actions/upload-artifact@v4 | ||
with: | ||
name: dist.binary.ubuntu-${{ matrix.platform }}-rust-${{ matrix.rust }} | ||
path: | | ||
target/release/libtss2_fapi_rs.rlib | ||
target/release/README.md | ||
target/release/LICENSE | ||
target/release/BUILD_INFO | ||
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ||
# Generate documentation | ||
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ||
docs: | ||
name: cargo doc | ||
needs: tests | ||
runs-on: ubuntu-${{ inputs.OS_VERS_MAX }} | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: actions-rust-lang/setup-rust-toolchain@v1 | ||
with: | ||
toolchain: ${{ inputs.TOOLCHAIN_MAX }} | ||
rustflags: "-D warnings" | ||
- uses: awalsh128/cache-apt-pkgs-action@v1 | ||
with: | ||
packages: libtss2-dev uuid-dev libjson-c-dev libcurl4-openssl-dev | ||
- run: cargo doc --no-deps | ||
- run: | | ||
cp -f docs/html/redir.html target/doc/index.html | ||
rm -f target/doc/.lock | ||
- uses: actions/upload-pages-artifact@v3 | ||
with: | ||
path: target/doc/ | ||
|
||
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ||
# Assemble package into a distributable tarball | ||
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ||
package: | ||
name: cargo package | ||
needs: tests | ||
runs-on: ubuntu-${{ inputs.OS_VERS_MAX }} | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: actions-rust-lang/setup-rust-toolchain@v1 | ||
with: | ||
toolchain: ${{ inputs.TOOLCHAIN_MAX }} | ||
rustflags: "-D warnings" | ||
- uses: awalsh128/cache-apt-pkgs-action@v1 | ||
with: | ||
packages: libtss2-dev uuid-dev libjson-c-dev libcurl4-openssl-dev | ||
- run: cargo package | ||
- uses: actions/upload-artifact@v4 | ||
with: | ||
name: dist.package | ||
path: target/package/**/*.crate | ||
|
||
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ||
# Release build artifacts on GitHub | ||
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ||
release: | ||
name: release build | ||
if: ${{ inputs.MAKE_RELEASE == 'true' }} | ||
needs: build | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/download-artifact@v4 | ||
with: | ||
pattern: dist.* | ||
path: artifacts | ||
- working-directory: artifacts | ||
run: | | ||
for variant in dist.binary.*; do pushd ${variant}; \ | ||
tar -czvf ../tss2-fapi-rs-${{ github.ref_name }}-${variant:10}.tar.gz *; \ | ||
popd; done; mv -vf dist.package/*.crate ./ | ||
- uses: Roang-zero1/github-upload-release-artifacts-action@v2 | ||
with: | ||
args: artifacts/ | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ||
# Publish new release to Creates.io | ||
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ||
publish: | ||
name: cargo publish | ||
if: ${{ inputs.MAKE_RELEASE == 'true' }} | ||
needs: build | ||
runs-on: ubuntu-${{ inputs.OS_VERS_MAX }} | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: actions-rust-lang/setup-rust-toolchain@v1 | ||
- uses: awalsh128/cache-apt-pkgs-action@v1 | ||
with: | ||
packages: libtss2-dev uuid-dev libjson-c-dev libcurl4-openssl-dev | ||
- run: cargo publish | ||
env: | ||
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }} | ||
|
||
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ||
# TODO: Re-enabled, once GitHub pages have been activated! | ||
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ||
# pages: | ||
# name: deploy pages | ||
# needs: docs | ||
# if: github.ref == 'refs/heads/main' | ||
# runs-on: ubuntu-${{ inputs.OS_VERS_MAX }} | ||
# permissions: | ||
# pages: write | ||
# id-token: write | ||
# environment: | ||
# name: github-pages | ||
# url: ${{ steps.deployment.outputs.page_url }} | ||
# steps: | ||
# - name: Deploy to GitHub Pages | ||
# id: deployment | ||
# uses: actions/deploy-pages@v4 | ||
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
name: "Release" | ||
on: | ||
release: | ||
types: [published] | ||
|
||
jobs: | ||
cargo-ci-pipeline: | ||
name: CI | ||
uses: ./.github/workflows/cargo-ci-pipeline.yaml | ||
with: | ||
MAKE_RELEASE: "true" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
name: "Check" | ||
on: | ||
push: | ||
branches: ['**'] | ||
pull_request: | ||
|
||
jobs: | ||
cargo-ci-pipeline: | ||
name: CI | ||
uses: ./.github/workflows/cargo-ci-pipeline.yaml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
name: "Nightly" | ||
on: | ||
schedule: | ||
- cron: "19 1 * * *" | ||
|
||
jobs: | ||
cargo-ci-pipeline: | ||
name: CI | ||
uses: ./.github/workflows/cargo-ci-pipeline.yaml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
/**/log | ||
/**/out | ||
/**/target/ | ||
/**/tmp |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
stages: | ||
- check | ||
- build | ||
|
||
cargo check: | ||
stage: check | ||
tags: | ||
- linux-docker-x64 | ||
image: rust:latest | ||
script: | ||
- apt-get update && apt-get install -y libclang-dev libtss2-dev | ||
- cargo check | ||
|
||
cargo doc: | ||
stage: build | ||
tags: | ||
- linux-docker-x64 | ||
image: rust:latest | ||
script: | ||
- apt-get update && apt-get install -y libclang-dev libtss2-dev | ||
- cargo doc --no-deps | ||
- cp -f docs/html/redir.html target/doc/index.html | ||
artifacts: | ||
paths: | ||
- "target/doc" | ||
|
||
cargo build: | ||
stage: build | ||
tags: | ||
- linux-docker-x64 | ||
image: rust:latest | ||
script: | ||
- apt-get update && apt-get install -y libclang-dev libtss2-dev | ||
- cargo build --release | ||
artifacts: | ||
paths: | ||
- "target/release/*.rlib" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
# Change Log | ||
|
||
All notable changes to this project will be documented in this file. | ||
|
||
The format is based on [Keep a Changelog](http://keepachangelog.com/). | ||
|
||
## [1.0.0] - 2024-??-?? | ||
|
||
### Added | ||
- This is the first public release of this project. |
Oops, something went wrong.