mirror of
https://github.com/MaaAssistantArknights/MaaAssistantArknights.git
synced 2026-07-01 01:10:34 +08:00
* build: publish remove Visual Studio 17 2022 * build: test vs2026 * fix: 不小心删多了 * fix: nightly 应该也要改 * fix: 这个好像也得改?
190 lines
6.5 KiB
YAML
190 lines
6.5 KiB
YAML
name: Build MAAUnified (Avalonia + MaaCore Runtime)
|
|
|
|
on:
|
|
workflow_dispatch:
|
|
pull_request:
|
|
paths:
|
|
- "src/MAAUnified"
|
|
- "src/MAAUnified/**"
|
|
- "src/MaaCore/**"
|
|
- "src/MaaUtils/**"
|
|
- "include/**"
|
|
- "resource/**"
|
|
- "tools/maadeps-download.py"
|
|
- "CMakeLists.txt"
|
|
- "CMakePresets.json"
|
|
push:
|
|
branches:
|
|
- dev
|
|
paths:
|
|
- "src/MAAUnified"
|
|
- "src/MAAUnified/**"
|
|
- "src/MaaCore/**"
|
|
- "src/MaaUtils/**"
|
|
- "include/**"
|
|
- "resource/**"
|
|
- "tools/maadeps-download.py"
|
|
- "CMakeLists.txt"
|
|
- "CMakePresets.json"
|
|
|
|
jobs:
|
|
meta:
|
|
name: Resolve version tag
|
|
runs-on: ubuntu-latest
|
|
outputs:
|
|
tag: ${{ steps.out.outputs.tag }}
|
|
steps:
|
|
- id: out
|
|
run: |
|
|
if [[ "${GITHUB_REF}" == refs/tags/* ]]; then
|
|
echo "tag=${GITHUB_REF_NAME}" >> "$GITHUB_OUTPUT"
|
|
else
|
|
echo "tag=preview-${GITHUB_SHA::7}" >> "$GITHUB_OUTPUT"
|
|
fi
|
|
|
|
build:
|
|
name: Build ${{ matrix.name }}
|
|
needs: meta
|
|
runs-on: ${{ matrix.os }}
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
include:
|
|
- name: windows-x64
|
|
os: windows-2025-vs2026
|
|
rid: win-x64
|
|
self_contained: true
|
|
cmake_preset: windows-publish-x64
|
|
maadeps_triplet: x64-windows
|
|
- name: linux-x64
|
|
os: ubuntu-latest
|
|
rid: linux-x64
|
|
self_contained: true
|
|
cmake_preset: linux-publish-x64
|
|
maadeps_triplet: x64-linux
|
|
- name: macos-x64
|
|
os: macos-latest
|
|
rid: osx-x64
|
|
self_contained: true
|
|
cmake_preset: macos-publish-x64
|
|
maadeps_triplet: x64-osx
|
|
|
|
steps:
|
|
- uses: actions/checkout@v6
|
|
|
|
- name: Fetch required submodules
|
|
shell: bash
|
|
run: bash ./.github/scripts/sync-optional-submodules.sh --init --depth 1 src/MAAUnified src/MaaUtils
|
|
|
|
- name: Setup .NET
|
|
uses: actions/setup-dotnet@v5
|
|
with:
|
|
dotnet-version: "10.0.x"
|
|
|
|
- name: Setup Python
|
|
uses: actions/setup-python@v6
|
|
with:
|
|
python-version: "3.x"
|
|
|
|
- name: Restore app
|
|
run: dotnet restore src/MAAUnified/App/MAAUnified.App.csproj
|
|
|
|
- name: Restore tests
|
|
if: matrix.name != 'macos-x64'
|
|
run: dotnet restore src/MAAUnified/Tests/MAAUnified.Tests.csproj
|
|
|
|
- name: Run Linux baseline consistency gate
|
|
if: matrix.name == 'linux-x64'
|
|
run: >
|
|
dotnet test src/MAAUnified/Tests/MAAUnified.Tests.csproj -c Release --no-restore --disable-build-servers -m:1
|
|
--results-directory TestResults/${{ matrix.name }}
|
|
--logger "trx;LogFileName=baseline-consistency.trx"
|
|
--filter "FullyQualifiedName~BaselineContractTests|FullyQualifiedName~BaselineCoverageTests|FullyQualifiedName~BaselineRenderSyncTests|FullyQualifiedName~ParityMatrixSyncTests"
|
|
|
|
- name: Run Linux full MAAUnified test gate
|
|
if: matrix.name == 'linux-x64'
|
|
run: >
|
|
dotnet test src/MAAUnified/Tests/MAAUnified.Tests.csproj -c Release --no-restore --disable-build-servers -m:1
|
|
--results-directory TestResults/${{ matrix.name }}
|
|
--logger "trx;LogFileName=full-maaunified-tests.trx"
|
|
|
|
- name: Run Windows platform capability contract gate
|
|
if: matrix.name == 'windows-x64'
|
|
run: >
|
|
dotnet test src/MAAUnified/Tests/MAAUnified.Tests.csproj -c Release --no-restore --disable-build-servers -m:1
|
|
--results-directory TestResults/${{ matrix.name }}
|
|
--logger "trx;LogFileName=platform-capability-contract.trx"
|
|
--filter "FullyQualifiedName~PlatformCapabilityContractTests"
|
|
|
|
- name: Run Windows native capability smoke gate
|
|
if: matrix.name == 'windows-x64'
|
|
run: >
|
|
dotnet test src/MAAUnified/Tests/MAAUnified.Tests.csproj -c Release --no-restore --disable-build-servers -m:1
|
|
--results-directory TestResults/${{ matrix.name }}
|
|
--logger "trx;LogFileName=platform-windows-native-smoke.trx"
|
|
--filter "FullyQualifiedName~PlatformWindowsNativeSmokeTests"
|
|
|
|
- name: Upload test result artifacts on failure
|
|
if: failure() && matrix.name != 'macos-x64'
|
|
uses: actions/upload-artifact@v7
|
|
with:
|
|
name: MAAUnified-TestResults-${{ matrix.name }}
|
|
path: TestResults/${{ matrix.name }}/*.trx
|
|
if-no-files-found: ignore
|
|
|
|
- name: Bootstrap MaaDeps
|
|
run: python tools/maadeps-download.py ${{ matrix.maadeps_triplet }}
|
|
env:
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
- name: Build MaaCore runtime
|
|
run: |
|
|
cmake --preset ${{ matrix.cmake_preset }} -DINSTALL_PYTHON=OFF -DMAA_HASH_VERSION='${{ needs.meta.outputs.tag }}'
|
|
cmake --build --preset ${{ matrix.cmake_preset }}
|
|
cmake --install build --config RelWithDebInfo
|
|
|
|
- name: Publish MAAUnified app
|
|
run: dotnet publish src/MAAUnified/App/MAAUnified.App.csproj -c Release -r ${{ matrix.rid }} --self-contained ${{ matrix.self_contained }} -o publish
|
|
|
|
- name: Merge MaaCore runtime (Windows)
|
|
if: runner.os == 'Windows'
|
|
shell: pwsh
|
|
run: |
|
|
Copy-Item install\* publish\ -Recurse -Force
|
|
if (!(Test-Path "publish\MaaCore.dll")) { throw "MaaCore.dll not found in publish output." }
|
|
if (!(Test-Path "publish\resource")) { throw "resource directory not found in publish output." }
|
|
|
|
- name: Merge MaaCore runtime (Unix)
|
|
if: runner.os != 'Windows'
|
|
shell: bash
|
|
run: |
|
|
cp -a install/. publish/
|
|
if [[ "$RUNNER_OS" == "Linux" ]]; then
|
|
test -f publish/libMaaCore.so
|
|
else
|
|
test -f publish/libMaaCore.dylib
|
|
fi
|
|
test -d publish/resource
|
|
|
|
- name: Package (Windows)
|
|
if: runner.os == 'Windows'
|
|
shell: pwsh
|
|
run: |
|
|
New-Item -ItemType Directory -Path release -Force | Out-Null
|
|
$name = "MAAUnified-${{ needs.meta.outputs.tag }}-${{ matrix.name }}"
|
|
Compress-Archive -Path publish\* -DestinationPath "release\$name.zip"
|
|
|
|
- name: Package (Unix)
|
|
if: runner.os != 'Windows'
|
|
shell: bash
|
|
run: |
|
|
mkdir -p release
|
|
name="MAAUnified-${{ needs.meta.outputs.tag }}-${{ matrix.name }}"
|
|
tar -czf "release/${name}.tar.gz" -C publish .
|
|
|
|
- name: Upload artifact
|
|
uses: actions/upload-artifact@v7
|
|
with:
|
|
name: MAAUnified-${{ matrix.name }}
|
|
path: release/*
|