馃悰 Fix LRU cache borrow issue - use peek() instead of get() #46
Workflow file for this run
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 Release | |
| on: | |
| workflow_dispatch: | |
| push: | |
| tags: | |
| - 'v*' | |
| env: | |
| CARGO_TERM_COLOR: always | |
| permissions: | |
| contents: write | |
| jobs: | |
| build-macos: | |
| name: Build macOS | |
| runs-on: macos-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Setup Rust | |
| uses: dtolnay/rust-toolchain@stable | |
| - name: Extract version | |
| id: version | |
| run: | | |
| if [[ "${{ github.ref }}" == refs/tags/* ]]; then | |
| VERSION="${GITHUB_REF_NAME#v}" | |
| else | |
| VERSION=$(grep '^version' Cargo.toml | head -1 | sed 's/.*"\(.*\)".*/\1/') | |
| fi | |
| echo "version=$VERSION" >> $GITHUB_OUTPUT | |
| echo "Version: $VERSION" | |
| - name: Cache cargo dependencies | |
| uses: actions/cache@v4 | |
| with: | |
| path: | | |
| ~/.cargo/bin/ | |
| ~/.cargo/registry/index/ | |
| ~/.cargo/registry/cache/ | |
| ~/.cargo/git/db/ | |
| target/ | |
| key: ${{ runner.os }}-cargo-${{ steps.version.outputs.version }} | |
| - name: Build release | |
| run: cargo build --release | |
| - name: Create DMG | |
| env: | |
| VERSION: ${{ steps.version.outputs.version }} | |
| run: | | |
| # Create app bundle structure | |
| mkdir -p Waves.app/Contents/MacOS | |
| mkdir -p Waves.app/Contents/Resources | |
| # Copy binary | |
| cp target/release/waves Waves.app/Contents/MacOS/waves | |
| chmod +x Waves.app/Contents/MacOS/waves | |
| # Copy launcher script | |
| cp waves-launcher.sh Waves.app/Contents/MacOS/waves-launcher | |
| chmod +x Waves.app/Contents/MacOS/waves-launcher | |
| # Copy logo | |
| cp assets/waves_logo.png Waves.app/Contents/Resources/ | |
| # Create Info.plist | |
| cat > Waves.app/Contents/Info.plist << EOF | |
| <?xml version="1.0" encoding="UTF-8"?> | |
| <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | |
| <plist version="1.0"> | |
| <dict> | |
| <key>CFBundleExecutable</key> | |
| <string>waves-launcher</string> | |
| <key>CFBundleIdentifier</key> | |
| <string>com.saravenpi.waves</string> | |
| <key>CFBundleName</key> | |
| <string>Waves</string> | |
| <key>CFBundleVersion</key> | |
| <string>${VERSION}</string> | |
| <key>CFBundleShortVersionString</key> | |
| <string>${VERSION}</string> | |
| <key>CFBundlePackageType</key> | |
| <string>APPL</string> | |
| <key>CFBundleIconFile</key> | |
| <string>waves_logo</string> | |
| <key>CFBundleDocumentTypes</key> | |
| <array> | |
| <dict> | |
| <key>CFBundleTypeName</key> | |
| <string>Audio File</string> | |
| <key>CFBundleTypeRole</key> | |
| <string>Viewer</string> | |
| <key>LSItemContentTypes</key> | |
| <array> | |
| <string>public.mp3</string> | |
| <string>public.audio</string> | |
| <string>com.microsoft.waveform-audio</string> | |
| </array> | |
| </dict> | |
| <dict> | |
| <key>CFBundleTypeName</key> | |
| <string>Folder</string> | |
| <key>CFBundleTypeRole</key> | |
| <string>Viewer</string> | |
| <key>LSItemContentTypes</key> | |
| <array> | |
| <string>public.folder</string> | |
| </array> | |
| </dict> | |
| </array> | |
| <key>LSMinimumSystemVersion</key> | |
| <string>10.13</string> | |
| </dict> | |
| </plist> | |
| EOF | |
| # Ad-hoc code sign the app bundle (allows running without Apple Developer certificate) | |
| codesign --deep --force --sign - Waves.app | |
| # Remove extended attributes (quarantine flags) | |
| xattr -cr Waves.app | |
| # Install create-dmg | |
| brew install create-dmg | |
| # Create DMG using create-dmg | |
| mkdir -p installers | |
| create-dmg \ | |
| --volname "Waves" \ | |
| --volicon "assets/waves_logo.png" \ | |
| --window-pos 200 120 \ | |
| --window-size 800 400 \ | |
| --icon-size 100 \ | |
| --icon "Waves.app" 200 190 \ | |
| --hide-extension "Waves.app" \ | |
| --app-drop-link 600 185 \ | |
| --background "assets/waves_logo.png" \ | |
| "installers/waves-macos.dmg" \ | |
| "Waves.app" | |
| # Create tar.gz for self-update (DMG doesn't work with self_update library) | |
| mkdir -p installers/macos-update | |
| cp target/release/waves installers/macos-update/ | |
| cd installers | |
| tar -czf "waves-${VERSION}-macos.tar.gz" -C macos-update waves | |
| # Also keep the versionless one for backward compatibility | |
| cp "waves-${VERSION}-macos.tar.gz" waves-macos.tar.gz | |
| - name: Upload macOS artifacts | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: waves-macos | |
| path: | | |
| installers/waves-macos.dmg | |
| installers/waves-*-macos.tar.gz | |
| build-linux: | |
| name: Build Linux | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Setup Rust | |
| uses: dtolnay/rust-toolchain@stable | |
| - name: Install dependencies | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y libasound2-dev pkg-config libxcb-render0-dev libxcb-shape0-dev libxcb-xfixes0-dev libxkbcommon-dev libssl-dev | |
| - name: Extract version | |
| id: version | |
| run: | | |
| if [[ "${{ github.ref }}" == refs/tags/* ]]; then | |
| VERSION="${GITHUB_REF_NAME#v}" | |
| else | |
| VERSION=$(grep '^version' Cargo.toml | head -1 | sed 's/.*"\(.*\)".*/\1/') | |
| fi | |
| echo "version=$VERSION" >> $GITHUB_OUTPUT | |
| echo "Version: $VERSION" | |
| - name: Cache cargo dependencies | |
| uses: actions/cache@v4 | |
| with: | |
| path: | | |
| ~/.cargo/bin/ | |
| ~/.cargo/registry/index/ | |
| ~/.cargo/registry/cache/ | |
| ~/.cargo/git/db/ | |
| target/ | |
| key: ${{ runner.os }}-cargo-${{ steps.version.outputs.version }} | |
| - name: Build release | |
| run: cargo build --release | |
| - name: Create tar.gz package | |
| env: | |
| VERSION: ${{ steps.version.outputs.version }} | |
| run: | | |
| mkdir -p installers/linux-package | |
| cp target/release/waves installers/linux-package/ | |
| cp assets/waves_logo.png installers/linux-package/ | |
| cp install-linux.sh installers/linux-package/ | |
| cat > installers/linux-package/README.txt << 'EOF' | |
| WAVES Music Player - Linux Installation | |
| To install: | |
| 1. Run: chmod +x install-linux.sh | |
| 2. Run: ./install-linux.sh | |
| Or manually: | |
| 1. Copy 'waves' to ~/.local/bin/ | |
| 2. Make it executable: chmod +x ~/.local/bin/waves | |
| 3. Run: waves | |
| EOF | |
| cd installers | |
| tar -czf waves-linux-x86_64.tar.gz linux-package | |
| # Create separate update archive with binary at root (for self_update) | |
| mkdir -p linux-update | |
| cp ../target/release/waves linux-update/ | |
| tar -czf "waves-${VERSION}-x86_64-unknown-linux-gnu.tar.gz" -C linux-update waves | |
| # Also keep the versionless one for backward compatibility | |
| cp "waves-${VERSION}-x86_64-unknown-linux-gnu.tar.gz" waves-x86_64-unknown-linux-gnu.tar.gz | |
| - name: Upload Linux artifacts | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: waves-linux | |
| path: | | |
| installers/waves-linux-x86_64.tar.gz | |
| installers/waves-*-x86_64-unknown-linux-gnu.tar.gz | |
| installers/waves-x86_64-unknown-linux-gnu.tar.gz | |
| build-windows: | |
| name: Build Windows | |
| runs-on: windows-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Setup Rust | |
| uses: dtolnay/rust-toolchain@stable | |
| - name: Extract version | |
| id: version | |
| shell: pwsh | |
| run: | | |
| if ("${{ github.ref }}" -like "refs/tags/*") { | |
| $VERSION = "${{ github.ref_name }}".TrimStart("v") | |
| } else { | |
| $VERSION = (Get-Content Cargo.toml | Select-String '^version' | Select-Object -First 1) -replace '.*"(.*)".*', '$1' | |
| } | |
| echo "version=$VERSION" >> $env:GITHUB_OUTPUT | |
| echo "Version: $VERSION" | |
| - name: Cache cargo dependencies | |
| uses: actions/cache@v4 | |
| with: | |
| path: | | |
| ~/.cargo/bin/ | |
| ~/.cargo/registry/index/ | |
| ~/.cargo/registry/cache/ | |
| ~/.cargo/git/db/ | |
| target/ | |
| key: ${{ runner.os }}-cargo-${{ steps.version.outputs.version }} | |
| - name: Build release | |
| run: cargo build --release | |
| - name: Create Windows package | |
| shell: pwsh | |
| env: | |
| VERSION: ${{ steps.version.outputs.version }} | |
| run: | | |
| New-Item -ItemType Directory -Force -Path installers/windows-package | |
| Copy-Item target/release/waves.exe installers/windows-package/ | |
| Copy-Item assets/waves_logo.png installers/windows-package/ | |
| Copy-Item install-windows.ps1 installers/windows-package/ | |
| @" | |
| WAVES Music Player - Windows Installation | |
| To install: | |
| 1. Right-click on install-windows.ps1 | |
| 2. Select 'Run with PowerShell' | |
| Or manually: | |
| 1. Copy waves.exe to a directory of your choice | |
| 2. Add that directory to your PATH | |
| 3. Run: waves.exe | |
| "@ | Out-File -FilePath installers/windows-package/README.txt -Encoding ASCII | |
| Compress-Archive -Path installers/windows-package/* -DestinationPath installers/waves-windows-x86_64.zip -Force | |
| # Create separate update archive with binary at root (for self_update) | |
| New-Item -ItemType Directory -Force -Path installers/windows-update | |
| Copy-Item target/release/waves.exe installers/windows-update/ | |
| Compress-Archive -Path installers/windows-update/waves.exe -DestinationPath "installers/waves-$env:VERSION-x86_64-pc-windows-msvc.zip" -Force | |
| # Also keep the versionless one for backward compatibility | |
| Copy-Item "installers/waves-$env:VERSION-x86_64-pc-windows-msvc.zip" -Destination "installers/waves-x86_64-pc-windows-msvc.zip" | |
| - name: Upload Windows artifacts | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: waves-windows | |
| path: | | |
| installers/waves-windows-x86_64.zip | |
| installers/waves-*-x86_64-pc-windows-msvc.zip | |
| installers/waves-x86_64-pc-windows-msvc.zip | |
| create-release: | |
| name: Create Release | |
| needs: [build-macos, build-linux, build-windows] | |
| runs-on: ubuntu-latest | |
| if: startsWith(github.ref, 'refs/tags/') | |
| steps: | |
| - name: Download all artifacts | |
| uses: actions/download-artifact@v4 | |
| with: | |
| path: artifacts | |
| - name: Create Release | |
| uses: softprops/action-gh-release@v1 | |
| with: | |
| files: | | |
| artifacts/waves-macos/waves-macos.dmg | |
| artifacts/waves-macos/waves-*-macos.tar.gz | |
| artifacts/waves-linux/waves-linux-x86_64.tar.gz | |
| artifacts/waves-linux/waves-*-x86_64-unknown-linux-gnu.tar.gz | |
| artifacts/waves-linux/waves-x86_64-unknown-linux-gnu.tar.gz | |
| artifacts/waves-windows/waves-windows-x86_64.zip | |
| artifacts/waves-windows/waves-*-x86_64-pc-windows-msvc.zip | |
| artifacts/waves-windows/waves-x86_64-pc-windows-msvc.zip | |
| draft: false | |
| prerelease: false | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |