From a0a194a0f946c60f65166bb0a20359ca36c0e47b Mon Sep 17 00:00:00 2001 From: Patrick Uiterwijk Date: Wed, 8 Dec 2021 11:26:57 +0100 Subject: [PATCH] Add GitHub CI Signed-off-by: Patrick Uiterwijk --- .github/workflows/ci.yml | 45 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) create mode 100644 .github/workflows/ci.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..28347b1 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,45 @@ +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 + steps: + - uses: actions/checkout@v2 + - name: Install dependencies + run: | + dnf install -y \ + tpm2-tss-devel \ + swtpm swtpm-tools \ + rust cargo clippy + - name: Start swtpm + run: | + mkdir /tmp/tpmdir + swtpm_setup --tpm2 \ + --tpmstate /tmp/tpmdir \ + --createek --decryption --create-ek-cert \ + --create-platform-cert \ + --display + swtpm socket --tpm2 \ + --tpmstate dir=/tmp/tpmdir \ + --flags startup-clear \ + --ctrl type=tcp,port=2322 \ + --server type=tcp,port=2321 \ + --daemon + - name: Run PCR tests + run: | + TCTI=swtpm: ./tests/test_pcr + - name: Run policy tests + run: | + TCTI=swtpm: ./tests/test_policy + - name: Run clippy + run: cargo clippy -- -D warnings