|
| 1 | +# .github/workflows/build.yml |
| 2 | +# Standard CMake-based build workflow |
| 3 | +name: Build |
| 4 | + |
| 5 | +on: |
| 6 | + push: |
| 7 | + branches: [ master, main ] |
| 8 | + pull_request: |
| 9 | + branches: [ master, main ] |
| 10 | + |
| 11 | +jobs: |
| 12 | + build: |
| 13 | + strategy: |
| 14 | + fail-fast: false # Don't cancel other jobs if one fails |
| 15 | + matrix: |
| 16 | + config: |
| 17 | + - name: "Windows x64" |
| 18 | + os: windows-latest |
| 19 | + cmake_generator: "Visual Studio 17 2022" |
| 20 | + cmake_arch: -A x64 |
| 21 | + artifact_name: windows-x64 |
| 22 | + |
| 23 | + - name: "Linux x64" |
| 24 | + os: ubuntu-latest |
| 25 | + cmake_generator: "Unix Makefiles" |
| 26 | + cmake_arch: "" |
| 27 | + artifact_name: linux-x64 |
| 28 | + |
| 29 | + - name: "macOS Universal" |
| 30 | + os: macos-latest |
| 31 | + cmake_generator: "Unix Makefiles" |
| 32 | + cmake_arch: -DCMAKE_OSX_ARCHITECTURES="x86_64;arm64" |
| 33 | + artifact_name: macos-universal |
| 34 | + |
| 35 | + runs-on: ${{ matrix.config.os }} |
| 36 | + name: ${{ matrix.config.name }} |
| 37 | + |
| 38 | + steps: |
| 39 | + - name: Checkout |
| 40 | + uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 |
| 41 | + with: |
| 42 | + submodules: recursive |
| 43 | + |
| 44 | + - name: Cache CMake |
| 45 | + uses: actions/cache@2cdf405574d6ef1f33a1d12acccd3ae82f47b3f2 |
| 46 | + with: |
| 47 | + path: | |
| 48 | + ~/.cmake |
| 49 | + build/_deps |
| 50 | + key: ${{ runner.os }}-cmake-${{ hashFiles('**/CMakeLists.txt') }} |
| 51 | + restore-keys: | |
| 52 | + ${{ runner.os }}-cmake- |
| 53 | + |
| 54 | + - name: Setup CMake |
| 55 | + uses: lukka/get-cmake@5c7ccde04b4c5e57fc14c1fb1c94877f0b939172 |
| 56 | + |
| 57 | + - name: Cache APT packages (Linux) |
| 58 | + if: runner.os == 'Linux' |
| 59 | + uses: actions/cache@2cdf405574d6ef1f33a1d12acccd3ae82f47b3f2 |
| 60 | + with: |
| 61 | + path: /var/cache/apt |
| 62 | + key: ${{ runner.os }}-apt-${{ hashFiles('.github/workflows/build.yml') }} |
| 63 | + restore-keys: | |
| 64 | + ${{ runner.os }}-apt- |
| 65 | + |
| 66 | + - name: Install Dependencies (Linux) |
| 67 | + if: runner.os == 'Linux' |
| 68 | + run: | |
| 69 | + sudo apt-get update |
| 70 | + sudo apt-get install -y \ |
| 71 | + build-essential \ |
| 72 | + libasound2-dev \ |
| 73 | + libpulse-dev \ |
| 74 | + libjack-jackd2-dev \ |
| 75 | + portaudio19-dev \ |
| 76 | + libsndfile1-dev \ |
| 77 | + pkg-config |
| 78 | +
|
| 79 | + - name: Cache Homebrew (macOS) |
| 80 | + if: runner.os == 'macOS' |
| 81 | + uses: actions/cache@2cdf405574d6ef1f33a1d12acccd3ae82f47b3f2 |
| 82 | + with: |
| 83 | + path: | |
| 84 | + ~/Library/Caches/Homebrew |
| 85 | + /opt/homebrew/var/homebrew/locks |
| 86 | + key: ${{ runner.os }}-brew-${{ hashFiles('.github/workflows/build.yml') }} |
| 87 | + restore-keys: | |
| 88 | + ${{ runner.os }}-brew- |
| 89 | + |
| 90 | + - name: Install Dependencies (macOS) |
| 91 | + if: runner.os == 'macOS' |
| 92 | + run: | |
| 93 | + brew install portaudio libsndfile pkg-config |
| 94 | +
|
| 95 | + - name: Setup MSVC (Windows) |
| 96 | + if: runner.os == 'Windows' |
| 97 | + uses: microsoft/setup-msbuild@6fb02220983dee41ce7ae257b6f4d8f9bf5ed4ce |
| 98 | + |
| 99 | + - name: Check Repository Structure |
| 100 | + shell: bash |
| 101 | + run: | |
| 102 | + echo "=== Repository Contents ===" |
| 103 | + find . -maxdepth 2 -type f | head -20 |
| 104 | + echo "" |
| 105 | + echo "=== Looking for CMakeLists.txt ===" |
| 106 | + find . -name "CMakeLists.txt" |
| 107 | + echo "" |
| 108 | + echo "=== Looking for source files ===" |
| 109 | + find . -name "*.cpp" -o -name "*.h" -o -name "*.c" | head -10 |
| 110 | +
|
| 111 | + - name: Configure CMake |
| 112 | + shell: bash |
| 113 | + run: | |
| 114 | + cmake -B build \ |
| 115 | + -DCMAKE_BUILD_TYPE=Release \ |
| 116 | + -G "${{ matrix.config.cmake_generator }}" \ |
| 117 | + ${{ matrix.config.cmake_arch }} |
| 118 | +
|
| 119 | + - name: Build |
| 120 | + shell: bash |
| 121 | + run: | |
| 122 | + cmake --build build --config Release --parallel |
| 123 | +
|
| 124 | + - name: List Build Output |
| 125 | + shell: bash |
| 126 | + run: | |
| 127 | + echo "=== Build Directory Contents ===" |
| 128 | + find build -type f | head -20 |
| 129 | + echo "" |
| 130 | + echo "=== Looking for Executables ===" |
| 131 | + find build -name "*.exe" -o \( -type f -executable \) | head -10 |
| 132 | +
|
| 133 | + - name: Run Tests (if available) |
| 134 | + shell: bash |
| 135 | + working-directory: build |
| 136 | + run: | |
| 137 | + if [ -f "CTestTestfile.cmake" ] || [ -f "test/CTestTestfile.cmake" ]; then |
| 138 | + ctest --output-on-failure -C Release |
| 139 | + else |
| 140 | + echo "No tests found - skipping" |
| 141 | + fi |
| 142 | + continue-on-error: false |
| 143 | + |
| 144 | + - name: Package Artifacts |
| 145 | + shell: bash |
| 146 | + run: | |
| 147 | + # Create output directory |
| 148 | + mkdir -p dist/audio-level-fixer-${{ matrix.config.artifact_name }} |
| 149 | + cd dist/audio-level-fixer-${{ matrix.config.artifact_name }} |
| 150 | + |
| 151 | + # Copy executables |
| 152 | + if [ "${{ runner.os }}" == "Windows" ]; then |
| 153 | + find ../../build -name "*.exe" -exec cp {} . \; 2>/dev/null || true |
| 154 | + find ../../build -name "*.dll" -exec cp {} . \; 2>/dev/null || true |
| 155 | + else |
| 156 | + find ../../build -type f -executable -exec cp {} . \; 2>/dev/null || true |
| 157 | + fi |
| 158 | + |
| 159 | + # Copy preset files and documentation |
| 160 | + cp ../../*.preset . 2>/dev/null || true |
| 161 | + cp ../../README.md . 2>/dev/null || true |
| 162 | + cp ../../LICENSE* . |
| 163 | + |
| 164 | + # Show what we packaged |
| 165 | + echo "=== Packaged Files ===" |
| 166 | + ls -la |
| 167 | + |
| 168 | + # Create archive |
| 169 | + cd .. |
| 170 | + if [ "${{ runner.os }}" == "Windows" ]; then |
| 171 | + powershell -Command "Compress-Archive -Path 'audio-level-fixer-${{ matrix.config.artifact_name }}/*' -DestinationPath 'audio-level-fixer-${{ matrix.config.artifact_name }}.zip'" |
| 172 | + else |
| 173 | + tar -czf audio-level-fixer-${{ matrix.config.artifact_name }}.tar.gz audio-level-fixer-${{ matrix.config.artifact_name }}/ |
| 174 | + fi |
| 175 | +
|
| 176 | + - name: Upload Artifacts |
| 177 | + uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 |
| 178 | + with: |
| 179 | + name: audio-level-fixer-${{ matrix.config.artifact_name }} |
| 180 | + path: | |
| 181 | + dist/*.zip |
| 182 | + dist/*.tar.gz |
| 183 | + retention-days: 30 |
| 184 | + |
| 185 | + # Only create release on pushes to main/master (not PRs) |
| 186 | + release: |
| 187 | + if: github.event_name == 'push' |
| 188 | + needs: build |
| 189 | + runs-on: ubuntu-latest |
| 190 | + |
| 191 | + steps: |
| 192 | + - name: Download All Artifacts |
| 193 | + uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 |
| 194 | + |
| 195 | + - name: Display Structure |
| 196 | + run: | |
| 197 | + echo "Downloaded artifacts:" |
| 198 | + find . -name "*.zip" -o -name "*.tar.gz" |
| 199 | + |
| 200 | + - name: Generate Release Notes |
| 201 | + run: | |
| 202 | + echo "# Audio Level Fixer - Development Build" > release-notes.md |
| 203 | + echo "" >> release-notes.md |
| 204 | + echo "**Build Information:**" >> release-notes.md |
| 205 | + echo "- Commit: \`${{ github.sha }}\`" >> release-notes.md |
| 206 | + echo "- Date: $(date -u '+%Y-%m-%d %H:%M:%S UTC')" >> release-notes.md |
| 207 | + echo "- Workflow: [\#${{ github.run_number }}](${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }})" >> release-notes.md |
| 208 | + echo "" >> release-notes.md |
| 209 | + echo "**Platforms Built:**" >> release-notes.md |
| 210 | + echo "- ✅ Windows x64" >> release-notes.md |
| 211 | + echo "- ✅ Linux x64" >> release-notes.md |
| 212 | + echo "- ✅ macOS Universal (Intel + Apple Silicon)" >> release-notes.md |
| 213 | + echo "" >> release-notes.md |
| 214 | + echo "> **Note:** This is an automated development build. The project is under active development." >> release-notes.md |
| 215 | +
|
| 216 | + - name: Create Development Release |
| 217 | + uses: softprops/action-gh-release@c062e08bd532815e2082a85e87e3ef29c3e6d191 |
| 218 | + with: |
| 219 | + tag_name: dev-${{ github.run_number }}-${{ github.run_attempt }} |
| 220 | + name: "Development Build #${{ github.run_number }}" |
| 221 | + body_path: release-notes.md |
| 222 | + prerelease: true |
| 223 | + files: | |
| 224 | + **/*.zip |
| 225 | + **/*.tar.gz |
| 226 | + fail_on_unmatched_files: false |
| 227 | + env: |
| 228 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
0 commit comments