DragonOS/.github/workflows/test-x86.yml

101 lines
2.9 KiB
YAML
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

name: Test x86_64
on:
workflow_dispatch:
push:
branches: ["master", "feat-*", "fix-*"]
pull_request:
branches: ["master", "feat-*", "fix-*"]
env:
ARCH: x86_64
HOME: /root
RUSTUP_DIST_SERVER: "https://rsproxy.cn"
RUSTUP_UPDATE_ROOT: "https://rsproxy.cn/rustup"
jobs:
integration-test:
name: Integration Test
runs-on: ubuntu-latest
timeout-minutes: 60
container:
image: dragonos/dragonos-dev:v1.19
options: --privileged -v /dev:/dev
steps:
- name: Checkout DragonOS code
uses: actions/checkout@v4
- name: Change source
run: |
find . -type f \( -name "*.toml" -o -name "Makefile" \) -exec sed -i 's/git\.mirrors\.dragonos\.org\.cn/github\.com/g' {} +
- name: Build DragonOS
shell: bash -ileo pipefail {0}
run: |
make clean
make -j$(nproc) all
- name: Run syscall test
id: test-syscall
shell: bash -ileo pipefail {0}
env:
DISK_SAVE_MODE: "1"
run: |
make test-syscall
- name: Upload test results
if: always() && github.repository == 'DragonOS-Community/DragonOS'
shell: bash -ileo pipefail {0}
env:
API_KEY: ${{ secrets.CI_DASHBOARD_UPLOAD_API_KEY }}
run: |
# 更新包列表并安装pip
apt-get update
apt-get install -y python3-pip python3-venv
# 创建虚拟环境(可选,但更安全)
python3 -m venv /tmp/venv
source /tmp/venv/bin/activate
# 升级pip
pip install --upgrade pip
# 安装Python依赖
pip install -r tools/test-upload/requirements.txt
# 设置变量
BRANCH_NAME="${{ github.ref_name }}"
COMMIT_ID="${{ github.sha }}"
API_URL="https://ci-dashboard.dragonos.org/api/v1"
# 如果是PR使用PR的分支名
if [ "${{ github.event_name }}" == "pull_request" ]; then
BRANCH_NAME="${{ github.head_ref }}"
fi
# 检查日志文件是否存在
if [ ! -f "serial_opt.txt" ]; then
echo "警告: serial_opt.txt文件不存在跳过上传"
exit 0
fi
# 检查API_KEY是否存在如果不存在则使用dry-run模式
if [ -z "$API_KEY" ]; then
echo "警告: CI_DASHBOARD_UPLOAD_API_KEY secret未设置使用dry-run模式"
python3 tools/test-upload/parse_and_upload.py \
serial_opt.txt \
"$API_URL" \
--branch "$BRANCH_NAME" \
--commit "$COMMIT_ID" \
--test-type "gvisor" \
--dry-run
else
# 上传测试结果
python3 tools/test-upload/parse_and_upload.py \
serial_opt.txt \
"$API_URL" \
--branch "$BRANCH_NAME" \
--commit "$COMMIT_ID" \
--test-type "gvisor"
fi