mirror of
https://github.com/asterinas/asterinas.git
synced 2025-06-29 04:13:24 +00:00
81 lines
2.7 KiB
YAML
81 lines
2.7 KiB
YAML
name: Test OSDK
|
|
|
|
on:
|
|
pull_request:
|
|
paths:
|
|
- osdk/**
|
|
- ostd/**
|
|
- tools/**
|
|
- Cargo.toml
|
|
push:
|
|
branches:
|
|
- main
|
|
# Schedule to run on every day at 21:00 UTC (05:00 Beijing Time)
|
|
schedule:
|
|
- cron: '0 21 * * *'
|
|
|
|
jobs:
|
|
osdk-test:
|
|
if: github.event_name == 'push' || github.event_name == 'pull_request'
|
|
runs-on: ubuntu-latest
|
|
timeout-minutes: 30
|
|
strategy:
|
|
matrix:
|
|
# asterinas/asterinas:0.6.2 container is the developing container of asterinas,
|
|
# asterinas/osdk:0.6.2 container is built with the intructions from Asterinas Book
|
|
container: ['asterinas/asterinas:0.6.2', 'asterinas/osdk:0.6.2']
|
|
container: ${{ matrix.container }}
|
|
steps:
|
|
- run: echo "Running in ${{ matrix.container }}"
|
|
|
|
- uses: actions/checkout@v4
|
|
|
|
- name: Lint
|
|
id: lint
|
|
if: matrix.container == 'asterinas/asterinas:0.6.2'
|
|
run: make check_osdk
|
|
|
|
# Github's actions/checkout@v4 will result in a new user (not root)
|
|
# and thus not using the Rust environment we set up in the container.
|
|
# So the RUSTUP_HOME needs to be set here.
|
|
- name: Unit test
|
|
id: unit_test
|
|
run: |
|
|
cd osdk
|
|
RUSTUP_HOME=/root/.rustup cargo build
|
|
RUSTUP_HOME=/root/.rustup cargo test
|
|
|
|
osdk-test-tdx:
|
|
if: github.event_name == 'schedule'
|
|
runs-on: self-hosted
|
|
timeout-minutes: 30
|
|
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
|
|
strategy:
|
|
matrix:
|
|
# asterinas/asterinas:0.6.2-tdx container is the developing container of asterinas,
|
|
# asterinas/osdk:0.6.2-tdx container is built with the intructions from Asterinas Book
|
|
container: ['asterinas/asterinas:0.6.2-tdx', 'asterinas/osdk:0.6.2-tdx']
|
|
container:
|
|
image: ${{ matrix.container }}
|
|
options: --device=/dev/kvm --privileged
|
|
steps:
|
|
- run: echo "Running in ${{ matrix.container }}"
|
|
- uses: actions/checkout@v4
|
|
- name: Lint
|
|
id: lint
|
|
if: matrix.container == 'asterinas/asterinas:0.6.2-tdx'
|
|
run: make check_osdk
|
|
# Github's actions/checkout@v4 will result in a new user (not root)
|
|
# and thus not using the Rust environment we set up in the container.
|
|
# So the RUSTUP_HOME needs to be set here.
|
|
- name: Unit test
|
|
id: unit_test
|
|
run: |
|
|
cd osdk
|
|
RUSTUP_HOME=/root/.rustup INTEL_TDX=1 cargo build
|
|
RUSTUP_HOME=/root/.rustup INTEL_TDX=1 cargo test
|