|
| 1 | +name: Monthly Crashpad Build |
| 2 | + |
| 3 | +on: |
| 4 | + schedule: |
| 5 | + # Run on the 1st of every month at 2:00 AM UTC |
| 6 | + - cron: "0 2 1 * *" |
| 7 | + workflow_dispatch: # Allow manual triggering |
| 8 | + |
| 9 | +jobs: |
| 10 | + build-crashpad: |
| 11 | + strategy: |
| 12 | + matrix: |
| 13 | + include: |
| 14 | + - os: windows-latest |
| 15 | + platform: windows |
| 16 | + script: scripts/build_crashpad_windows_msvc.ps1 |
| 17 | + artifact_path: third_party/crashpad/out/win-debug |
| 18 | + - os: macos-latest |
| 19 | + platform: macos |
| 20 | + script: scripts/build_crashpad_macos.sh |
| 21 | + artifact_path: third_party/crashpad/out/macos-debug |
| 22 | + - os: ubuntu-latest |
| 23 | + platform: linux |
| 24 | + script: scripts/build_crashpad_linux.sh |
| 25 | + artifact_path: third_party/crashpad/out/linux-debug |
| 26 | + |
| 27 | + runs-on: ${{ matrix.os }} |
| 28 | + name: Build Crashpad on ${{ matrix.platform }} |
| 29 | + |
| 30 | + steps: |
| 31 | + - name: Checkout repository |
| 32 | + uses: actions/checkout@v4 |
| 33 | + |
| 34 | + - name: Set up Python |
| 35 | + uses: actions/setup-python@v4 |
| 36 | + with: |
| 37 | + python-version: "3.x" |
| 38 | + |
| 39 | + - name: Install depot_tools (Windows) |
| 40 | + if: ${{ matrix.platform == 'windows' }} |
| 41 | + shell: pwsh |
| 42 | + run: | |
| 43 | + # Download and set up depot_tools for Windows |
| 44 | + Invoke-WebRequest -Uri "https://storage.googleapis.com/chrome-infra/depot_tools.zip" -OutFile "depot_tools.zip" |
| 45 | + Expand-Archive -Path "depot_tools.zip" -DestinationPath "depot_tools" |
| 46 | + $env:PATH = "$PWD\depot_tools;$env:PATH" |
| 47 | + echo "$PWD\depot_tools" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append |
| 48 | + # Initialize depot_tools |
| 49 | + gclient |
| 50 | +
|
| 51 | + - name: Install depot_tools (Unix) |
| 52 | + if: ${{ matrix.platform != 'windows' }} |
| 53 | + shell: bash |
| 54 | + run: | |
| 55 | + # Download and set up depot_tools for Unix systems |
| 56 | + git clone https://chromium.googlesource.com/chromium/tools/depot_tools.git |
| 57 | + export PATH="$PWD/depot_tools:$PATH" |
| 58 | + echo "$PWD/depot_tools" >> $GITHUB_PATH |
| 59 | + # Initialize depot_tools |
| 60 | + gclient |
| 61 | +
|
| 62 | + - name: Install build dependencies (Linux) |
| 63 | + if: ${{ matrix.platform == 'linux' }} |
| 64 | + shell: bash |
| 65 | + run: | |
| 66 | + sudo apt-get update |
| 67 | + sudo apt-get install -y build-essential libcurl4-openssl-dev |
| 68 | +
|
| 69 | + - name: Install build dependencies (macOS) |
| 70 | + if: ${{ matrix.platform == 'macos' }} |
| 71 | + shell: bash |
| 72 | + run: | |
| 73 | + # Install Xcode command line tools if not already installed |
| 74 | + xcode-select --install || true |
| 75 | +
|
| 76 | + - name: Run build script (Windows) |
| 77 | + if: ${{ matrix.platform == 'windows' }} |
| 78 | + shell: pwsh |
| 79 | + run: | |
| 80 | + ${{ matrix.script }} |
| 81 | +
|
| 82 | + - name: Run build script (Unix) |
| 83 | + if: ${{ matrix.platform != 'windows' }} |
| 84 | + shell: bash |
| 85 | + run: | |
| 86 | + chmod +x ${{ matrix.script }} |
| 87 | + ${{ matrix.script }} |
| 88 | +
|
| 89 | + - name: Prepare artifacts |
| 90 | + shell: bash |
| 91 | + run: | |
| 92 | + # Create a directory for artifacts with debug and release subdirectories |
| 93 | + mkdir -p artifacts/${{ matrix.platform }}/debug/lib |
| 94 | + mkdir -p artifacts/${{ matrix.platform }}/debug/bin |
| 95 | + mkdir -p artifacts/${{ matrix.platform }}/release/lib |
| 96 | + mkdir -p artifacts/${{ matrix.platform }}/release/bin |
| 97 | + mkdir -p artifacts/${{ matrix.platform }}/include/crashpad |
| 98 | + mkdir -p artifacts/${{ matrix.platform }}/include/mini_chromium |
| 99 | +
|
| 100 | + # Set platform-specific paths |
| 101 | + CRASHPAD_ROOT="third_party/crashpad" |
| 102 | + |
| 103 | + # Set debug and release output directories |
| 104 | + if [ "${{ matrix.platform }}" == "windows" ]; then |
| 105 | + DEBUG_OUT_DIR="third_party/crashpad/out/win-debug" |
| 106 | + RELEASE_OUT_DIR="third_party/crashpad/out/win-release" |
| 107 | + elif [ "${{ matrix.platform }}" == "macos" ]; then |
| 108 | + DEBUG_OUT_DIR="third_party/crashpad/out/macos-debug" |
| 109 | + RELEASE_OUT_DIR="third_party/crashpad/out/macos-release" |
| 110 | + else # Linux |
| 111 | + DEBUG_OUT_DIR="third_party/crashpad/out/linux-debug" |
| 112 | + RELEASE_OUT_DIR="third_party/crashpad/out/linux-release" |
| 113 | + fi |
| 114 | +
|
| 115 | + # Copy platform-specific debug libraries and executables |
| 116 | + if [ "${{ matrix.platform }}" == "windows" ]; then |
| 117 | + # Windows debug libraries |
| 118 | + cp "$DEBUG_OUT_DIR/obj/client/client.lib" artifacts/${{ matrix.platform }}/debug/lib/ |
| 119 | + cp "$DEBUG_OUT_DIR/obj/client/common.lib" artifacts/${{ matrix.platform }}/debug/lib/ |
| 120 | + cp "$DEBUG_OUT_DIR/obj/util/util.lib" artifacts/${{ matrix.platform }}/debug/lib/ |
| 121 | + cp "$DEBUG_OUT_DIR/obj/third_party/mini_chromium/mini_chromium/base/base.lib" artifacts/${{ matrix.platform }}/debug/lib/ |
| 122 | + cp "$DEBUG_OUT_DIR/crashpad_handler.exe" artifacts/${{ matrix.platform }}/debug/bin/ |
| 123 | + # Windows release libraries |
| 124 | + cp "$RELEASE_OUT_DIR/obj/client/client.lib" artifacts/${{ matrix.platform }}/release/lib/ |
| 125 | + cp "$RELEASE_OUT_DIR/obj/client/common.lib" artifacts/${{ matrix.platform }}/release/lib/ |
| 126 | + cp "$RELEASE_OUT_DIR/obj/util/util.lib" artifacts/${{ matrix.platform }}/release/lib/ |
| 127 | + cp "$RELEASE_OUT_DIR/obj/third_party/mini_chromium/mini_chromium/base/base.lib" artifacts/${{ matrix.platform }}/release/lib/ |
| 128 | + cp "$RELEASE_OUT_DIR/crashpad_handler.exe" artifacts/${{ matrix.platform }}/release/bin/ |
| 129 | + elif [ "${{ matrix.platform }}" == "macos" ]; then |
| 130 | + # macOS debug libraries |
| 131 | + cp "$DEBUG_OUT_DIR/obj/client/libclient.a" artifacts/${{ matrix.platform }}/debug/lib/ |
| 132 | + cp "$DEBUG_OUT_DIR/obj/client/libcommon.a" artifacts/${{ matrix.platform }}/debug/lib/ |
| 133 | + cp "$DEBUG_OUT_DIR/obj/util/libutil.a" artifacts/${{ matrix.platform }}/debug/lib/ |
| 134 | + cp "$DEBUG_OUT_DIR/obj/util/libmig_output.a" artifacts/${{ matrix.platform }}/debug/lib/ |
| 135 | + cp "$DEBUG_OUT_DIR/obj/third_party/mini_chromium/mini_chromium/base/libbase.a" artifacts/${{ matrix.platform }}/debug/lib/ |
| 136 | + cp "$DEBUG_OUT_DIR/crashpad_handler" artifacts/${{ matrix.platform }}/debug/bin/ |
| 137 | + # macOS release libraries |
| 138 | + cp "$RELEASE_OUT_DIR/obj/client/libclient.a" artifacts/${{ matrix.platform }}/release/lib/ |
| 139 | + cp "$RELEASE_OUT_DIR/obj/client/libcommon.a" artifacts/${{ matrix.platform }}/release/lib/ |
| 140 | + cp "$RELEASE_OUT_DIR/obj/util/libutil.a" artifacts/${{ matrix.platform }}/release/lib/ |
| 141 | + cp "$RELEASE_OUT_DIR/obj/util/libmig_output.a" artifacts/${{ matrix.platform }}/release/lib/ |
| 142 | + cp "$RELEASE_OUT_DIR/obj/third_party/mini_chromium/mini_chromium/base/libbase.a" artifacts/${{ matrix.platform }}/release/lib/ |
| 143 | + cp "$RELEASE_OUT_DIR/crashpad_handler" artifacts/${{ matrix.platform }}/release/bin/ |
| 144 | + else # Linux |
| 145 | + # Linux debug libraries |
| 146 | + cp "$DEBUG_OUT_DIR/obj/client/libclient.a" artifacts/${{ matrix.platform }}/debug/lib/ |
| 147 | + cp "$DEBUG_OUT_DIR/obj/client/libcommon.a" artifacts/${{ matrix.platform }}/debug/lib/ |
| 148 | + cp "$DEBUG_OUT_DIR/obj/util/libutil.a" artifacts/${{ matrix.platform }}/debug/lib/ |
| 149 | + cp "$DEBUG_OUT_DIR/obj/third_party/mini_chromium/mini_chromium/base/libbase.a" artifacts/${{ matrix.platform }}/debug/lib/ |
| 150 | + cp "$DEBUG_OUT_DIR/crashpad_handler" artifacts/${{ matrix.platform }}/debug/bin/ |
| 151 | + # Linux release libraries |
| 152 | + cp "$RELEASE_OUT_DIR/obj/client/libclient.a" artifacts/${{ matrix.platform }}/release/lib/ |
| 153 | + cp "$RELEASE_OUT_DIR/obj/client/libcommon.a" artifacts/${{ matrix.platform }}/release/lib/ |
| 154 | + cp "$RELEASE_OUT_DIR/obj/util/libutil.a" artifacts/${{ matrix.platform }}/release/lib/ |
| 155 | + cp "$RELEASE_OUT_DIR/obj/third_party/mini_chromium/mini_chromium/base/libbase.a" artifacts/${{ matrix.platform }}/release/lib/ |
| 156 | + cp "$RELEASE_OUT_DIR/crashpad_handler" artifacts/${{ matrix.platform }}/release/bin/ |
| 157 | + fi |
| 158 | +
|
| 159 | + # Copy include directories (shared between debug and release) |
| 160 | + cp -r "$CRASHPAD_ROOT"/*.h artifacts/${{ matrix.platform }}/include/crashpad/ 2>/dev/null || true |
| 161 | + cp -r "$CRASHPAD_ROOT"/client/*.h artifacts/${{ matrix.platform }}/include/crashpad/ 2>/dev/null || true |
| 162 | + cp -r "$CRASHPAD_ROOT"/util/*.h artifacts/${{ matrix.platform }}/include/crashpad/ 2>/dev/null || true |
| 163 | + cp -r "$CRASHPAD_ROOT"/base/*.h artifacts/${{ matrix.platform }}/include/crashpad/ 2>/dev/null || true |
| 164 | + cp -r "$CRASHPAD_ROOT"/third_party/mini_chromium/mini_chromium/* artifacts/${{ matrix.platform }}/include/mini_chromium/ 2>/dev/null || true |
| 165 | +
|
| 166 | + # Verify required files exist |
| 167 | + echo "Verifying debug artifact files..." |
| 168 | + ls -la artifacts/${{ matrix.platform }}/debug/lib/ |
| 169 | + ls -la artifacts/${{ matrix.platform }}/debug/bin/ |
| 170 | + echo "Verifying release artifact files..." |
| 171 | + ls -la artifacts/${{ matrix.platform }}/release/lib/ |
| 172 | + ls -la artifacts/${{ matrix.platform }}/release/bin/ |
| 173 | +
|
| 174 | + # Create a build info file |
| 175 | + echo "Build Date: $(date)" > artifacts/${{ matrix.platform }}/build_info.txt |
| 176 | + echo "Platform: ${{ matrix.platform }}" >> artifacts/${{ matrix.platform }}/build_info.txt |
| 177 | + echo "OS: ${{ matrix.os }}" >> artifacts/${{ matrix.platform }}/build_info.txt |
| 178 | + echo "Commit: ${{ github.sha }}" >> artifacts/${{ matrix.platform }}/build_info.txt |
| 179 | + echo "Configurations: Debug, Release" >> artifacts/${{ matrix.platform }}/build_info.txt |
| 180 | +
|
| 181 | + - name: Upload artifacts |
| 182 | + uses: actions/upload-artifact@v4 |
| 183 | + with: |
| 184 | + name: crashpad-${{ matrix.platform }}-${{ github.run_number }} |
| 185 | + path: artifacts/${{ matrix.platform }}/ |
| 186 | + retention-days: 90 |
| 187 | + |
| 188 | + create-release: |
| 189 | + needs: build-crashpad |
| 190 | + runs-on: ubuntu-latest |
| 191 | + # Release on every successful build |
| 192 | + if: ${{ github.event_name == 'schedule' || github.event_name == 'workflow_dispatch' }} |
| 193 | + |
| 194 | + steps: |
| 195 | + - name: Checkout repository |
| 196 | + uses: actions/checkout@v4 |
| 197 | + |
| 198 | + - name: Download all artifacts |
| 199 | + uses: actions/download-artifact@v4 |
| 200 | + with: |
| 201 | + path: release-artifacts |
| 202 | + |
| 203 | + - name: Get Crashpad version |
| 204 | + id: crashpad-version |
| 205 | + run: | |
| 206 | + # We need to fetch Crashpad to get its version info |
| 207 | + git clone https://chromium.googlesource.com/chromium/tools/depot_tools.git |
| 208 | + export PATH="$PWD/depot_tools:$PATH" |
| 209 | + mkdir -p temp-crashpad && cd temp-crashpad |
| 210 | + fetch --no-history crashpad |
| 211 | + cd crashpad |
| 212 | + CRASHPAD_COMMIT=$(git rev-parse --short HEAD) |
| 213 | + CRASHPAD_DATE=$(git show -s --format=%ci HEAD | cut -d' ' -f1 | tr -d '-') |
| 214 | + echo "version=v${CRASHPAD_DATE}-${CRASHPAD_COMMIT}" >> $GITHUB_OUTPUT |
| 215 | + echo "commit=${CRASHPAD_COMMIT}" >> $GITHUB_OUTPUT |
| 216 | + echo "date=${CRASHPAD_DATE}" >> $GITHUB_OUTPUT |
| 217 | + cd ../.. |
| 218 | +
|
| 219 | + - name: Create release archives and checksums |
| 220 | + run: | |
| 221 | + cd release-artifacts |
| 222 | + for dir in crashpad-*; do |
| 223 | + platform=$(echo $dir | sed 's/crashpad-\(.*\)-[0-9]*/\1/') |
| 224 | + archive="crashpad-${platform}-${{ steps.crashpad-version.outputs.version }}.tar.gz" |
| 225 | + tar -czf "../${archive}" -C "$dir" . |
| 226 | + # Generate checksum |
| 227 | + cd .. |
| 228 | + sha256sum "${archive}" > "${archive}.sha256" |
| 229 | + cd release-artifacts |
| 230 | + done |
| 231 | + cd .. |
| 232 | +
|
| 233 | + - name: Create Release |
| 234 | + uses: softprops/action-gh-release@v1 |
| 235 | + with: |
| 236 | + tag_name: ${{ steps.crashpad-version.outputs.version }} |
| 237 | + name: Crashpad Build ${{ steps.crashpad-version.outputs.version }} |
| 238 | + body: | |
| 239 | + ## Crashpad Libraries - ${{ steps.crashpad-version.outputs.version }} |
| 240 | + |
| 241 | + Ready-to-use Crashpad libraries for all platforms, built from the latest Crashpad source. |
| 242 | + |
| 243 | + ### Quick Start |
| 244 | + 1. Download the archive for your platform below |
| 245 | + 2. Extract to your project directory |
| 246 | + 3. Point your build system to the extracted files |
| 247 | + 4. See the [sample project](https://github.com/${{ github.repository }}) for integration examples |
| 248 | + |
| 249 | + ### Platforms Included |
| 250 | + - **Windows**: MSVC-compatible `.lib` files + `crashpad_handler.exe` |
| 251 | + - **macOS**: Universal `.a` files + `crashpad_handler` |
| 252 | + - **Linux**: GCC-compatible `.a` files + `crashpad_handler` |
| 253 | + |
| 254 | + ### Directory Structure |
| 255 | + ``` |
| 256 | + crashpad-<platform>/ |
| 257 | + ├── debug/ |
| 258 | + │ ├── lib/ # Debug libraries |
| 259 | + │ └── bin/ # Debug crashpad_handler |
| 260 | + ├── release/ |
| 261 | + │ ├── lib/ # Release libraries |
| 262 | + │ └── bin/ # Release crashpad_handler |
| 263 | + ├── include/ |
| 264 | + │ ├── crashpad/ # Crashpad headers |
| 265 | + │ └── mini_chromium/ # Mini Chromium headers |
| 266 | + └── build_info.txt # Build metadata |
| 267 | + ``` |
| 268 | + |
| 269 | + ### Security Verification |
| 270 | + Verify downloads using the provided `.sha256` files: |
| 271 | + ```bash |
| 272 | + # Linux/macOS |
| 273 | + sha256sum -c crashpad-<platform>-*.tar.gz.sha256 |
| 274 | + |
| 275 | + # Windows PowerShell |
| 276 | + Get-FileHash crashpad-<platform>-*.tar.gz -Algorithm SHA256 |
| 277 | + ``` |
| 278 | + |
| 279 | + ### Integration Tips |
| 280 | + - Use **debug** libraries during development for better crash reporting |
| 281 | + - Use **release** libraries for production builds |
| 282 | + - Ensure `crashpad_handler` is deployed alongside your application |
| 283 | + - See `build_info.txt` in each archive for detailed build information |
| 284 | + |
| 285 | + --- |
| 286 | + **Build Details:** |
| 287 | + - **Build Date**: $(date -u +"%Y-%m-%d %H:%M:%S UTC") |
| 288 | + - **Crashpad Commit**: ${{ steps.crashpad-version.outputs.commit }} |
| 289 | + - **Source Repository**: https://github.com/${{ github.repository }} |
| 290 | + - **Workflow Run**: https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }} |
| 291 | + files: | |
| 292 | + crashpad-*.tar.gz |
| 293 | + crashpad-*.tar.gz.sha256 |
| 294 | + draft: false |
| 295 | + prerelease: false |
| 296 | + env: |
| 297 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
0 commit comments