diff --git a/.github/workflows/downstream_updates.yml b/.github/workflows/downstream_updates.yml new file mode 100644 index 00000000..93101b3d --- /dev/null +++ b/.github/workflows/downstream_updates.yml @@ -0,0 +1,37 @@ +name: downstream-updates +permissions: read-all + +on: + release: + types: [released] + workflow_dispatch: + inputs: + target_version: + description: 'Version of the CLI to update downstream repos to' + required: true + type: string + +jobs: + update-dependencies: + runs-on: ubuntu-latest + env: + RELEASE_VERSION: ${{ github.event_name == 'workflow_dispatch' && inputs.target_version || github.event.release.tag_name }} + strategy: + matrix: + downstream_repo: ['bugsnag/bugsnag-unity'] + steps: + - name: Install libcurl4-openssl-dev and net-tools + run: | + sudo apt-get update + sudo apt-get install libcurl4-openssl-dev net-tools + + - run: > + curl -X POST https://api.github.com/repos/bugsnag/bugsnag-unity/dispatches + -H 'Content-Type: application/json' + -H "Authorization: Bearer ${{ secrets.DEP_UPDATER_BEARER_TOKEN }}" + -d '{ + "event_type": "update-cli", + "client_payload": { + "cli_version": "${{ env.RELEASE_VERSION }}" + } + }' \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index 38e179de..fbea375a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,10 @@ # Changelog +## 2.9.2 (2025-02-11) + +### Fixes +- Get NDK version from the `source.properties` file when uploading NDK symbol files [172](https://github.com/bugsnag/bugsnag-cli/pull/172) + ## 2.9.1 - (2025-01-23) ### Fixes diff --git a/features/Unity-Android/unity.feature b/features/Unity-Android/unity.feature index 807dc230..17c50384 100644 --- a/features/Unity-Android/unity.feature +++ b/features/Unity-Android/unity.feature @@ -13,6 +13,21 @@ Feature: Unity Android integration tests And the sourcemap payload field "versionName" equals "1.0" And the sourcemap payload field "overwrite" equals "true" + Scenario: Unity Android integration tests using the bundled NDK + Given I build the Unity Android example project + And I wait for the Unity symbols to generate + + Given I set the NDK path to the Unity bundled version + When I run bugsnag-cli with upload unity-android --upload-api-root-url=http://localhost:9339 --api-key=1234567890ABCDEF1234567890ABCDEF --overwrite platforms-examples/Unity/ + Then I wait to receive 5 sourcemaps + Then the sourcemap is valid for the Android Build API + Then the sourcemaps Content-Type header is valid multipart form-data + And the sourcemap payload field "apiKey" equals "1234567890ABCDEF1234567890ABCDEF" + And the sourcemap payload field "appId" equals "com.bugsnag.example.unity.android" + And the sourcemap payload field "versionCode" equals "1" + And the sourcemap payload field "versionName" equals "1.0" + And the sourcemap payload field "overwrite" equals "true" + Scenario: Unity Android integration tests passing the aab file Given I build the Unity Android example project diff --git a/features/steps/steps.rb b/features/steps/steps.rb index 6307f5e5..a02a48f3 100644 --- a/features/steps/steps.rb +++ b/features/steps/steps.rb @@ -230,3 +230,8 @@ def get_version_number(file_path) And('I wait for the Unity symbols to generate') do Maze.check.include(`ls #{@fixture_dir}`, 'UnityExample-1.0-v1-IL2CPP.symbols.zip') end + +Given(/^I set the NDK path to the Unity bundled version$/) do +# Set the environment variable to the path of the NDK bundled with Unity + ENV['ANDROID_NDK_ROOT'] = "/Applications/Unity/Hub/Editor/#{ENV['UNITY_VERSION']}/PlaybackEngines/AndroidPlayer/NDK" +end diff --git a/install.sh b/install.sh index 5e3be392..93c3376c 100755 --- a/install.sh +++ b/install.sh @@ -91,7 +91,7 @@ display_help() { EOS } -VERSION="2.9.1" +VERSION="2.9.2" while [[ "$#" -gt 0 ]]; do case "$1" in diff --git a/main.go b/main.go index c3e46d5d..c665e76a 100644 --- a/main.go +++ b/main.go @@ -13,7 +13,7 @@ import ( "github.com/bugsnag/bugsnag-cli/pkg/utils" ) -var package_version = "2.9.1" +var package_version = "2.9.2" func main() { commands := options.CLI{} diff --git a/package.json b/package.json index 86b1a085..8402ca4f 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@bugsnag/cli", - "version": "2.9.1", + "version": "2.9.2", "description": "BugSnag CLI", "main": "bugsnag-cli-wrapper.js", "bin": { diff --git a/pkg/android/get-ndk-version.go b/pkg/android/get-ndk-version.go index d81988e2..a663c919 100644 --- a/pkg/android/get-ndk-version.go +++ b/pkg/android/get-ndk-version.go @@ -1,21 +1,53 @@ package android import ( + "bufio" + "fmt" + "os" "path/filepath" "strconv" "strings" ) // GetNdkVersion - Returns the major NDK version -func GetNdkVersion(path string) (int, error) { +func GetNdkVersion(ndkPath string) (int, error) { + // Construct the path to source.properties + sourceFile := filepath.Join(ndkPath, "source.properties") - ndkVersion := strings.Split(filepath.Base(path), ".") + // Open the file + file, err := os.Open(sourceFile) + if err != nil { + return 0, fmt.Errorf("failed to open source.properties: %v", err) + } + defer file.Close() - ndkIntVersion, err := strconv.Atoi(ndkVersion[0]) + // Read the file line by line + scanner := bufio.NewScanner(file) + for scanner.Scan() { + line := scanner.Text() + if strings.HasPrefix(line, "Pkg.Revision") { + // Extract version string + parts := strings.Split(line, "=") + parts[1] = strings.TrimSpace(parts[1]) + if len(parts) == 2 { + versionStr := parts[1] + // Extract major version (before the first dot) + versionParts := strings.Split(versionStr, ".") + if len(versionParts) > 0 { + majorVersion, err := strconv.Atoi(versionParts[0]) + if err != nil { + return 0, fmt.Errorf("failed to parse major version: %v", err) + } + return majorVersion, nil + } + } + } + } - if err != nil { - return 0, err + // Check for errors while scanning + if err := scanner.Err(); err != nil { + return 0, fmt.Errorf("error reading source.properties: %v", err) } - return ndkIntVersion, nil + return 0, fmt.Errorf("NDK version not found in source.properties") }