Эх сурвалжийг харах

feat(ci): add release artifact preparation and upload for all platforms

沉默の金 5 сар өмнө
parent
commit
028a012585
1 өөрчлөгдсөн 114 нэмэгдсэн , 32 устгасан
  1. 114 32
      .github/workflows/build.yml

+ 114 - 32
.github/workflows/build.yml

@@ -318,6 +318,59 @@ jobs:
             build/mel_band_roformer-cli*
             build/Release/
           retention-days: 7
+      
+      # ----- Prepare Release Artifact -----
+      - name: Prepare Release Artifact (Unix)
+        if: runner.os != 'Windows'
+        shell: bash
+        run: |
+          # Create release directory
+          mkdir -p release/mel-band-roformer
+          
+          # Find and copy CLI executable
+          CLI_PATH=$(find build -name "mel_band_roformer-cli" -type f | head -n 1)
+          if [[ -n "$CLI_PATH" ]]; then
+            cp "$CLI_PATH" release/mel-band-roformer/
+            chmod +x release/mel-band-roformer/mel_band_roformer-cli
+          fi
+          
+          # Copy shared libraries if exist
+          find build -name "*.so*" -o -name "*.dylib" | while read lib; do
+            cp "$lib" release/mel-band-roformer/ 2>/dev/null || true
+          done
+          
+          # List contents
+          echo "Release artifact contents:"
+          ls -lh release/mel-band-roformer/
+      
+      - name: Prepare Release Artifact (Windows)
+        if: runner.os == 'Windows'
+        shell: pwsh
+        run: |
+          # Create release directory
+          New-Item -ItemType Directory -Force -Path "release\mel-band-roformer"
+          
+          # Find and copy CLI executable
+          $CliPath = Get-ChildItem -Path build -Filter "mel_band_roformer-cli.exe" -Recurse -File | Select-Object -First 1
+          if ($CliPath) {
+            Copy-Item $CliPath.FullName "release\mel-band-roformer\"
+          }
+          
+          # Copy DLL files
+          Get-ChildItem -Path build -Filter "*.dll" -Recurse -File | ForEach-Object {
+            Copy-Item $_.FullName "release\mel-band-roformer\" -ErrorAction SilentlyContinue
+          }
+          
+          # List contents
+          Write-Host "Release artifact contents:"
+          Get-ChildItem "release\mel-band-roformer" | Format-Table Name, Length
+      
+      - name: Upload Release Artifact
+        uses: actions/upload-artifact@v4
+        with:
+          name: release-${{ matrix.name }}
+          path: release/mel-band-roformer/
+          retention-days: 30
 
   # ===========================================================================
   # CUDA Build: Linux (Compile Only - No GPU for testing)
@@ -370,6 +423,35 @@ jobs:
             build/lib*/
             build/*.so
           retention-days: 7
+      
+      # ----- Prepare Release Artifact -----
+      - name: Prepare Release Artifact
+        run: |
+          # Create release directory
+          mkdir -p release/mel-band-roformer
+          
+          # Find and copy CLI executable
+          CLI_PATH=$(find build -name "mel_band_roformer-cli" -type f | head -n 1)
+          if [[ -n "$CLI_PATH" ]]; then
+            cp "$CLI_PATH" release/mel-band-roformer/
+            chmod +x release/mel-band-roformer/mel_band_roformer-cli
+          fi
+          
+          # Copy shared libraries
+          find build -name "*.so*" | while read lib; do
+            cp "$lib" release/mel-band-roformer/ 2>/dev/null || true
+          done
+          
+          # List contents
+          echo "Release artifact contents:"
+          ls -lh release/mel-band-roformer/
+      
+      - name: Upload Release Artifact
+        uses: actions/upload-artifact@v4
+        with:
+          name: release-linux-cuda-${{ matrix.cuda_version }}
+          path: release/mel-band-roformer/
+          retention-days: 30
 
   # ===========================================================================
   # CUDA Build: Windows (Compile Only - No GPU for testing)
@@ -393,30 +475,9 @@ jobs:
         run: git clone --depth 1 https://github.com/ggerganov/ggml.git ggml
       
       - name: Install CUDA Toolkit
-        shell: powershell
-        run: |
-          $cuda_ver = "${{ matrix.cuda_version }}"
-          $cuda_url = "https://developer.download.nvidia.com/compute/cuda/${cuda_ver}/network_installers/cuda_${cuda_ver}_windows_network.exe"
-          
-          echo "Downloading CUDA $cuda_ver from $cuda_url"
-          # Use -f to fail on 404 errors
-          curl.exe -f -o cuda_installer.exe -L "$cuda_url"
-          if ($LASTEXITCODE -ne 0) { throw "Download failed for CUDA $cuda_ver" }
-          
-          echo "Installing CUDA..."
-          Start-Process -FilePath .\cuda_installer.exe -ArgumentList "-s nvcc_${cuda_ver} cudart_${cuda_ver} cublas_${cuda_ver} cublas_dev_${cuda_ver} cufft_${cuda_ver} cufft_dev_${cuda_ver}" -Wait -NoNewWindow
-          
-          # Path handling for major.minor
-          $cuda_ver_short = $cuda_ver.Substring(0, $cuda_ver.LastIndexOf('.'))
-          $cuda_path = "C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v${cuda_ver_short}"
-          
-          echo "Verifying installation at $cuda_path"
-          if (!(Test-Path "$cuda_path")) { 
-              throw "CUDA installation directory not found: $cuda_path" 
-          }
-          
-          Add-Content $env:GITHUB_ENV "CUDA_PATH=${cuda_path}"
-          Add-Content $env:GITHUB_PATH "${cuda_path}\bin"
+        uses: Jimver/cuda-toolkit@v0.2.18
+        with:
+          cuda: ${{ matrix.cuda_version }}
         
       - name: Install Ninja
         run: choco install ninja -y
@@ -425,17 +486,9 @@ jobs:
         shell: cmd
         run: |
           call "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\Build\vcvarsall.bat" x64
-          
-          echo Debug: CUDA_PATH is %CUDA_PATH%
-          if not exist "%CUDA_PATH%" (
-             echo ERROR: CUDA_PATH does not exist!
-             exit 1
-          )
-          
           cmake -B build -G "Ninja Multi-Config" ^
             -DGGML_DIR=ggml ^
             -DGGML_CUDA=ON ^
-            -DCUDAToolkit_ROOT="%CUDA_PATH%" ^
             -DCMAKE_CUDA_ARCHITECTURES="75;80;86;89" ^
             -DMBR_BUILD_TESTS=OFF ^
             -DMBR_BUILD_CLI=ON
@@ -450,3 +503,32 @@ jobs:
             build/Release/
             build/*.dll
           retention-days: 7
+      
+      # ----- Prepare Release Artifact -----
+      - name: Prepare Release Artifact
+        shell: pwsh
+        run: |
+          # Create release directory
+          New-Item -ItemType Directory -Force -Path "release\mel-band-roformer"
+          
+          # Find and copy CLI executable
+          $CliPath = Get-ChildItem -Path build -Filter "mel_band_roformer-cli.exe" -Recurse -File | Select-Object -First 1
+          if ($CliPath) {
+            Copy-Item $CliPath.FullName "release\mel-band-roformer\"
+          }
+          
+          # Copy DLL files
+          Get-ChildItem -Path build -Filter "*.dll" -Recurse -File | ForEach-Object {
+            Copy-Item $_.FullName "release\mel-band-roformer\" -ErrorAction SilentlyContinue
+          }
+          
+          # List contents
+          Write-Host "Release artifact contents:"
+          Get-ChildItem "release\mel-band-roformer" | Format-Table Name, Length
+      
+      - name: Upload Release Artifact
+        uses: actions/upload-artifact@v4
+        with:
+          name: release-windows-cuda-${{ matrix.cuda_version }}
+          path: release/mel-band-roformer/
+          retention-days: 30