Skip to content

Build

Build #14

name: Build and Release Windows (Ninja + Clang)
on:
push:
tags:
- 'v*'
branches:
- main # 建议加上这个,方便你在推送分支时直接测试
workflow_dispatch:
jobs:
build:
runs-on: windows-latest
defaults:
run:
shell: bash
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
submodules: recursive
- name: Cache Intel IPP
id: cache-ipp
uses: actions/cache@v4
with:
# 缓存 IPP 的安装路径
path: C:\Program Files (x86)\Intel\oneAPI
# 缓存 Key。如果链接变了,Key 也会变,从而触发重新下载
key: ${{ runner.os }}-intel-ipp-2022.3.0
- name: Download and Install Intel IPP
# 关键:只有在缓存没命中的情况下才执行
if: steps.cache-ipp.outputs.cache-hit != 'true'
shell: pwsh
run: |
$url = "https://registrationcenter-download.intel.com/akdlm/IRC_NAS/1ae68d0c-2b3f-4f39-9f53-774ca23088ec/intel-ipp-2022.3.0.393_offline.exe"
Write-Host "Cache miss. Downloading Intel IPP Installer..."
curl.exe -L $url -o ipp_installer.exe -A "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36"
$fileSize = (Get-Item ipp_installer.exe).Length
if ($fileSize -lt 1000000) {
Write-Error "Download failed: The file is too small. Intel blocked the request."
exit 1
}
Write-Host "Installing..."
# 注意:必须加 --silent 等参数确保无人值守
Start-Process ./ipp_installer.exe -ArgumentList "--silent", "--action", "install", "--accept_eula" -Wait
Remove-Item ./ipp_installer.exe
Write-Host "Installing Intel IPP (Silent)..."
# 2. 执行静默安装
# --silent: 无界面安装
# --action install: 执行安装操作
# --accept_eula: 接受协议
Start-Process ./ipp_installer.exe -ArgumentList "--silent", "--action", "install", "--accept_eula" -Wait
# 3. 清理安装包
Remove-Item ./ipp_installer.exe
- name: Setup Ninja
uses: llvm/actions/install-ninja@main
- name: Set up MSVC Environment
# 必须在 Configure 之前运行,确保 clang-cl 能找到系统头文件
uses: ilammy/msvc-dev-cmd@v1
- name: Configure CMake
shell: pwsh
run: |
# 手动指定 IPP 的 CMake 配置文件路径,确保 CMake 能找到它
$ipp_cmake_dir = "C:/Program Files (x86)/Intel/oneAPI/ipp/latest/lib/cmake/ipp"
cmake -B build -G Ninja `
-DCMAKE_C_COMPILER=clang `
-DCMAKE_CXX_COMPILER=clang `
-DCMAKE_BUILD_TYPE=Release `
-DIPP_DIR="$ipp_cmake_dir" `
-DCI_PLUGIN_BUILD=1 `
-DCMAKE_PREFIX_PATH="C:/Program Files (x86)/Intel/oneAPI"
- name: Build
run: cmake --build build --config Release --parallel
- name: Collect and Zip VST3 Plugins
shell: pwsh
run: |
New-Item -ItemType Directory -Force -Path "./vst3_release"
# 仅从 build 目录下寻找,排除脚本下载的第三方库目录
Get-ChildItem -Path "./build" -Filter "*.vst3" -Recurse | Where-Object { $_.Attributes -match "Directory" } | ForEach-Object {
Write-Host "Found plugin: $($_.FullName)"
Copy-Item -Path $_.FullName -Destination "./vst3_release/" -Recurse
}
if ((Get-ChildItem "./vst3_release/").Count -eq 0) {
Write-Error "No VST3 plugins found! Check your build output."
exit 1
}
Compress-Archive -Path "./vst3_release/*" -DestinationPath "./Plugins_Windows_VST3.zip"
- name: Upload Artifact
uses: actions/upload-artifact@v4
with:
name: windows-vst3-zip
path: Plugins_Windows_VST3.zip
release:
if: startsWith(github.ref, 'refs/tags/')
needs: build
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Download Artifact
uses: actions/download-artifact@v4
with:
name: windows-vst3-zip
- name: Create Release
uses: softprops/action-gh-release@v2
with:
files: Plugins_Windows_VST3.zip
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}