feat: 添加CM3/4/7的硬件与软件浮点单元构建矩阵,变更api接口为dr_*

This commit is contained in:
2026-07-26 23:34:11 +08:00
parent e8ee92110b
commit 7ba20659b2
16 changed files with 773 additions and 440 deletions
+34
View File
@@ -0,0 +1,34 @@
name: CI
on:
push:
branches: [main, develop]
pull_request:
branches: [main]
jobs:
host:
runs-on: ubuntu-builder
steps:
- uses: actions/checkout@v4
- name: Host build + tests
run: |
cmake -S . -B build-host \
-DBUILD_TESTING=ON -DBUILD_EXAMPLES=ON
cmake --build build-host
ctest --test-dir build-host --output-on-failure
cortex-m:
runs-on: ubuntu-builder
steps:
- uses: actions/checkout@v4
- name: Install ARM GCC
run: |
sudo apt-get update
sudo apt-get install -y gcc-arm-none-eabi
- name: Cortex-M compile matrix (DR_COMPILE_CHECK)
run: |
cmake -S . -B build-matrix -DDR_COMPILE_CHECK=ON
cmake --build build-matrix --parallel $(nproc)
+61 -4
View File
@@ -11,16 +11,67 @@ jobs:
with:
fetch-depth: 0
- name: Verify merge commit
# ── 自动标签:从合并进来的 PR body 提取 v*.*.* ──
- name: Auto-tag from merged PR
id: autotag
run: |
PARENTS=$(git log --format="%P" -1 | wc -w)
[ "$PARENTS" -ge 2 ] || exit 78
set -e
# 已有标签 → 跳过
EXISTING=$(git tag --points-at HEAD | grep '^v' | head -n1)
if [ -n "$EXISTING" ]; then
echo "Tag $EXISTING already exists"
echo "tag=$EXISTING" >> "$GITHUB_OUTPUT"
exit 0
fi
# 非 merge commit → 跳过(直接 push 不处理)
PARENTS=$(git log --format="%P" -1 | wc -w)
if [ "$PARENTS" -lt 2 ]; then
echo "Not a merge commit, skip auto-tag"
exit 0
fi
# 从 merge commit message 提取 PR 号
COMMIT_MSG=$(git log --format="%B" -1)
PR_NUM=$(echo "$COMMIT_MSG" | grep -oP '#\K\d+' | head -1)
if [ -z "$PR_NUM" ]; then
echo "No PR number found in merge message"
exit 0
fi
echo "Merge commit for PR #$PR_NUM"
# 通过 Gitea API 获取 PR body,提取版本号
API="${{ gitea.server_url }}/api/v1/repos/${{ gitea.repository }}/pulls/${PR_NUM}"
TOKEN="${{ gitea.token }}"
PR_BODY=$(curl -s -H "Authorization: token ${TOKEN}" "${API}" | \
python3 -c "import sys,json,re;pr=json.load(sys.stdin);body=pr.get('body','') or '';m=re.search(r'v\d+\.\d+\.\d+',body);print(m.group() if m else '')")
if [ -z "$PR_BODY" ]; then
echo "No version pattern v*.*.* found in PR body"
exit 0
fi
VERSION="$PR_BODY"
echo "Found version: $VERSION"
# 创建本地标签
git config user.email "ci@datarouter"
git config user.name "DataRouter CI"
git tag -a "$VERSION" -m "Release $VERSION"
echo "Created local tag: $VERSION"
# 推送到远端(不会触发本 workflow — 仅匹配 branches: [main])
git push "https://${TOKEN}@${{ gitea.server_url }}/${{ gitea.repository }}" "$VERSION"
echo "Pushed tag: $VERSION"
echo "tag=$VERSION" >> "$GITHUB_OUTPUT"
# ── 读取标签(已有标签 / auto-tag 创建的标签)──
- name: Read tag from HEAD
id: tag
run: |
TAG=$(git tag --points-at HEAD | grep '^v' | head -n1)
[ -n "$TAG" ] || exit 78
[ -n "$TAG" ] || { echo "No version tag on HEAD"; exit 78; }
echo "tag=$TAG" >> "$GITHUB_OUTPUT"
- name: Install cross-compilers
@@ -51,6 +102,12 @@ jobs:
cmake --install "build-$name" --prefix "dist/$pkg"
done
- name: Cortex-M compile matrix
run: |
cmake -S . -B build-cortex-m -DDR_COMPILE_CHECK=ON
cmake --build build-cortex-m --parallel $(nproc)
echo "--- Cortex-M build matrix: all variants passed ---"
- name: Create release & upload assets
run: |
TAG="${{ steps.tag.outputs.tag }}"