Skip to content

Commit 661756d

Browse files
committed
ci: build MaaFramework from source for dbg tests
1 parent 1c744e7 commit 661756d

1 file changed

Lines changed: 59 additions & 175 deletions

File tree

.github/workflows/test.yml

Lines changed: 59 additions & 175 deletions
Original file line numberDiff line numberDiff line change
@@ -84,66 +84,24 @@ jobs:
8484
- name: Install LLVM
8585
run: choco install llvm -y
8686

87-
- name: Get latest MaaFramework release tag
88-
id: maa-version
89-
shell: bash
87+
- name: Bootstrap MaaDeps
9088
env:
91-
GH_TOKEN: ${{ github.token }}
89+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
9290
run: |
93-
MAA_TAG=$(gh release list --repo MaaXYZ/MaaFramework \
94-
--exclude-drafts \
95-
--limit 1 \
96-
--json tagName \
97-
--jq '.[0].tagName')
98-
echo "tag=$MAA_TAG" >> $GITHUB_OUTPUT
99-
echo "Using MaaFramework $MAA_TAG"
100-
101-
- name: Download MaaFramework SDK from release
102-
shell: pwsh
103-
env:
104-
GH_TOKEN: ${{ github.token }}
91+
cd MaaFramework
92+
python tools/maadeps-download.py ${{ matrix.arch == 'x86_64' && 'x64' || 'arm64' }}-windows
93+
94+
- name: Build MAA
10595
run: |
106-
$tag = "${{ steps.maa-version.outputs.tag }}"
107-
New-Item -ItemType Directory -Force -Path asset, sdk, install | Out-Null
108-
109-
$assetName = gh release view $tag --repo MaaXYZ/MaaFramework --json assets --jq '.assets[].name | select(((ascii_downcase | contains("win")) or (ascii_downcase | contains("windows"))) and ((ascii_downcase | contains("x64")) or (ascii_downcase | contains("x86_64"))))' | Select-Object -First 1
110-
if (-not $assetName) { throw "No windows x64 asset found for $tag" }
111-
112-
gh release download $tag --repo MaaXYZ/MaaFramework --pattern $assetName --dir asset
113-
114-
$file = Get-ChildItem asset -File | Select-Object -First 1
115-
if (-not $file) { throw "Downloaded asset not found" }
116-
117-
if ($file.Extension -eq ".zip") {
118-
Expand-Archive $file.FullName -DestinationPath sdk -Force
119-
} else {
120-
tar -xf $file.FullName -C sdk
121-
}
122-
123-
$root = $null
124-
if ((Test-Path "sdk/include") -or (Test-Path "sdk/lib") -or (Test-Path "sdk/bin")) {
125-
$root = "sdk"
126-
} else {
127-
$candidates = Get-ChildItem sdk -Directory | Where-Object {
128-
(Test-Path (Join-Path $_.FullName "include")) -or
129-
(Test-Path (Join-Path $_.FullName "lib")) -or
130-
(Test-Path (Join-Path $_.FullName "bin"))
131-
}
132-
if ($candidates.Count -eq 1) {
133-
$root = $candidates[0].FullName
134-
} elseif ($candidates.Count -gt 1) {
135-
throw "Multiple SDK root candidates found under sdk/"
136-
} else {
137-
throw "Unable to locate MaaFramework SDK root under sdk/"
138-
}
139-
}
140-
141-
Copy-Item "$root\*" install -Recurse -Force
142-
143-
if (-not (Test-Path "install/include")) { throw "install/include missing after SDK extraction" }
144-
if ((-not (Test-Path "install/lib")) -and (-not (Test-Path "install/bin"))) {
145-
throw "Neither install/lib nor install/bin exists after SDK extraction"
146-
}
96+
cd MaaFramework
97+
cmake --preset "${{ matrix.arch == 'x86_64' && 'MSVC 2022' || 'MSVC 2022 ARM' }}" -DMAADEPS_TRIPLET="maa-${{ matrix.arch == 'x86_64' && 'x64' || 'arm64' }}-windows" -DCMAKE_SYSTEM_VERSION="10.0.26100.0" -DMAA_HASH_VERSION="CI-Build" -DWITH_NODEJS_BINDING=OFF -DWITH_QUICKJS_BINDING=OFF -DBUILD_PICLI=OFF -DWITH_DBG_CONTROLLER=ON -DBUILD_PIPELINE_TESTING=ON -DBUILD_DLOPEN_TESTING=ON
98+
cmake --build build --preset "${{ matrix.arch == 'x86_64' && 'MSVC 2022' || 'MSVC 2022 ARM' }} - Debug" -j 16
99+
100+
- name: Install MAA
101+
shell: bash
102+
run: |
103+
cd MaaFramework
104+
cmake --install build --prefix ../install --config Debug
147105
148106
- name: Download Plugin
149107
uses: robinraju/release-downloader@v1
@@ -224,68 +182,30 @@ jobs:
224182
with:
225183
toolchain: stable
226184

227-
- name: Get latest MaaFramework release tag
228-
id: maa-version
185+
- name: Bootstrap MaaDeps
229186
env:
230-
GH_TOKEN: ${{ github.token }}
187+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
231188
run: |
232-
MAA_TAG=$(gh release list --repo MaaXYZ/MaaFramework \
233-
--exclude-drafts \
234-
--limit 1 \
235-
--json tagName \
236-
--jq '.[0].tagName')
237-
echo "tag=$MAA_TAG" >> $GITHUB_OUTPUT
238-
echo "Using MaaFramework $MAA_TAG"
239-
240-
- name: Download MaaFramework SDK from release
241-
env:
242-
GH_TOKEN: ${{ github.token }}
189+
cd MaaFramework
190+
python3 tools/maadeps-download.py ${{ matrix.arch == 'x86_64' && 'x64' || 'arm64' }}-linux
191+
192+
- name: Build MAA
193+
run: |
194+
cd MaaFramework
195+
cmake --preset 'NinjaMulti Linux ${{ matrix.arch == 'x86_64' && 'x64' || 'arm64' }}' \
196+
-DMAADEPS_TRIPLET='maa-${{ matrix.arch == 'x86_64' && 'x64' || 'arm64' }}-linux' \
197+
-DMAA_HASH_VERSION="CI-Build" \
198+
-DWITH_NODEJS_BINDING=OFF -DWITH_QUICKJS_BINDING=OFF \
199+
-DBUILD_PICLI=OFF \
200+
-DWITH_DBG_CONTROLLER=ON -DBUILD_PIPELINE_TESTING=ON \
201+
-DBUILD_DLOPEN_TESTING=ON
202+
cmake --build build --preset 'NinjaMulti Linux ${{ matrix.arch == 'x86_64' && 'x64' || 'arm64' }} - Debug' -j 16
203+
204+
- name: Install MAA
205+
shell: bash
243206
run: |
244-
TAG="${{ steps.maa-version.outputs.tag }}"
245-
mkdir -p asset sdk install
246-
247-
ASSET_NAME=$(gh release view "$TAG" --repo MaaXYZ/MaaFramework --json assets \
248-
--jq '.assets[].name | select((ascii_downcase | contains("linux")) and ((ascii_downcase | contains("x64")) or (ascii_downcase | contains("x86_64"))))' \
249-
| head -n 1)
250-
251-
test -n "$ASSET_NAME" || (echo "No linux x64 asset found for $TAG" && exit 1)
252-
253-
gh release download "$TAG" --repo MaaXYZ/MaaFramework --pattern "$ASSET_NAME" --dir asset
254-
255-
FILE=$(find asset -type f | head -n 1)
256-
case "$FILE" in
257-
*.zip) unzip -q "$FILE" -d sdk ;;
258-
*.tar.gz|*.tgz) tar -xzf "$FILE" -C sdk ;;
259-
*.tar.xz) tar -xJf "$FILE" -C sdk ;;
260-
*) echo "Unsupported asset: $FILE"; exit 1 ;;
261-
esac
262-
263-
if [ -d sdk/include ] || [ -d sdk/lib ] || [ -d sdk/bin ]; then
264-
ROOT=sdk
265-
else
266-
SDK_ROOTS=()
267-
for candidate in sdk/*; do
268-
[ -d "$candidate" ] || continue
269-
if [ -d "$candidate/include" ] || [ -d "$candidate/lib" ] || [ -d "$candidate/bin" ]; then
270-
SDK_ROOTS+=("$candidate")
271-
fi
272-
done
273-
if [ "${#SDK_ROOTS[@]}" -eq 1 ]; then
274-
ROOT="${SDK_ROOTS[0]}"
275-
elif [ "${#SDK_ROOTS[@]}" -eq 0 ]; then
276-
echo "Unable to locate MaaFramework SDK root under sdk"
277-
find sdk -maxdepth 2 -type d | sort
278-
exit 1
279-
else
280-
echo "Multiple SDK root candidates found under sdk:"
281-
printf '%s\n' "${SDK_ROOTS[@]}"
282-
exit 1
283-
fi
284-
fi
285-
cp -R "$ROOT"/. install/
286-
287-
test -d install/include || (echo "install/include missing after SDK extraction" && exit 1)
288-
test -d install/lib -o -d install/bin || (echo "Neither install/lib nor install/bin exists after SDK extraction" && exit 1)
207+
cd MaaFramework
208+
cmake --install build --prefix ../install --config Debug
289209
290210
- name: Download Plugin
291211
uses: robinraju/release-downloader@v1
@@ -358,68 +278,32 @@ jobs:
358278
toolchain: stable
359279
target: aarch64-apple-darwin
360280

361-
- name: Get latest MaaFramework release tag
362-
id: maa-version
281+
- name: Bootstrap MaaDeps
363282
env:
364-
GH_TOKEN: ${{ github.token }}
283+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
365284
run: |
366-
MAA_TAG=$(gh release list --repo MaaXYZ/MaaFramework \
367-
--exclude-drafts \
368-
--limit 1 \
369-
--json tagName \
370-
--jq '.[0].tagName')
371-
echo "tag=$MAA_TAG" >> $GITHUB_OUTPUT
372-
echo "Using MaaFramework $MAA_TAG"
373-
374-
- name: Download MaaFramework SDK from release
375-
env:
376-
GH_TOKEN: ${{ github.token }}
285+
cd MaaFramework
286+
python3 tools/maadeps-download.py ${{ matrix.arch == 'x86_64' && 'x64' || 'arm64' }}-osx
287+
288+
- name: Build MAA
289+
run: |
290+
cd MaaFramework
291+
cmake --preset 'NinjaMulti' \
292+
-DMAADEPS_TRIPLET='maa-${{ matrix.arch == 'x86_64' && 'x64' || 'arm64' }}-osx' \
293+
-DMAA_HASH_VERSION="CI-Build" \
294+
-DCMAKE_OSX_SYSROOT=macosx \
295+
-DWITH_NODEJS_BINDING=OFF -DWITH_QUICKJS_BINDING=OFF \
296+
-DBUILD_PICLI=OFF \
297+
-DWITH_DBG_CONTROLLER=ON -DBUILD_PIPELINE_TESTING=ON \
298+
-DBUILD_DLOPEN_TESTING=ON \
299+
-DCMAKE_OSX_ARCHITECTURES='${{ matrix.arch == 'x86_64' && 'x86_64' || 'arm64' }}'
300+
cmake --build build --preset 'NinjaMulti - Debug' -j 16
301+
302+
- name: Install MAA
303+
shell: bash
377304
run: |
378-
TAG="${{ steps.maa-version.outputs.tag }}"
379-
mkdir -p asset sdk install
380-
381-
ASSET_NAME=$(gh release view "$TAG" --repo MaaXYZ/MaaFramework --json assets \
382-
--jq '.assets[].name | select(((ascii_downcase | contains("mac")) or (ascii_downcase | contains("osx"))) and ((ascii_downcase | contains("arm64")) or (ascii_downcase | contains("aarch64"))))' \
383-
| head -n 1)
384-
385-
test -n "$ASSET_NAME" || (echo "No macOS arm64 asset found for $TAG" && exit 1)
386-
387-
gh release download "$TAG" --repo MaaXYZ/MaaFramework --pattern "$ASSET_NAME" --dir asset
388-
389-
FILE=$(find asset -type f | head -n 1)
390-
case "$FILE" in
391-
*.zip) unzip -q "$FILE" -d sdk ;;
392-
*.tar.gz|*.tgz) tar -xzf "$FILE" -C sdk ;;
393-
*.tar.xz) tar -xJf "$FILE" -C sdk ;;
394-
*) echo "Unsupported asset: $FILE"; exit 1 ;;
395-
esac
396-
397-
if [ -d sdk/include ] || [ -d sdk/lib ] || [ -d sdk/bin ]; then
398-
ROOT=sdk
399-
else
400-
SDK_ROOTS=()
401-
for candidate in sdk/*; do
402-
[ -d "$candidate" ] || continue
403-
if [ -d "$candidate/include" ] || [ -d "$candidate/lib" ] || [ -d "$candidate/bin" ]; then
404-
SDK_ROOTS+=("$candidate")
405-
fi
406-
done
407-
if [ "${#SDK_ROOTS[@]}" -eq 1 ]; then
408-
ROOT="${SDK_ROOTS[0]}"
409-
elif [ "${#SDK_ROOTS[@]}" -eq 0 ]; then
410-
echo "Unable to locate MaaFramework SDK root under sdk"
411-
find sdk -maxdepth 2 -type d | sort
412-
exit 1
413-
else
414-
echo "Multiple SDK root candidates found under sdk:"
415-
printf '%s\n' "${SDK_ROOTS[@]}"
416-
exit 1
417-
fi
418-
fi
419-
cp -R "$ROOT"/. install/
420-
421-
test -d install/include || (echo "install/include missing after SDK extraction" && exit 1)
422-
test -d install/lib -o -d install/bin || (echo "Neither install/lib nor install/bin exists after SDK extraction" && exit 1)
305+
cd MaaFramework
306+
cmake --install build --prefix ../install --config Debug
423307
424308
- name: Download Plugin
425309
uses: robinraju/release-downloader@v1

0 commit comments

Comments
 (0)