From 6ff6db216762760af13202771af1352ec13abc46 Mon Sep 17 00:00:00 2001 From: Hsy-Intel Date: Tue, 9 Jul 2024 10:49:27 +0800 Subject: [PATCH] Add TDX CI --- .github/workflows/test_asterinas.yml | 60 ++++++++++++++++++++++++++++ docs/src/kernel/intel_tdx.md | 2 +- 2 files changed, 61 insertions(+), 1 deletion(-) diff --git a/.github/workflows/test_asterinas.yml b/.github/workflows/test_asterinas.yml index 2360ea0a3..3db196139 100644 --- a/.github/workflows/test_asterinas.yml +++ b/.github/workflows/test_asterinas.yml @@ -5,9 +5,13 @@ on: push: branches: - main + # Schedule to run on every day at 15:00 UTC (23:00 CST) + schedule: + - cron: '0 15 * * *' jobs: lint: + if: github.event_name == 'push' || github.event_name == 'pull_request' runs-on: ubuntu-latest timeout-minutes: 15 container: asterinas/asterinas:0.6.2 @@ -21,6 +25,7 @@ jobs: run: make check unit-test: + if: github.event_name == 'push' || github.event_name == 'pull_request' runs-on: ubuntu-latest timeout-minutes: 15 container: asterinas/asterinas:0.6.2 @@ -40,6 +45,7 @@ jobs: # TODO: add component check. integration-test: + if: github.event_name == 'push' || github.event_name == 'pull_request' runs-on: ubuntu-latest timeout-minutes: 30 container: asterinas/asterinas:0.6.2 @@ -86,3 +92,57 @@ jobs: - name: General Test (Linux EFI Handover Boot Protocol) id: test_linux run: make run AUTO_TEST=test ENABLE_KVM=0 BOOT_PROTOCOL=linux-efi-handover64 RELEASE=1 + + integration-test-tdx: + if: github.event_name == 'schedule' + runs-on: self-hosted + timeout-minutes: 30 + container: + image: asterinas/asterinas:0.6.2-tdx + options: --device=/dev/kvm --privileged + env: + # Need to set up proxy since the self-hosted CI server is located in China, + # which has poor network connection to the official Rust crate repositories. + RUSTUP_DIST_SERVER: https://mirrors.ustc.edu.cn/rust-static + RUSTUP_UPDATE_ROOT: https://mirrors.ustc.edu.cn/rust-static/rustup + steps: + - run: echo "Running in asterinas/asterinas:0.6.2-tdx" + - uses: actions/checkout@v4 + - name: Set up the environment + run: | + chmod +x test/benchmark/bench_linux_and_aster.sh + # Set up git due to the network issue on the self-hosted runner + git config --global --add safe.directory /__w/asterinas/asterinas + git config --global http.sslVerify false + git config --global http.version HTTP/1.1 + - name: Boot Test (Linux EFI Handover Boot Protocol) + uses: nick-invision/retry@v2 + id: boot_test_linux_efi_handover64 + with: + timeout_minutes: 20 + max_attempts: 3 + command: make run AUTO_TEST=boot INTEL_TDX=1 + + - name: Syscall Test (Linux EFI Handover Boot Protocol) + uses: nick-invision/retry@v2 + id: syscall_test + with: + timeout_minutes: 20 + max_attempts: 3 + command: make run AUTO_TEST=syscall INTEL_TDX=1 + + - name: Syscall Test at Exfat + uses: nick-invision/retry@v2 + id: syscall_test_at_exfat_linux + with: + timeout_minutes: 20 + max_attempts: 3 + command: make run AUTO_TEST=syscall SYSCALL_TEST_DIR=/exfat EXTRA_BLOCKLISTS_DIRS=blocklists.exfat INTEL_TDX=1 + + - name: General Test (Linux EFI Handover Boot Protocol) + uses: nick-invision/retry@v2 + id: test_linux + with: + timeout_minutes: 20 + max_attempts: 3 + command: make run AUTO_TEST=test INTEL_TDX=1 diff --git a/docs/src/kernel/intel_tdx.md b/docs/src/kernel/intel_tdx.md index ced02d55f..3eea3c052 100644 --- a/docs/src/kernel/intel_tdx.md +++ b/docs/src/kernel/intel_tdx.md @@ -66,7 +66,7 @@ git clone https://github.com/asterinas/asterinas 2. Run a Docker container as the development environment. ```bash -docker run -it --privileged --network=host --device=/dev/kvm -v $(pwd)/asterinas:/root/asterinas asterinas/asterinas:0.6.2_tdx +docker run -it --privileged --network=host --device=/dev/kvm -v $(pwd)/asterinas:/root/asterinas asterinas/asterinas:0.6.2-tdx ``` 3. Inside the container,