Add GitHub CI

Signed-off-by: Patrick Uiterwijk <patrick@puiterwijk.org>
This commit is contained in:
Patrick Uiterwijk 2021-12-08 11:26:57 +01:00
parent 0767310e85
commit a0a194a0f9
No known key found for this signature in database
GPG key ID: A0A847B80FBBFF4A

45
.github/workflows/ci.yml vendored Normal file
View file

@ -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