Merge pull request #25 from sergio-correia/trim-input #46
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
name: Continuous Integration | |
on: [push, pull_request] | |
jobs: | |
formatting: | |
name: Check formatting | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Check formatting | |
run: cargo fmt --all -- --check | |
tests: | |
name: Perform tests | |
runs-on: ubuntu-latest | |
container: fedora:latest | |
defaults: | |
run: | |
working-directory: ./clevis-pin-tpm2 | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
path: clevis-pin-tpm2 | |
- name: Check out the policy signtool | |
uses: actions/checkout@v4 | |
with: | |
path: clevis-pin-tpm2-signtool | |
repository: puiterwijk/clevis-pin-tpm2-signtool | |
- name: Install dependencies | |
run: | | |
dnf install -y \ | |
tpm2-tss-devel clevis \ | |
swtpm swtpm-tools \ | |
rust cargo clippy \ | |
golang clang-devel \ | |
git-core | |
- name: Remove clevis-pin-tpm2 | |
run: | | |
rm -f /usr/bin/clevis-pin-tpm2 /usr/bin/clevis-*-tpm2plus | |
- name: Build | |
run: cargo build | |
- name: Start swtpm | |
run: | | |
mkdir /tmp/tpmdir | |
swtpm_setup --tpm2 \ | |
--tpmstate /tmp/tpmdir \ | |
--createek --decryption --create-ek-cert \ | |
--create-platform-cert \ | |
--pcr-banks sha1,sha256 \ | |
--display | |
swtpm socket --tpm2 \ | |
--tpmstate dir=/tmp/tpmdir \ | |
--flags startup-clear \ | |
--ctrl type=tcp,port=2322 \ | |
--server type=tcp,port=2321 \ | |
--daemon | |
- name: Run integration tests | |
run: | | |
TCTI=swtpm: SKIP_CLEVIS=true cargo test -- --nocapture | |
echo "### Shell integration tests" >&2 | |
TCTI=swtpm: SKIP_CLEVIS=true ./tests/integration-test.sh | |
- name: Run policy tests | |
run: | | |
TCTI=swtpm: ./tests/test_policy | |
- name: Run clippy | |
run: cargo clippy -- -D warnings |