gha: add basic lint & build jobs #6
This file contains hidden or 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: CI | |
| on: | |
| push: | |
| branches: | |
| - main | |
| pull_request: | |
| branches: | |
| - main | |
| env: | |
| RUSTFLAGS: "-Dwarnings" | |
| jobs: | |
| lint: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v5 | |
| - name: Setup Rust | |
| uses: actions-rust-lang/setup-rust-toolchain@v1 | |
| with: | |
| toolchain: stable | |
| components: rustfmt, clippy | |
| - name: Install build dependencies | |
| run: | | |
| sudo apt-get update | |
| sudo apt -y install \ | |
| autoconf-archive \ | |
| libcmocka0 \ | |
| libcmocka-dev \ | |
| procps \ | |
| iproute2 \ | |
| build-essential \ | |
| git \ | |
| pkg-config \ | |
| gcc \ | |
| libtool \ | |
| automake \ | |
| libssl-dev \ | |
| uthash-dev \ | |
| autoconf \ | |
| doxygen \ | |
| libjson-c-dev \ | |
| libini-config-dev \ | |
| libcurl4-openssl-dev \ | |
| uuid-dev \ | |
| libltdl-dev \ | |
| libusb-1.0-0-dev \ | |
| libftdi-dev | |
| - name: Clone tpm2-tss repository | |
| run: | | |
| git clone https://github.com/tpm2-software/tpm2-tss.git | |
| cd tpm2-tss | |
| git checkout 4.1.3 | |
| - name: Build and install tpm2-tss | |
| run: | | |
| cd tpm2-tss | |
| ./bootstrap | |
| ./configure --prefix=/usr/local | |
| make -j$(nproc) | |
| sudo make install | |
| sudo ldconfig | |
| - name: Cargo fmt | |
| run: cargo fmt --check | |
| - name: Clippy | |
| run: cargo clippy --all-targets --all-features | |
| build: | |
| runs-on: ubuntu-latest | |
| needs: [lint] | |
| steps: | |
| - uses: actions/checkout@v5 | |
| - name: Setup Rust | |
| uses: actions-rust-lang/setup-rust-toolchain@v1 | |
| with: | |
| toolchain: stable | |
| - name: Install system dependencies | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y \ | |
| build-essential \ | |
| libtss2-dev \ | |
| tpm2-tss \ | |
| pkg-config | |
| - name: Build | |
| run: cargo build |