更新 CI (#446)

This commit is contained in:
刘旭 2022-11-04 18:55:52 +08:00 committed by GitHub
commit 288388c312
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
8 changed files with 33 additions and 123 deletions

View file

@ -2,9 +2,9 @@ name: build
on:
push:
paths: [ 'src/**', 'Magpie.sln', '.github/workflows/build.yml' ]
paths: [ 'Magpie.sln', 'src/**', 'ci/**', '.github/workflows/build.yml' ]
pull_request:
paths: [ 'src/**', 'Magpie.sln', '.github/workflows/build.yml' ]
paths: [ 'Magpie.sln', 'src/**', 'ci/**', '.github/workflows/build.yml' ]
# env:
# Configuration type to build.
@ -35,7 +35,7 @@ jobs:
uses: microsoft/setup-msbuild@v1
- name: Build
run: msbuild /p:Configuration=Release /p:Platform=x64 src/DEPLOY
run: pwsh "ci/build.ps1"
- name: Save hash
id: hash

View file

@ -25,8 +25,6 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Shared", "src\Shared\Shared
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "CONAN_INSTALL", "src\CONAN_INSTALL\CONAN_INSTALL.vcxproj", "{456CCAE4-2C51-4CF2-8D3A-1EFCE8C41A2D}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "DEPLOY", "src\DEPLOY\DEPLOY.vcxproj", "{B7512D05-CC38-4736-9B1F-C3A4A335BFD4}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Effects", "src\Effects\Effects.vcxproj", "{62503530-B84B-4CC2-80B6-3F89618172B7}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Magpie.Core", "src\Magpie.Core\Magpie.Core.vcxproj", "{0E5205AE-DFA9-4CB8-B662-E43CD6512E2A}"
@ -68,10 +66,6 @@ Global
{456CCAE4-2C51-4CF2-8D3A-1EFCE8C41A2D}.Debug|x64.ActiveCfg = Debug|x64
{456CCAE4-2C51-4CF2-8D3A-1EFCE8C41A2D}.Release|ARM64.ActiveCfg = Release|ARM64
{456CCAE4-2C51-4CF2-8D3A-1EFCE8C41A2D}.Release|x64.ActiveCfg = Release|x64
{B7512D05-CC38-4736-9B1F-C3A4A335BFD4}.Debug|ARM64.ActiveCfg = Debug|ARM64
{B7512D05-CC38-4736-9B1F-C3A4A335BFD4}.Debug|x64.ActiveCfg = Debug|x64
{B7512D05-CC38-4736-9B1F-C3A4A335BFD4}.Release|ARM64.ActiveCfg = Release|ARM64
{B7512D05-CC38-4736-9B1F-C3A4A335BFD4}.Release|x64.ActiveCfg = Release|x64
{62503530-B84B-4CC2-80B6-3F89618172B7}.Debug|ARM64.ActiveCfg = Debug|ARM64
{62503530-B84B-4CC2-80B6-3F89618172B7}.Debug|ARM64.Build.0 = Debug|ARM64
{62503530-B84B-4CC2-80B6-3F89618172B7}.Debug|x64.ActiveCfg = Debug|x64

29
ci/build.ps1 Normal file
View file

@ -0,0 +1,29 @@
$ErrorActionPreference = "Stop"
msbuild /p:Configuration=Release`;Platform=x64 src\CONAN_INSTALL
if ($LastExitCode -ne 0) {
throw '编译 CONAN_INSTALL 失败'
}
msbuild /p:Configuration=Release`;Platform=x64`;OutDir=..\..\publish\ src\Effects
if ($LastExitCode -ne 0) {
throw '编译 Effects 失败'
}
msbuild /p:Configuration=Release`;Platform=x64`;OutDir=..\..\publish\ src\Magpie.Core
if ($LastExitCode -ne 0) {
throw '编译 Magpie.Core 失败'
}
msbuild /m /p:Configuration=Release`;Platform=x64`;BuildProjectReferences=false`;OutDir=..\..\publish\ src\Magpie
if($LastExitCode -ne 0) {
throw '编译 Magpie 失败'
}
msbuild /p:Configuration=Release`;Platform=x64`;OutDir=..\..\publish\ src\Updater
if ($LastExitCode -ne 0) {
throw '编译 Updater 失败'
}
Set-Location .\publish\
Remove-Item @("*.pdb", "*.lib", "*.exp", "*.winmd", "*.xml", "*.xbf", "dummy.*", "Microsoft.Web.WebView2.Core.dll")
Remove-Item @("Microsoft.UI.Xaml", "Magpie.UI") -Recurse
Remove-Item *.pri -Exclude resources.pri
COPY-ITEM -Path @("C:\Windows\System32\msvcp140.dll", "C:\Windows\System32\vcruntime140.dll", "C:\Windows\System32\vcruntime140_1.dll")

View file

@ -1,51 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|ARM64">
<Configuration>Debug</Configuration>
<Platform>ARM64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Debug|x64">
<Configuration>Debug</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|ARM64">
<Configuration>Release</Configuration>
<Platform>ARM64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|x64">
<Configuration>Release</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
</ItemGroup>
<PropertyGroup Label="Globals">
<VCProjectVersion>16.0</VCProjectVersion>
<Keyword>Win32Proj</Keyword>
<ProjectGuid>{b7512d05-cc38-4736-9b1f-c3a4a335bfd4}</ProjectGuid>
<RootNamespace>DEPLOY</RootNamespace>
<WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
<OutDir>$(SolutionDir)\bin\$(Platform)\$(Configuration)\</OutDir>
<IntDir>$(SolutionDir)\obj\$(Platform)\$(Configuration)\$(MSBuildProjectName)\</IntDir>
</PropertyGroup>
<PropertyGroup>
<MSBuildWarningsAsMessages>$(MSBuildWarningsAsMessages);MSB8065</MSBuildWarningsAsMessages>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Label="Configuration">
<ConfigurationType>Utility</ConfigurationType>
<PlatformToolset>v143</PlatformToolset>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ItemGroup>
<CustomBuild Include="Deploy.bat">
<Message>Publishing</Message>
<Command>.\Deploy.bat</Command>
<LinkObjects>false</LinkObjects>
<Outputs>Always_Rebuild</Outputs>
</CustomBuild>
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
</Project>

View file

@ -1,6 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<CustomBuild Include="Deploy.bat" />
</ItemGroup>
</Project>

View file

@ -1,57 +0,0 @@
msbuild /p:Configuration=Release /p:Platform=x64 ..\CONAN_INSTALL
IF %ERRORLEVEL% NEQ 0 (
ECHO Error: Failed to build CONAN_INSTALL
EXIT 1
)
msbuild /p:Configuration=Release;Platform=x64;OutDir=..\..\publish\ ..\Effects
IF %ERRORLEVEL% NEQ 0 (
ECHO Error: Failed to build Effects
EXIT 1
)
msbuild /p:Configuration=Release;Platform=x64;OutDir=..\..\publish\ ..\Magpie.Core
IF %ERRORLEVEL% NEQ 0 (
ECHO Error: Failed to build Magpie.Core
EXIT 1
)
msbuild /m /p:Configuration=Release;Platform=x64;BuildProjectReferences=false;OutDir=..\..\publish\ ..\Magpie
IF %ERRORLEVEL% NEQ 0 (
ECHO Error: Failed to build Magpie
EXIT 1
)
msbuild /p:Configuration=Release;Platform=x64;OutDir=..\..\publish\ ..\Updater
IF %ERRORLEVEL% NEQ 0 (
ECHO Error: Failed to build Updater
EXIT 1
)
REM 清理不需要的文件
CD ..\..\publish
DEL *.pdb
DEL *.lib
DEL *.exp
DEL dummy.*
DEL *.winmd
DEL *.xml
DEL *.xbf
DEL Microsoft.Web.WebView2.Core.dll
RD /S /Q Microsoft.UI.Xaml
RD /S /Q Magpie.UI
REM 删除所有 pri 文件,除了 resources.pri
FOR %%f IN ("*.pri") DO IF /i "%%~nf" NEQ "resources" DEL "%%f"
REM 将需要的 VC++ 运行时 Dll 复制到本地
FOR /f %%i in ('where msvcp140.dll') DO SET DLL=%%i
copy /y %DLL%
FOR /f %%i in ('where vcruntime140.dll') DO SET DLL=%%i
copy /y %DLL%
FOR /f %%i in ('where vcruntime140_1.dll') DO SET DLL=%%i
copy /y %DLL%

View file

@ -1,2 +1,3 @@
*.txt
*.dds
*.exe