2021-12-08 11:26:57 +01:00
|
|
|
name: Continuous Integration
|
|
|
|
on: [push, pull_request]
|
|
|
|
jobs:
|
|
|
|
formatting:
|
|
|
|
name: Check formatting
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
|
|
- uses: actions/checkout@v2
|
|
|
|
- name: Check formatting
|
|
|
|
run: cargo fmt --all -- --check
|
|
|
|
|
|
|
|
tests:
|
|
|
|
name: Perform tests
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
container: fedora:latest
|
2021-12-08 11:32:34 +01:00
|
|
|
defaults:
|
|
|
|
run:
|
|
|
|
working-directory: ./clevis-pin-tpm2
|
2021-12-08 11:26:57 +01:00
|
|
|
steps:
|
|
|
|
- uses: actions/checkout@v2
|
2021-12-08 11:32:34 +01:00
|
|
|
with:
|
|
|
|
path: clevis-pin-tpm2
|
|
|
|
- name: Check out the policy signtool
|
|
|
|
uses: actions/checkout@v2
|
|
|
|
with:
|
|
|
|
path: clevis-pin-tpm2-signtool
|
|
|
|
repository: puiterwijk/clevis-pin-tpm2-signtool
|
2021-12-08 11:26:57 +01:00
|
|
|
- name: Install dependencies
|
|
|
|
run: |
|
|
|
|
dnf install -y \
|
2021-12-08 11:32:34 +01:00
|
|
|
tpm2-tss-devel clevis \
|
2021-12-08 11:26:57 +01:00
|
|
|
swtpm swtpm-tools \
|
2021-12-08 11:32:34 +01:00
|
|
|
rust cargo clippy \
|
2023-07-28 11:53:52 +02:00
|
|
|
golang clang-devel
|
2021-12-08 11:32:34 +01:00
|
|
|
- name: Remove clevis-pin-tpm2
|
|
|
|
run: |
|
|
|
|
dnf erase -y clevis-pin-tpm2
|
2021-12-08 11:31:28 +01:00
|
|
|
- name: Build
|
|
|
|
run: cargo build
|
2021-12-08 11:26:57 +01:00
|
|
|
- name: Start swtpm
|
|
|
|
run: |
|
|
|
|
mkdir /tmp/tpmdir
|
|
|
|
swtpm_setup --tpm2 \
|
|
|
|
--tpmstate /tmp/tpmdir \
|
|
|
|
--createek --decryption --create-ek-cert \
|
|
|
|
--create-platform-cert \
|
2021-12-08 13:14:31 +01:00
|
|
|
--pcr-banks sha1,sha256 \
|
2021-12-08 11:26:57 +01:00
|
|
|
--display
|
|
|
|
swtpm socket --tpm2 \
|
|
|
|
--tpmstate dir=/tmp/tpmdir \
|
|
|
|
--flags startup-clear \
|
|
|
|
--ctrl type=tcp,port=2322 \
|
|
|
|
--server type=tcp,port=2321 \
|
|
|
|
--daemon
|
2021-12-08 13:14:31 +01:00
|
|
|
- name: Run integration tests
|
2021-12-08 11:26:57 +01:00
|
|
|
run: |
|
2021-12-08 15:13:06 +01:00
|
|
|
TCTI=swtpm: SKIP_CLEVIS=true cargo test -- --nocapture
|
2021-12-08 11:26:57 +01:00
|
|
|
- name: Run policy tests
|
|
|
|
run: |
|
2021-12-08 15:24:45 +01:00
|
|
|
TCTI=swtpm: ./tests/test_policy
|
2021-12-08 11:26:57 +01:00
|
|
|
- name: Run clippy
|
|
|
|
run: cargo clippy -- -D warnings
|