Skip to content

tests: move to bats and simplify gha script #515

tests: move to bats and simplify gha script

tests: move to bats and simplify gha script #515

Workflow file for this run

name: "Integration tests"
on:
push:
branches: [main]
pull_request:
branches: [main]
types: [opened, synchronize, reopened, ready_for_review]
defaults:
run:
shell: bash
# Cancel previous running actions for the same PR
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: ${{ github.ref != 'refs/heads/main' }}
jobs:
checks:
if: github.event.pull_request.draft == false
runs-on: ubuntu-24.04
steps:
- name: "Checkout code"
uses: actions/checkout@v4
# Formatting checks
- name: "Python formatting check"
run: ./bin/inv_wrapper.sh format-code --check
# Rust formatting checks
- name: "Run cargo lints"
run: |
for dir in "./vm-cache/" "./tools/check-fork-hashes" "./tools/tee-detect" "./tools/purge-containerd" "./tools/purge-k8s"; do
pushd ${dir} >> /dev/null
cargo fmt --all -- --check
cargo clippy -- -D warnings
popd >> /dev/null
done
- name: "Check forked dependencies hashes match"
run: cargo run --release
working-directory: ./tools/check-fork-hashes
integration-tests:
if: github.event.pull_request.draft == false
strategy:
fail-fast: false
matrix:
include:
- tee: snp
runtime_classes: "qemu qemu-coco-dev qemu-snp qemu-snp-sc2"
- tee: tdx
runtime_classes: "qemu qemu-coco-dev qemu-tdx qemu-tdx-sc2"
runs-on: [self-hosted, "${{ matrix.tee }}"]
env:
KUBECONFIG: .config/kubeadm_kubeconfig
steps:
- name: "Checkout code"
uses: actions/checkout@v4
- name: "Install SC2"
run: ./bin/inv_wrapper.sh sc2.deploy --clean
- name: "Install BATS"
run: sudo -E apt install -y bats
env:
DEBIAN_FRONTEND: noninteractive
- name: "Run integration tests"
run: bats ./tests
env:
SC2_TEE: ${{ matrix.tee }}
- name: "Clean-up"
if: always()
run: ./bin/inv_wrapper.sh sc2.destroy