Skip to content

Commit

Permalink
[GitHub Actions] Create + upload Sentry source bundles for debugging
Browse files Browse the repository at this point in the history
  • Loading branch information
past-due committed Aug 2, 2021
1 parent d974dcc commit eccbd3a
Show file tree
Hide file tree
Showing 2 changed files with 90 additions and 1 deletion.
36 changes: 36 additions & 0 deletions .ci/githubactions/FetchSentryCLI.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
cmake_minimum_required(VERSION 3.14)

set(sentry_cli_version "1.68.0") # Note: When updating, must also update all of the sentry_cli_dl_sha512 below!

# Construct the appropriate URL based on the current platform
set(sentry_cli_dl_url "")
set(sentry_cli_dl_sha512 "")
set(_exe_suffix "")
if(CMAKE_HOST_SYSTEM_NAME MATCHES "Windows")
if(CMAKE_HOST_SYSTEM_PROCESSOR MATCHES "^x86$")
set(sentry_cli_dl_url "https://github.com/getsentry/sentry-cli/releases/download/${sentry_cli_version}/sentry-cli-Windows-i686.exe")
set(sentry_cli_dl_sha512 "b4357fe65930642a224e607c68fc56c1ff5ee21385e7cf4c4bf44f38c1f1e88a1dde3c3cf5af3375720445c6c0932b63bdbdce7e467082b831fe4b4fc4623358")
else()
# just default to x64 otherwise
set(sentry_cli_dl_url "https://github.com/getsentry/sentry-cli/releases/download/${sentry_cli_version}/sentry-cli-Windows-x86_64.exe")
set(sentry_cli_dl_sha512 "7e1ad84df236240694d05dbaed110f9ea85a6088dd4a97888591d35c70ee533ad208896e296c3f93f9f9826c849de9c3e15b23400be6e8ebcaf089a1aec2019b")
endif()
set(_exe_suffix ".exe")
elseif(CMAKE_HOST_SYSTEM_NAME MATCHES "Darwin")
set(sentry_cli_dl_url "https://github.com/getsentry/sentry-cli/releases/download/${sentry_cli_version}/sentry-cli-Darwin-universal")
set(sentry_cli_dl_sha512 "847b6a40fb698ae862c9292b77a035bb1a24bc69e0ba3bdcea94d6436038aa1ecf62466a2ba5e81ab2d6fe06fb934e26a1c14a5188549954987d0716bc6f0398")
else()
message(FATAL_ERROR "Script does not currently support platform: ${CMAKE_HOST_SYSTEM_NAME}")
endif()

include(FetchContent)
FetchContent_Populate(
sentry-cli
URL "${sentry_cli_dl_url}"
URL_HASH SHA512=${sentry_cli_dl_sha512}
DOWNLOAD_NAME "sentry-cli${_exe_suffix}"
DOWNLOAD_NO_EXTRACT TRUE
SOURCE_DIR sentry-cli
)

message(STATUS "Downloaded sentry-cli (${sentry_cli_version}) to: \"${CMAKE_CURRENT_BINARY_DIR}/sentry-cli/sentry-cli${_exe_suffix}\"")
55 changes: 54 additions & 1 deletion .github/workflows/CI_windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -294,6 +294,8 @@ jobs:
New-Item -ItemType Directory -Force -Path "${{ github.workspace }}\output\debugsymbols"
New-Item -ItemType Directory -Force -Path "${{ github.workspace }}\output\archive"
New-Item -ItemType Directory -Force -Path "${{ github.workspace }}\output\error_logs"
New-Item -ItemType Directory -Force -Path "${{ github.workspace }}\output\sentry_source_bundles"
New-Item -ItemType Directory -Force -Path "${{ github.workspace }}\sentry_artifacts"
- name: 'Download & Install Ninja-Build'
id: ninja-dl
run: |
Expand Down Expand Up @@ -578,6 +580,46 @@ jobs:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GH_REPO: ${{ github.repository }}
WZ_GITHUB_REF: ${{ steps.checkout-config.outputs.WZ_GITHUB_REF }}
#####################################################
# Create Sentry source bundle
#####################################################
- name: Create Sentry source bundle
if: success() && (matrix.support_sentry == true)
id: create-sentry-source-bundle
continue-on-error: true
working-directory: '${{ github.workspace }}\sentry_artifacts'
env:
WZ_REPO_PATH: ${{ steps.settings.outputs.WZ_REPO_PATH }}
WZ_ARCHIVE_PATH: '${{ github.workspace }}\output\archive\warzone2100_${{ steps.settings.outputs.WZ_BUILD_DESC }}_archive.zip'
SOURCE_BUNDLE_OUTPUT_DIR: '${{ github.workspace }}\output\sentry_source_bundles'
run: |
# Download sentry-cli
echo "::group::Downloading sentry-cli ..."
cmake -P "${env:WZ_REPO_PATH}/.ci/githubactions/FetchSentryCLI.cmake"
echo "Downloading sentry-cli ... Done"
echo "::endgroup::"
# Extract the WZ archive to a temporary path
echo "::group::Expanding archive ..."
Expand-Archive -LiteralPath "${env:WZ_ARCHIVE_PATH}" -DestinationPath "$(pwd)\wz_extracted"
# Remove any .sym files from extracted archive
Remove-Item "$(pwd)\wz_extracted\bin\*" -Recurse -Include *.sym
echo "Expanding archive ... Done"
Get-ChildItem -Path "$(pwd)\wz_extracted\bin" -Recurse
echo "::endgroup::"
# Create the Sentry source bundle
echo "sentry-cli difutil bundle-sources ..."
& "$(pwd)\sentry-cli\sentry-cli.exe" difutil bundle-sources -o "${env:SOURCE_BUNDLE_OUTPUT_DIR}" "$(pwd)\wz_extracted\bin\warzone2100.pdb"
echo "sentry-cli difutil bundle-sources ... Done"
# List output bundles
Get-ChildItem -Path "${env:SOURCE_BUNDLE_OUTPUT_DIR}" -Recurse
- name: Upload Sentry source bundles
if: success() && (github.repository == 'Warzone2100/warzone2100') && (matrix.support_sentry == true) && (steps.settings.outputs.WZ_ENABLE_SENTRY == 'true') && (steps.create-sentry-source-bundle.outcome == 'success')
uses: actions/upload-artifact@v2
with:
name: 'warzone2100_${{ steps.settings.outputs.WZ_BUILD_DESC }}_debug_sourcebundles'
path: '${{ github.workspace }}\output\sentry_source_bundles'
retention-days: 1
if-no-files-found: 'warn'
upload-debug-symbols:
strategy:
matrix:
Expand All @@ -597,7 +639,8 @@ jobs:
- name: Prep Environment
run: |
mkdir dl-archive
- name: Download Artifacts
mkdir dl-sourcebundle
- name: Download Archive Artifact
uses: actions/download-artifact@v2
with:
name: 'warzone2100_win_${{ matrix.architecture }}_archive'
Expand All @@ -615,17 +658,27 @@ jobs:
rm "${BREAKPAD_SYM}"
fi
echo "::set-output name=ARCHIVEDIR::${OUTPUTDIR}"
- name: Download Source Bundle
continue-on-error: true
uses: actions/download-artifact@v2
with:
name: 'warzone2100_win_${{ matrix.architecture }}_debug_sourcebundles'
path: ./dl-sourcebundle
- name: 'Upload debug symbols'
env:
SENTRY_AUTH_TOKEN: '${{ secrets.SENTRY_AUTH_TOKEN }}'
WZ_ARCHIVE_DIR: '${{ steps.extract.outputs.ARCHIVEDIR }}'
WZ_SOURCEBUNDLES_DIR: './dl-sourcebundle'
run: |
if [[ -z "${SENTRY_AUTH_TOKEN}" ]]; then
echo "No SENTRY_AUTH_TOKEN - skipping"
exit 0
fi
docker pull getsentry/sentry-cli
echo "Uploading debug symbols"
docker run --rm -e SENTRY_AUTH_TOKEN -v "$(pwd):/work" getsentry/sentry-cli upload-dif --no-zips -o warzone2100 -p warzone2100 "${WZ_ARCHIVE_DIR}"
echo "Uploading source bundles"
docker run --rm -e SENTRY_AUTH_TOKEN -v "$(pwd):/work" getsentry/sentry-cli upload-dif --type sourcebundle -o warzone2100 -p warzone2100 "${WZ_SOURCEBUNDLES_DIR}"
trigger-updates-json:
name: 'Trigger Info Update'
runs-on: ubuntu-latest
Expand Down

0 comments on commit eccbd3a

Please sign in to comment.