Skip to content

Commit

Permalink
Added new snphost CI PR test
Browse files Browse the repository at this point in the history
Performs snphost cargo tests on the self-hosted runner

Signed-off-by: Harika Nittala <[email protected]>
  • Loading branch information
LakshmiSaiHarika committed Nov 13, 2024
1 parent 90c44ce commit 93f7a52
Showing 1 changed file with 44 additions and 0 deletions.
44 changes: 44 additions & 0 deletions .github/workflows/snphost_ci_test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
name: snphost CI PR test

on:
pull_request_target:
types:
- reopened
- opened
- edited
- synchronize
workflow_dispatch:

jobs:
snp_host_tests:
runs-on: self-hosted
steps:
- name: Checkout Repository
uses: actions/checkout@v2

- name: Verify if SNP is enabled on the host
run: |
verify_snp_host() {
if ! sudo dmesg | grep -i "SEV-SNP enabled" 2>&1 >/dev/null; then
echo -e "SEV-SNP not enabled on the host. Please follow these steps to enable:\n\
$(echo "${AMDSEV_URL}" | sed 's|\.git$||g')/tree/${AMDSEV_DEFAULT_BRANCH}#prepare-host"
return 1
fi
}
verify_snp_host
- name: snphost tool PR test on self-hosted runner
run: |
rm -rf ~/snphost
cd ~/
git clone https://github.com/virtee/snphost.git
cd ~/snphost
# Checkout PR branch
if [ ${{ github.event_name }} == "pull_request_target" ]; then
git fetch origin pull/${{ github.event.pull_request.number }}/head:${{ github.head_ref }}
git switch ${{ github.head_ref }}
fi
# Perform cargo test on the host
cargo test

0 comments on commit 93f7a52

Please sign in to comment.