Skip to content

Commit 9cba591

Browse files
committed
feat:更新CI
1 parent 4197994 commit 9cba591

10 files changed

Lines changed: 564 additions & 112 deletions

File tree

.github/workflows/RefactoringMSBuild.yml

Lines changed: 0 additions & 72 deletions
This file was deleted.

.github/workflows/build.yml

Lines changed: 102 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,102 @@
1+
# Root CMake workflow: same presets as locally (CMakePresets.json), override CMT_SDK_DIR per matrix cell.
2+
# Matrix = one parallel job per (OS × sdk) — 8 SDKs × 2 OS = 16 jobs (subject to org concurrency limits).
3+
4+
name: Build
5+
6+
on:
7+
push:
8+
branches: [main]
9+
workflow_dispatch:
10+
workflow_call:
11+
inputs:
12+
ref:
13+
description: Git ref to checkout (e.g. tag ref for releases)
14+
type: string
15+
required: false
16+
default: ""
17+
18+
concurrency:
19+
group: build-${{ github.workflow }}-${{ github.ref }}
20+
cancel-in-progress: true
21+
22+
permissions:
23+
contents: read
24+
25+
env:
26+
CMAKE_BUILD_PARALLEL_LEVEL: 4
27+
28+
jobs:
29+
matrix-build:
30+
defaults:
31+
run:
32+
shell: bash
33+
strategy:
34+
fail-fast: false
35+
matrix:
36+
os: [windows-latest, macos-latest]
37+
sdk:
38+
- sdk_r20
39+
- sdk_r21
40+
- sdk_r23
41+
- sdk_r25
42+
- sdk_2023
43+
- sdk_2024
44+
- sdk_2025
45+
- sdk_2026
46+
include:
47+
- os: windows-latest
48+
configure_preset: dev-windows
49+
build_preset: workflow-release
50+
deps_generator: "Visual Studio 17 2022"
51+
deps_generator_extra: -A x64 -T v143
52+
- os: macos-latest
53+
configure_preset: dev-macos
54+
build_preset: workflow-release-macos
55+
deps_generator: Xcode
56+
deps_generator_extra: -DCMAKE_OSX_ARCHITECTURES=arm64;x86_64
57+
58+
runs-on: ${{ matrix.os }}
59+
60+
steps:
61+
- name: Checkout
62+
uses: actions/checkout@v4
63+
with:
64+
# workflow_call: optional ref; push/dispatch: never read inputs (undefined outside workflow_call)
65+
ref: ${{ github.event_name == 'workflow_call' && (inputs.ref != '' && inputs.ref || github.ref) || github.ref }}
66+
submodules: recursive
67+
68+
- name: Cache prebuilt dependencies
69+
id: deps-cache
70+
uses: actions/cache@v4
71+
with:
72+
path: _build_msvc/cmt_deps_prebuilt
73+
key: deps-prebuilt-${{ runner.os }}-${{ hashFiles('dependency/**', 'cmake/mmdtool_plugin_dependencies.cmake') }}
74+
75+
- name: Build dependencies (on cache miss)
76+
if: steps.deps-cache.outputs.cache-hit != 'true'
77+
run: |
78+
cmake -S dependency -B _build_msvc/cmt_deps \
79+
-G "${{ matrix.deps_generator }}" \
80+
${{ matrix.deps_generator_extra }} \
81+
"-DCMAKE_ARCHIVE_OUTPUT_DIRECTORY_RELEASE=${{ github.workspace }}/_build_msvc/cmt_deps_prebuilt/lib" \
82+
"-DCMAKE_ARCHIVE_OUTPUT_DIRECTORY_DEBUG=${{ github.workspace }}/_build_msvc/cmt_deps_prebuilt/lib"
83+
cmake --build _build_msvc/cmt_deps --config Release
84+
85+
- name: Configure root (preset + prebuilt deps)
86+
run: |
87+
cmake --preset "${{ matrix.configure_preset }}" \
88+
-D "CMT_SDK_DIR=${{ github.workspace }}/${{ matrix.sdk }}" \
89+
-D CMT_SDK_BUILD_CONFIG=Release \
90+
-D CMT_WITH_DEPENDENCY_SUBDIR=OFF \
91+
-D "CMT_DEPS_PREBUILT_DIR=${{ github.workspace }}/_build_msvc/cmt_deps_prebuilt"
92+
93+
- name: Build cmt-workflow (Release)
94+
run: cmake --build --preset "${{ matrix.build_preset }}"
95+
96+
- name: Upload plugin output
97+
uses: actions/upload-artifact@v4
98+
with:
99+
name: build-${{ runner.os }}-${{ matrix.sdk }}
100+
path: _build_msvc/${{ matrix.sdk }}/bin/Release/plugins/mmdtool/
101+
retention-days: 7
102+
if-no-files-found: error

.github/workflows/msbuild.yml

Lines changed: 0 additions & 40 deletions
This file was deleted.

.github/workflows/package.yml

Lines changed: 171 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,171 @@
1+
# Tag release: reusable Build (cmt-workflow artifacts) → Inno Setup (Windows) → zip (macOS) → GitHub Release.
2+
# Local packaging: cmake --preset package-windows && cmake --build --preset inno-installer (see DEVELOPMENT.md, CMakeUserPresets.json).
3+
4+
name: Package
5+
6+
on:
7+
push:
8+
tags:
9+
- 'v*'
10+
11+
permissions:
12+
contents: write
13+
14+
concurrency:
15+
group: package-${{ github.ref }}
16+
cancel-in-progress: true
17+
18+
jobs:
19+
build:
20+
name: Build (reusable)
21+
uses: ./.github/workflows/build.yml
22+
secrets: inherit
23+
with:
24+
ref: ${{ github.ref }}
25+
26+
package-windows:
27+
needs: build
28+
runs-on: windows-latest
29+
defaults:
30+
run:
31+
shell: bash
32+
steps:
33+
- name: Checkout (resources for installer)
34+
uses: actions/checkout@v4
35+
with:
36+
ref: ${{ github.ref }}
37+
submodules: recursive
38+
39+
- name: Download Windows build artifacts
40+
uses: actions/download-artifact@v4
41+
with:
42+
pattern: build-Windows-*
43+
path: ${{ github.workspace }}/_dl
44+
merge-multiple: false
45+
46+
- name: Layout _build_msvc for installer_script.iss
47+
run: |
48+
set -euo pipefail
49+
for sdk in sdk_r20 sdk_r21 sdk_r23 sdk_r25 sdk_2023 sdk_2024 sdk_2025 sdk_2026; do
50+
mkdir -p "_build_msvc/${sdk}/bin/Release/plugins/mmdtool"
51+
src="_dl/build-Windows-${sdk}"
52+
if [ -d "$src" ]; then
53+
cp -R "$src"/* "_build_msvc/${sdk}/bin/Release/plugins/mmdtool/"
54+
else
55+
echo "Missing artifact: $src" >&2
56+
exit 1
57+
fi
58+
done
59+
60+
- name: Install Inno Setup
61+
run: choco install innosetup -y
62+
63+
- name: Compute version from tag
64+
id: ver
65+
shell: bash
66+
run: |
67+
V="${GITHUB_REF_NAME#v}"
68+
echo "version=$V" >> "$GITHUB_OUTPUT"
69+
70+
- name: Run ISCC
71+
shell: bash
72+
run: |
73+
set -euo pipefail
74+
ISCC=""
75+
for p in "/c/Program Files/Inno Setup 6/ISCC.exe" "/c/Program Files (x86)/Inno Setup 6/ISCC.exe"; do
76+
if [ -f "$p" ]; then ISCC="$p"; break; fi
77+
done
78+
if [ -z "$ISCC" ]; then echo "ISCC.exe not found" >&2; exit 1; fi
79+
"$ISCC" \
80+
/DPluginVersion="${{ steps.ver.outputs.version }}" \
81+
/DSdkBuildDir=_build_msvc \
82+
/DSdkBinConfig=Release \
83+
"${{ github.workspace }}/setup/Common/installer_script.iss"
84+
85+
- name: Upload installer artifact
86+
uses: actions/upload-artifact@v4
87+
with:
88+
name: windows-installer
89+
path: setup/Common/Output/*.exe
90+
if-no-files-found: error
91+
92+
package-macos:
93+
needs: build
94+
runs-on: macos-latest
95+
defaults:
96+
run:
97+
shell: bash
98+
steps:
99+
- name: Checkout (res/)
100+
uses: actions/checkout@v4
101+
with:
102+
ref: ${{ github.ref }}
103+
submodules: recursive
104+
105+
- name: Download macOS build artifacts
106+
uses: actions/download-artifact@v4
107+
with:
108+
pattern: build-macOS-*
109+
path: ${{ github.workspace }}/_dl
110+
merge-multiple: false
111+
112+
- name: Zip per-SDK plugin + matching res
113+
run: |
114+
set -euo pipefail
115+
mkdir -p dist
116+
res_for_sdk() {
117+
case "$1" in
118+
sdk_r20|sdk_r21|sdk_r23) echo "R20-S24" ;;
119+
*) echo "S24_up" ;;
120+
esac
121+
}
122+
for sdk in sdk_r20 sdk_r21 sdk_r23 sdk_r25 sdk_2023 sdk_2024 sdk_2025 sdk_2026; do
123+
src="_dl/build-macOS-${sdk}"
124+
if [ ! -d "$src" ]; then echo "Missing $src" >&2; exit 1; fi
125+
res_dir="res/$(res_for_sdk "$sdk")"
126+
rm -rf "pkg/${sdk}"
127+
mkdir -p "pkg/${sdk}/mmdtool"
128+
cp -R "$src"/* "pkg/${sdk}/mmdtool/"
129+
cp -R "$res_dir" "pkg/${sdk}/mmdtool/res"
130+
(cd "pkg/${sdk}" && zip -r "${{ github.workspace }}/dist/MMD_Tool_${sdk}_macOS.zip" mmdtool)
131+
done
132+
133+
- name: Upload macOS zip artifacts
134+
uses: actions/upload-artifact@v4
135+
with:
136+
name: macos-zips
137+
path: dist/*.zip
138+
if-no-files-found: error
139+
140+
release:
141+
needs: [package-windows, package-macos]
142+
runs-on: ubuntu-latest
143+
steps:
144+
- name: Download installer
145+
uses: actions/download-artifact@v4
146+
with:
147+
name: windows-installer
148+
path: ${{ github.workspace }}/assets
149+
150+
- name: Download macOS zips
151+
uses: actions/download-artifact@v4
152+
with:
153+
name: macos-zips
154+
path: ${{ github.workspace }}/assets
155+
156+
- name: Create GitHub Release
157+
uses: softprops/action-gh-release@v2
158+
with:
159+
tag_name: ${{ github.ref_name }}
160+
name: ${{ github.ref_name }}
161+
body: |
162+
## Changelog
163+
164+
_Add release notes here._
165+
166+
Built from commit `${{ github.sha }}`.
167+
files: |
168+
assets/*.exe
169+
assets/*.zip
170+
env:
171+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
schema: spec-driven
2+
created: 2026-03-20

0 commit comments

Comments
 (0)