From 6da769b0b78c50dc2fbd06eeca2e173a0a27ef44 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Mon, 3 Nov 2025 15:03:37 +0000 Subject: [PATCH 1/5] Initial plan From f98094fa298832f8b935ce85981ec1b39c2f110e Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Mon, 3 Nov 2025 15:07:40 +0000 Subject: [PATCH 2/5] Add separate GitHub Actions for Android and iOS compilation testing Co-authored-by: kenjdavidson <6210735+kenjdavidson@users.noreply.github.com> --- .github/workflows/android-build.yml | 48 ++++++++++++++++++++++ .github/workflows/ios-build.yml | 63 +++++++++++++++++++++++++++++ 2 files changed, 111 insertions(+) create mode 100644 .github/workflows/android-build.yml create mode 100644 .github/workflows/ios-build.yml diff --git a/.github/workflows/android-build.yml b/.github/workflows/android-build.yml new file mode 100644 index 00000000..e6d94cac --- /dev/null +++ b/.github/workflows/android-build.yml @@ -0,0 +1,48 @@ +name: Android Build + +on: + pull_request: + types: [opened, synchronize, reopened] + paths: + - 'android/**' + - 'src/**' + - 'package.json' + - '.github/workflows/android-build.yml' + +jobs: + build-android: + runs-on: ubuntu-latest + + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Set up JDK 17 + uses: actions/setup-java@v4 + with: + java-version: '17' + distribution: 'temurin' + + - name: Setup Node.js + uses: actions/setup-node@v4 + with: + node-version: '18' + cache: 'npm' + + - name: Install dependencies + run: npm ci + + - name: Validate Gradle wrapper + uses: gradle/wrapper-validation-action@v2 + + - name: Build Android library + working-directory: android + run: ./gradlew build --no-daemon --stacktrace + + - name: Upload build artifacts + if: failure() + uses: actions/upload-artifact@v4 + with: + name: android-build-reports + path: android/build/reports/ + retention-days: 7 diff --git a/.github/workflows/ios-build.yml b/.github/workflows/ios-build.yml new file mode 100644 index 00000000..420eb972 --- /dev/null +++ b/.github/workflows/ios-build.yml @@ -0,0 +1,63 @@ +name: iOS Build + +on: + pull_request: + types: [opened, synchronize, reopened] + paths: + - 'ios/**' + - 'src/**' + - 'package.json' + - 'react-native-bluetooth-classic.podspec' + - '.github/workflows/ios-build.yml' + +jobs: + build-ios: + runs-on: macos-latest + + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Setup Node.js + uses: actions/setup-node@v4 + with: + node-version: '18' + cache: 'npm' + + - name: Install dependencies + run: npm ci + + - name: Setup Ruby + uses: ruby/setup-ruby@v1 + with: + ruby-version: '3.0' + bundler-cache: false + + - name: Install CocoaPods + run: | + gem install cocoapods + pod --version + + - name: Validate Podspec + run: pod lib lint react-native-bluetooth-classic.podspec --allow-warnings --skip-import-validation + + - name: Build iOS library + run: | + cd ios + xcodebuild clean build \ + -project RNBluetoothClassic.xcodeproj \ + -scheme RNBluetoothClassic \ + -sdk iphonesimulator \ + -configuration Release \ + -destination 'platform=iOS Simulator,name=iPhone 15,OS=latest' \ + CODE_SIGN_IDENTITY="" \ + CODE_SIGNING_REQUIRED=NO \ + CODE_SIGNING_ALLOWED=NO + + - name: Upload build logs + if: failure() + uses: actions/upload-artifact@v4 + with: + name: ios-build-logs + path: ~/Library/Logs/xcodebuild/ + retention-days: 7 From d650158178a6eccf53693fa6197e4b9791ceff47 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Mon, 3 Nov 2025 15:08:47 +0000 Subject: [PATCH 3/5] Add documentation for GitHub Actions workflows Co-authored-by: kenjdavidson <6210735+kenjdavidson@users.noreply.github.com> --- .github/workflows/README.md | 88 +++++++++++++++++++++++++++++++++++++ README.md | 9 ++++ 2 files changed, 97 insertions(+) create mode 100644 .github/workflows/README.md diff --git a/.github/workflows/README.md b/.github/workflows/README.md new file mode 100644 index 00000000..87906947 --- /dev/null +++ b/.github/workflows/README.md @@ -0,0 +1,88 @@ +# GitHub Actions Workflows + +This directory contains GitHub Actions workflows for continuous integration and deployment. + +## Active Workflows + +### Android Build (`android-build.yml`) + +Automatically builds and tests the Android library on pull requests. + +**Triggers:** +- Pull request opened, synchronized, or reopened +- Only runs when relevant files change (android/, src/, package.json) + +**What it does:** +1. Sets up Java 17 and Node.js 18 +2. Installs npm dependencies +3. Validates Gradle wrapper +4. Builds the Android library using Gradle +5. Uploads build reports on failure + +### iOS Build (`ios-build.yml`) + +Automatically builds and tests the iOS library on pull requests. + +**Triggers:** +- Pull request opened, synchronized, or reopened +- Only runs when relevant files change (ios/, src/, package.json, podspec) + +**What it does:** +1. Sets up Node.js 18 and Ruby 3.0 +2. Installs npm dependencies +3. Installs CocoaPods +4. Validates the podspec +5. Builds the iOS library using xcodebuild +6. Uploads build logs on failure + +### Test and Build (`test-and-build.yml`) + +Manual workflow for comprehensive testing across all environments. + +**Triggers:** +- Manual dispatch only (`workflow_dispatch`) + +**What it does:** +1. Runs JavaScript tests +2. Builds the TypeScript library +3. Builds Android with Gradle +4. Validates iOS build + +### Other Workflows + +- `publish-documentation.yml` - Publishes documentation to GitHub Pages +- `release-and-publish-npm.yml` - Handles releases and npm publishing + +## Running Workflows Locally + +### Android Build + +```bash +cd android +./gradlew build +``` + +### iOS Build + +```bash +cd ios +xcodebuild clean build \ + -project RNBluetoothClassic.xcodeproj \ + -scheme RNBluetoothClassic \ + -sdk iphonesimulator \ + -configuration Release +``` + +### JavaScript/TypeScript + +```bash +npm ci +npm run test +npm run build +``` + +## Notes + +- The Android and iOS workflows use path filters to only run when relevant code changes +- Build artifacts and logs are uploaded on failure for debugging +- The workflows use the latest stable versions of actions and tools diff --git a/README.md b/README.md index 1f3cc686..1ce27de0 100644 --- a/README.md +++ b/README.md @@ -108,6 +108,15 @@ Feel free to contribute any changes or bug fixes you see fit. Although when doi - Changes should be customizable where possible (especially when possibly breaking to others) - Changes should be documented +### Continuous Integration + +The project uses GitHub Actions for continuous integration. When you open a pull request: + +- **Android Build**: Automatically compiles the Android library to ensure your changes don't break the build +- **iOS Build**: Automatically compiles the iOS library to ensure your changes don't break the build + +These workflows run automatically when you modify relevant files (android/, ios/, or src/ directories). See [.github/workflows/README.md](.github/workflows/README.md) for more details. + #### Android When first building the Android project there were issues with react-native-create-library and the version of Android/Gradle installed on my machine. This needed to be resolved by ensuring that the project was inline with the version of Android Studio and the Android plugin for gradle. In my case, the project was configured with 1.3.1 and 2.2, which caused problems, in order to resolve [Android plugin for gradle versions](https://developer.android.com/studio/releases/gradle-plugin.html) From 0e6766309aeebfa21679913825cfec69b9905ea8 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Mon, 3 Nov 2025 15:11:34 +0000 Subject: [PATCH 4/5] Fix code review feedback: update Java version and simulator target Co-authored-by: kenjdavidson <6210735+kenjdavidson@users.noreply.github.com> --- .github/workflows/README.md | 8 +++++--- .github/workflows/android-build.yml | 4 ++-- .github/workflows/ios-build.yml | 2 +- 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/.github/workflows/README.md b/.github/workflows/README.md index 87906947..63a57ed1 100644 --- a/.github/workflows/README.md +++ b/.github/workflows/README.md @@ -35,7 +35,9 @@ Automatically builds and tests the iOS library on pull requests. 5. Builds the iOS library using xcodebuild 6. Uploads build logs on failure -### Test and Build (`test-and-build.yml`) +### Other Workflows + +#### Test and Build (`test-and-build.yml`) Manual workflow for comprehensive testing across all environments. @@ -46,9 +48,9 @@ Manual workflow for comprehensive testing across all environments. 1. Runs JavaScript tests 2. Builds the TypeScript library 3. Builds Android with Gradle -4. Validates iOS build +4. Sets up iOS environment (build steps incomplete) -### Other Workflows +#### Documentation and Release - `publish-documentation.yml` - Publishes documentation to GitHub Pages - `release-and-publish-npm.yml` - Handles releases and npm publishing diff --git a/.github/workflows/android-build.yml b/.github/workflows/android-build.yml index e6d94cac..2abaee60 100644 --- a/.github/workflows/android-build.yml +++ b/.github/workflows/android-build.yml @@ -17,10 +17,10 @@ jobs: - name: Checkout code uses: actions/checkout@v4 - - name: Set up JDK 17 + - name: Set up JDK 11 uses: actions/setup-java@v4 with: - java-version: '17' + java-version: '11' distribution: 'temurin' - name: Setup Node.js diff --git a/.github/workflows/ios-build.yml b/.github/workflows/ios-build.yml index 420eb972..26a328be 100644 --- a/.github/workflows/ios-build.yml +++ b/.github/workflows/ios-build.yml @@ -49,7 +49,7 @@ jobs: -scheme RNBluetoothClassic \ -sdk iphonesimulator \ -configuration Release \ - -destination 'platform=iOS Simulator,name=iPhone 15,OS=latest' \ + -destination 'platform=iOS Simulator,name=iPhone 14,OS=latest' \ CODE_SIGN_IDENTITY="" \ CODE_SIGNING_REQUIRED=NO \ CODE_SIGNING_ALLOWED=NO From ca73f1ed799da75f8fd40775ab230b7701017f4d Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Mon, 3 Nov 2025 15:12:42 +0000 Subject: [PATCH 5/5] Add explicit GITHUB_TOKEN permissions to workflows for security Co-authored-by: kenjdavidson <6210735+kenjdavidson@users.noreply.github.com> --- .github/workflows/android-build.yml | 2 ++ .github/workflows/ios-build.yml | 2 ++ 2 files changed, 4 insertions(+) diff --git a/.github/workflows/android-build.yml b/.github/workflows/android-build.yml index 2abaee60..1bf84f6b 100644 --- a/.github/workflows/android-build.yml +++ b/.github/workflows/android-build.yml @@ -12,6 +12,8 @@ on: jobs: build-android: runs-on: ubuntu-latest + permissions: + contents: read steps: - name: Checkout code diff --git a/.github/workflows/ios-build.yml b/.github/workflows/ios-build.yml index 26a328be..d5275431 100644 --- a/.github/workflows/ios-build.yml +++ b/.github/workflows/ios-build.yml @@ -13,6 +13,8 @@ on: jobs: build-ios: runs-on: macos-latest + permissions: + contents: read steps: - name: Checkout code