Skip to content

image-rs build

image-rs build #117

name: image-rs build
on:
push:
branches:
- 'main'
paths:
- 'image-rs/**'
- '.github/workflows/image_rs_build.yml'
- 'Cargo.toml'
- 'Cargo.lock'
pull_request:
paths:
- 'image-rs/**'
- '.github/workflows/image_rs_build.yml'
- 'Cargo.toml'
- 'Cargo.lock'
create:
workflow_dispatch:
jobs:
ci:
name: Check
defaults:
run:
working-directory: ./image-rs
runs-on: ubuntu-22.04
strategy:
fail-fast: false
matrix:
rust:
- 1.72.0
- stable
steps:
- name: Code checkout
uses: actions/checkout@v4
with:
fetch-depth: 1
- name: Install Rust toolchain (${{ matrix.rust }})
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: ${{ matrix.rust }}
override: true
components: rustfmt, clippy
- name: Install nettle-sys building dependence
run: |
sudo apt install clang llvm pkg-config nettle-dev protobuf-compiler libprotobuf-dev
- name: Install TDX dependencies
run: |
sudo curl -sL https://download.01.org/intel-sgx/sgx_repo/ubuntu/intel-sgx-deb.key | sudo gpg --dearmor --output /usr/share/keyrings/intel-sgx.gpg
sudo echo 'deb [arch=amd64 signed-by=/usr/share/keyrings/intel-sgx.gpg] https://download.01.org/intel-sgx/sgx_repo/ubuntu jammy main' | sudo tee /etc/apt/sources.list.d/intel-sgx.list
sudo apt-get update
sudo apt-get install -y --no-install-recommends libtdx-attest-dev
- name: Install TPM dependencies
run: |
sudo apt-get update
sudo apt-get install -y libtss2-dev
- name: Install dm-verity dependencies
run: |
sudo apt-get update
sudo apt-get install -y libdevmapper-dev
- name: Install cross-compliation support dependencies
run: |
sudo apt install -y gcc-s390x-linux-gnu gcc-powerpc64le-linux-gnu
rustup target add s390x-unknown-linux-gnu powerpc64le-unknown-linux-gnu
- name: Run cargo fmt check
uses: actions-rs/cargo@v1
with:
command: fmt
args: -p image-rs -- --check
- name: Run rust lint check
run: |
cargo clippy -p image-rs --all-targets --features=default -- -D warnings
cargo clippy -p image-rs --all-targets --features=kata-cc-rustls-tls --no-default-features -- -D warnings
cargo clippy -p image-rs --all-targets --features=kata-cc-native-tls --no-default-features -- -D warnings
cargo clippy -p image-rs --all-targets --features=enclave-cc-cckbc-native-tls --no-default-features -- -D warnings
cargo clippy -p image-rs --all-targets --features=kata-cc-native-tls,signature-simple-xrss --no-default-features -- -D warnings
cargo clippy -p image-rs --all-targets --features=kata-cc-native-tls,nydus --no-default-features -- -D warnings
- name: Run cargo build
uses: actions-rs/cargo@v1
with:
command: build
args: -p image-rs --features default
- name: Run cargo build, cross-compiling for s390x
run: |
sudo -E PATH=$PATH -s RUSTFLAGS=" -C linker=s390x-linux-gnu-gcc" cargo build --target s390x-unknown-linux-gnu -p image-rs --features default
- name: Run cargo build, cross-compiling for powerpc64le
run: |
sudo -E PATH=$PATH -s RUSTFLAGS=" -C linker=powerpc64le-linux-gnu-gcc" cargo build --target powerpc64le-unknown-linux-gnu -p image-rs --features default
- name: Run cargo test - default
run: |
sudo -E PATH=$PATH -s cargo test -p image-rs --features default
# TODO: delete the comment after https://github.com/confidential-containers/guest-components/issues/430
# - name: Run cargo test - kata-cc (rust-tls version) with keywrap-grpc + keywrap-jwe
# run: |
# sudo -E PATH=$PATH -s cargo test -p image-rs --no-default-features --features=encryption-ring,keywrap-grpc,snapshot-overlayfs,signature-cosign-rustls,signature-simple,getresource,oci-distribution/rustls-tls,keywrap-jwe
# - name: Run cargo test - kata-cc (native-tls version) with keywrap-grpc + keywrap-jwe
# run: |
# sudo -E PATH=$PATH -s cargo test -p image-rs --no-default-features --features=encryption-openssl,keywrap-grpc,snapshot-overlayfs,signature-cosign-native,signature-simple,getresource,oci-distribution/native-tls,keywrap-jwe
- name: Run cargo test - kata-cc (rust-tls version) with keywrap-ttrpc (default) + keywrap-jwe
run: |
sudo -E PATH=$PATH -s cargo test -p image-rs --no-default-features --features=kata-cc-rustls-tls,keywrap-jwe
- name: Run cargo test - kata-cc (native-tls version) with keywrap-ttrpc (default) + keywrap-jwe
run: |
sudo -E PATH=$PATH -s cargo test -p image-rs --no-default-features --features=kata-cc-native-tls,keywrap-jwe
- name: Run cargo test - kata-cc (native-tls version) with keywrap-ttrpc (default) + keywrap-jwe and with signatures from XRSS registry extension
env:
AUTH_PASSWORD: ${{ secrets.SH_ICR_API_KEY }}
run: |
sudo -E PATH=$PATH -s cargo test -p image-rs --no-default-features --features=kata-cc-native-tls,keywrap-jwe,signature-simple-xrss
- name: Run cargo test - kata-cc (native-tls version) with keywrap-ttrpc (default) + keywrap-jwe + nydus
run: |
sudo -E PATH=$PATH -s cargo test -p image-rs --no-default-features --features=kata-cc-native-tls,keywrap-jwe,nydus