Skip to content

Commit

Permalink
Initial commit.
Browse files Browse the repository at this point in the history
  • Loading branch information
danieltrick committed Sep 2, 2024
0 parents commit 034ab0e
Show file tree
Hide file tree
Showing 85 changed files with 10,848 additions and 0 deletions.
114 changes: 114 additions & 0 deletions .github/workflows/cargo-workflow.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,114 @@
name: "Cargo CI/CD"
on:
push:
pull_request:

jobs:
format:
name: cargo fmt
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v4
- uses: actions-rust-lang/setup-rust-toolchain@v1
- run: cargo fmt --check

checks:
name: cargo check
runs-on: ubuntu-24.04
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
- run: cargo check

tests:
name: cargo test
needs:
- format
- checks
runs-on: ubuntu-24.04
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
- run: make -C tools/docker/swtpm DETACH=1
- run: RUST_LOG=info TSS2_LOG=all+none FAPI_RS_TEST_PROF=RSA2048SHA256 cargo test --tests
- run: RUST_LOG=info TSS2_LOG=all+none FAPI_RS_TEST_PROF=ECCP256SHA256 cargo test --tests

codecov:
name: codecov
needs:
- format
- checks
runs-on: ubuntu-24.04
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
- run: make -C tools/docker/swtpm DETACH=1
- run: TSS2_LOG=all+none ./tools/codecov/code-coverage.sh ccov target/codecov-report.xml
- uses: codecov/codecov-action@v4
with:
files: target/codecov-report.xml
verbose: true
token: ${{ secrets.CODECOV_TOKEN }}

build:
name: cargo build
needs: tests
runs-on: ubuntu-24.04
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
- run: cargo build --release
- uses: actions/upload-artifact@v4
with:
name: libtss2_fapi_rs
path: target/release/libtss2_fapi_rs.rlib
retention-days: 90

docs:
name: cargo doc
needs: tests
runs-on: ubuntu-24.04
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
- run: cargo doc --no-deps
- run: cp -f docs/public_html/index.html target/doc/index.html
- run: rm -f target/doc/.lock
- uses: actions/upload-pages-artifact@v3
with:
path: target/doc/

# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# TODO: Re-enabled, once GitHub pages have been activated!
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# deploy:
# name: deploy pages
# needs: docs
# if: github.ref == 'refs/heads/main'
# runs-on: ubuntu-24.04
# 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
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
30 changes: 30 additions & 0 deletions .github/workflows/publish-release.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: "Cargo publish release to crates.io"
on:
release:
types: [published]

jobs:
checks:
name: cargo check
runs-on: ubuntu-24.04
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
- run: cargo check

publish:
name: cargo publish
needs: checks
runs-on: ubuntu-24.04
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
- run: cargo publish --token ${CRATES_TOKEN}
env:
CRATES_TOKEN: ${{ secrets.CRATES_TOKEN }}
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
/**/log
/**/out
/**/target/
/**/tmp
37 changes: 37 additions & 0 deletions .gitlab-ci.yml
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/public_html/index.html target/doc
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"
10 changes: 10 additions & 0 deletions CHANGELOG.md
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.
Loading

0 comments on commit 034ab0e

Please sign in to comment.