Build Native #63
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Build Native | |
| on: | |
| workflow_dispatch: | |
| pull_request: | |
| push: | |
| branches: [dsp-opts] | |
| schedule: | |
| - cron: '0 8 * * 2' | |
| env: | |
| PROJECT_NAME: NeuralAmpModeler | |
| jobs: | |
| build: | |
| name: Build-native-plugins | |
| runs-on: ${{ matrix.os }} | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| os: [macos-15, windows-latest] | |
| include: | |
| - os: macos-15 | |
| artifact_name: NeuralAmpModeler-mac | |
| artifact_path: NeuralAmpModeler/build-mac/out | |
| log_name: macos-build-log | |
| log_path: artifacts/macos-build.log | |
| - os: windows-latest | |
| artifact_name: NeuralAmpModelerAVX_Clang | |
| artifact_path: NeuralAmpModeler/build-win/out | |
| log_name: windows-build-log | |
| log_path: artifacts/windows-build.log | |
| steps: | |
| - name: Check out repository | |
| uses: actions/checkout@v6.0.2 | |
| with: | |
| submodules: recursive | |
| - name: Create artifact directory | |
| run: | | |
| mkdir -p artifacts | |
| shell: bash | |
| - name: Select Xcode 16.4 | |
| if: startsWith(matrix.os, 'macos') | |
| uses: maxim-lobanov/setup-xcode@v1 | |
| with: | |
| xcode-version: '16.4' | |
| - name: Show Xcode version | |
| if: startsWith(matrix.os, 'macos') | |
| run: | | |
| xcode-select -p | |
| xcodebuild -version | |
| shell: bash | |
| - name: Get VST3 SDK | |
| run: | | |
| cd iPlug2/Dependencies/IPlug | |
| ./download-iplug-sdks.sh | |
| shell: bash | |
| - name: Get Prebuilt Libs | |
| run: | | |
| cd iPlug2/Dependencies | |
| ./download-prebuilt-libs.sh | |
| shell: bash | |
| - name: Add library browser sources to Xcode project | |
| if: startsWith(matrix.os, 'macos') | |
| run: | | |
| gem install xcodeproj | |
| ruby - <<'RUBY' | |
| require 'xcodeproj' | |
| project_path = 'NeuralAmpModeler/projects/NeuralAmpModeler-macOS.xcodeproj' | |
| project = Xcodeproj::Project.open(project_path) | |
| nam_cpp = project.files.find { |f| f.display_name == 'NeuralAmpModeler.cpp' } | |
| abort('Cannot find NeuralAmpModeler.cpp in Xcode project') unless nam_cpp | |
| source_group = nam_cpp.parent | |
| native_targets = project.targets.select { |t| t.is_a?(Xcodeproj::Project::Object::PBXNativeTarget) } | |
| compile_targets = native_targets.select do |t| | |
| t.source_build_phase && | |
| t.source_build_phase.files.any? { |bf| bf.file_ref == nam_cpp } | |
| end | |
| resource_target_names = %w[APP AU VST3] | |
| resource_targets = native_targets.select { |t| resource_target_names.include?(t.name) } | |
| puts "Group : #{source_group.display_name}" | |
| puts "Compile targets: #{compile_targets.map(&:name).join(', ')}" | |
| puts "Resource targets: #{resource_targets.map(&:name).join(', ')}" | |
| %w[ | |
| ../NAMLibraryManager.cpp | |
| ../NAMLibraryBrowserWindow.cpp | |
| ../NAMLibraryBrowserWindow.mm | |
| ../NAMLibraryBrowserPanel.cpp | |
| ../NAMLibraryTreeView.cpp | |
| ].each do |rel| | |
| name = File.basename(rel) | |
| if project.files.any? { |f| f.display_name == name } | |
| puts " #{name} already present - skipping" | |
| next | |
| end | |
| ref = source_group.new_file(rel) | |
| ref.name = name | |
| compile_targets.each do |t| | |
| t.source_build_phase.add_file_reference(ref) | |
| puts " Added #{name} -> #{t.name}" | |
| end | |
| end | |
| # --- Add image resources only to APP / AU / VST3 --- | |
| img_dir = File.expand_path('../resources/img', project_path) | |
| img_files = Dir.glob(File.join(img_dir, '*')).select do |f| | |
| File.file?(f) && f =~ /\.(png|jpg|jpeg|gif|bmp|icns|svg)$/i | |
| end | |
| if img_files.empty? | |
| puts "No image resources found in #{img_dir}" | |
| else | |
| main_group = project.main_group | |
| resources_group = main_group['Resources'] || main_group.new_group('Resources') | |
| img_files.each do |img_full_path| | |
| img_filename = File.basename(img_full_path) | |
| rel_path = File.join('../resources/img', img_filename) | |
| ref = project.files.find { |f| f.path == rel_path || f.display_name == img_filename } | |
| unless ref | |
| ref = resources_group.new_file(rel_path) | |
| ref.name = img_filename | |
| puts " Created file reference for resource #{img_filename}" | |
| end | |
| resource_targets.each do |t| | |
| next unless t.respond_to?(:resources_build_phase) && t.resources_build_phase | |
| already_in_resources = t.resources_build_phase.files.any? { |bf| bf.file_ref == ref } | |
| if already_in_resources | |
| puts " Resource #{img_filename} already in #{t.name} - skipping" | |
| next | |
| end | |
| t.resources_build_phase.add_file_reference(ref) | |
| puts " Added resource #{img_filename} to #{t.name}" | |
| end | |
| end | |
| end | |
| project.save | |
| puts 'Xcode project saved.' | |
| RUBY | |
| shell: bash | |
| - name: Patch Xcode project for AU + unsigned APP CI build | |
| if: startsWith(matrix.os, 'macos') | |
| run: | | |
| ruby - <<'RUBY' | |
| require 'xcodeproj' | |
| project_path = 'NeuralAmpModeler/projects/NeuralAmpModeler-macOS.xcodeproj' | |
| project = Xcodeproj::Project.open(project_path) | |
| au = project.targets.find { |t| t.name == 'AU' } | |
| abort('AU target not found') unless au | |
| rez_phase = au.build_phases.find { |bp| bp.isa == 'PBXRezBuildPhase' } | |
| if rez_phase | |
| puts "Found Rez phase on AU target" | |
| rez_phase.files.each do |build_file| | |
| ref = build_file.file_ref | |
| next unless ref | |
| already_in_resources = au.resources_build_phase.files.any? { |f| f.file_ref == ref } | |
| unless already_in_resources | |
| au.resources_build_phase.add_file_reference(ref) | |
| puts " Moved #{ref.display_name} to Copy Bundle Resources" | |
| end | |
| end | |
| au.build_phases.delete(rez_phase) | |
| rez_phase.remove_from_project | |
| puts "Removed obsolete Rez build phase from AU target" | |
| else | |
| puts "No Rez phase found on AU target" | |
| end | |
| app = project.targets.find { |t| t.name == 'APP' } | |
| abort('APP target not found') unless app | |
| app.build_configurations.each do |cfg| | |
| bs = cfg.build_settings | |
| bs['CODE_SIGN_ENTITLEMENTS'] = '' | |
| bs['CODE_SIGNING_ALLOWED'] = 'NO' | |
| bs['CODE_SIGNING_REQUIRED'] = 'NO' | |
| bs['CODE_SIGN_IDENTITY'] = '' | |
| bs['DEVELOPMENT_TEAM'] = '' | |
| bs['PROVISIONING_PROFILE_SPECIFIER'] = '' | |
| bs['CODE_SIGN_STYLE'] = 'Manual' | |
| puts "Patched APP config #{cfg.name}" | |
| end | |
| project.save | |
| puts 'Patched Xcode project for CI.' | |
| RUBY | |
| shell: bash | |
| # ---------- macOS ---------- | |
| - name: Build macOS | |
| if: startsWith(matrix.os, 'macos') | |
| run: | | |
| set -o pipefail | |
| cd ${{ env.PROJECT_NAME }}/scripts | |
| ./makedist-mac.sh full installer 2>&1 | tee "${GITHUB_WORKSPACE}/${{ matrix.log_path }}" | |
| shell: bash | |
| # ---------- Windows (Clang AVX) ---------- | |
| - name: Add msbuild to PATH (Windows) | |
| if: startsWith(matrix.os, 'windows') | |
| uses: microsoft/setup-msbuild@v2 | |
| - name: Build Windows (Clang AVX) | |
| if: startsWith(matrix.os, 'windows') | |
| working-directory: ${{ env.PROJECT_NAME }} | |
| run: | | |
| $logFile = Join-Path $env:GITHUB_WORKSPACE "${{ matrix.log_path }}" | |
| New-Item -ItemType Directory -Force -Path (Split-Path $logFile) | Out-Null | |
| msbuild NeuralAmpModeler.sln ` | |
| /t:NeuralAmpModeler-app`;NeuralAmpModeler-vst3 ` | |
| /p:Configuration=Release-Clang-x64-v3 ` | |
| /p:Platform=x64 ` | |
| /m /nologo /verbosity:minimal 2>&1 | Tee-Object -FilePath $logFile | |
| if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE } | |
| shell: pwsh | |
| - name: Stage and rename Windows artifacts | |
| if: startsWith(matrix.os, 'windows') | |
| working-directory: ${{ env.PROJECT_NAME }} | |
| run: | | |
| New-Item -ItemType Directory -Force -Path "build-win\out" | |
| Copy-Item "build-win\vst3\x64\Release-Clang-x64-v3\NeuralAmpModelerAVX.vst3" ` | |
| "build-win\out\NeuralAmpModelerAVX_Clang.vst3" | |
| Copy-Item "build-win\app\x64\Release-Clang-x64-v3\NeuralAmpModelerAVX.exe" ` | |
| "build-win\out\NeuralAmpModelerAVX_Clang.exe" | |
| shell: pwsh | |
| # ---------- Upload logs ---------- | |
| - name: Upload build log | |
| if: always() | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: ${{ matrix.log_name }} | |
| path: ${{ matrix.log_path }} | |
| if-no-files-found: warn | |
| retention-days: 2 | |
| # ---------- Upload binaries ---------- | |
| - name: Upload artifact | |
| if: success() | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: ${{ matrix.artifact_name }} | |
| path: ${{ matrix.artifact_path }} | |
| if-no-files-found: error |