Skip to content

Commit

Permalink
Merge branch 'development' into improve-start-release-workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
rolandkakonyi committed Dec 15, 2023
2 parents 9abd670 + 409198a commit 2d85db8
Show file tree
Hide file tree
Showing 122 changed files with 14,156 additions and 7,024 deletions.
3 changes: 3 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,6 @@ node_modules/
example/node_modules/
example/ios/
example/ios/Pods/
integration_test/node_modules/
integration_test/ios/
integration_test/ios/Pods/
17 changes: 14 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,20 @@ name: CI
on:
pull_request:
paths-ignore:
- '*.md'
- '**.md'

push:
branches: [development]
paths-ignore:
- '*.md'
- '**.md'

concurrency:
group: ci-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true

env:
NO_FLIPPER: 1

jobs:
code-style-typescript:
name: Code style Typescript
Expand Down Expand Up @@ -94,6 +97,9 @@ jobs:
- name: Install node_modules (example/)
run: yarn install --frozen-lockfile --cwd example

- name: Install node_modules (integration_test/)
run: yarn install --frozen-lockfile --cwd integration_test

- name: Compile TypeScript
run: yarn typescript

Expand All @@ -117,6 +123,9 @@ jobs:
- name: Install node_modules (example/)
run: yarn install --frozen-lockfile --cwd example

- name: Install node_modules (integration_test/)
run: yarn install --frozen-lockfile --cwd integration_test

- name: Build docs
run: yarn docs

Expand Down Expand Up @@ -146,6 +155,9 @@ jobs:
- name: Install node_modules (example/)
run: yarn install --frozen-lockfile --cwd example

- name: Install node_modules (integration_test/)
run: yarn install --frozen-lockfile --cwd integration_test

- name: Set up Gradle cache
uses: gradle/gradle-build-action@v2
with:
Expand Down Expand Up @@ -200,7 +212,6 @@ jobs:
working-directory: example/ios
env:
CP_HOME_DIR: ${{ github.workspace }}/.cocoapods-cache
NO_FLIPPER: 1

- name: Save Pods cache
if: steps.pods-cache-restore.outputs.cache-hit != 'true'
Expand Down
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ android.iml

# Cocoapods
#
example/ios/Pods/
*/ios/Pods/

# node.js
#
Expand Down
1 change: 1 addition & 0 deletions .npmignore
Original file line number Diff line number Diff line change
Expand Up @@ -66,3 +66,4 @@ android/.settings
.eslintignore
type-test.ts
example/
integration_test/
3 changes: 3 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,7 @@ node_modules/
example/node_modules/
example/ios/
example/ios/Pods/
integration_test/node_modules/
integration_test/ios/
integration_test/ios/Pods/
.github/*.md
4 changes: 4 additions & 0 deletions .swiftlint.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
excluded:
# folders that are excluded from linting, external dependencies or generated files
- ${PWD}/node_modules
- ${PWD}/example/ios/Pods
- ${PWD}/example/node_modules
- ${PWD}/integration_test/ios/Pods
- ${PWD}/integration_test/node_modules

disabled_rules:
- todo
Expand Down
6 changes: 3 additions & 3 deletions Brewfile.lock.json
Original file line number Diff line number Diff line change
Expand Up @@ -50,11 +50,11 @@
"system": {
"macos": {
"sonoma": {
"HOMEBREW_VERSION": "4.1.15",
"HOMEBREW_VERSION": "4.1.20",
"HOMEBREW_PREFIX": "/opt/homebrew",
"Homebrew/homebrew-core": "api",
"CLT": "15.0.0.0.1.1694021235",
"Xcode": "15.0",
"CLT": "",
"Xcode": "15.0.1",
"macOS": "14.0"
}
}
Expand Down
14 changes: 14 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,21 @@
# Changelog

## [unreleased]

### Changed

- React Native version to `0.72.6`
- React Native peer dependency version to `0.65.0+`
- Update Bitmovin's native Android SDK version to `3.53.0`

## [0.14.2] (2023-11-27)

### Added

- Player (E2E) tests for Android and iOS can now be executed via `yarn integration-test test:android` and `yarn integration-test test:ios` respectively

## [Unreleased]

### Fixed

- Android: `onEvent` callback not being called on `PlayerView`
Expand Down
67 changes: 61 additions & 6 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ To build and run the example app on iOS:
yarn example ios
```

To edit the Swift/Objective-C files, open `example/ios/BitmovinPlayerReactNativeExample.xcworkspace` in XCode and find the source files at `Pods > Development Pods > RNBitmovinPlayer`.
To edit the Swift/Objective-C files, open `example/ios/BitmovinPlayerReactNativeExample.xcworkspace` in Xcode and find the source files at `Pods > Development Pods > RNBitmovinPlayer`.

To edit the Kotlin files, open `example/android` in Android Studio and find the source files at `bitmovin-player-react-native` under `Android`.

Expand Down Expand Up @@ -122,10 +122,57 @@ swiftlint lint --autocorrect

## Testing

Remember to add tests for your change if possible. Run the unit tests by:
Remember to add tests for your change if possible. Run the player tests by:

```sh
yarn test
yarn integration-test test:android
yarn integration-test test:ios
```

To set the license key to be used for the tests, you can set the key `"licenseKey"` in `integration_test/app.json`.

See available API for testing [here](/integration_test/playertesting/PlayerTesting.ts).

### Adding new tests

To add new tests:

1. create a new file in the `specs/` folder.
1. import the new file to the `specs/index.ts` file and add it to the default exported array.

A Player Test has the following structure always:

```ts
export default (spec: TestScope) => {
spec.describe('SCENARIO TO TEST', () => {
spec.it('EXPECTATION', async () => {
await startPlayerTest({}, async () => {
// TEST CODE
});
});
});
};
```

For example:

```ts
export default (spec: TestScope) => {
spec.describe('playing a source', () => {
spec.it('emits TimeChanged events', async () => {
await startPlayerTest({}, async () => {
await loadSourceConfig({
url: 'https://bitmovin-a.akamaihd.net/content/MI201109210084_1/m3u8s/f08e80da-bf1d-4e3d-8899-f0f6155f6efa.m3u8',
type: SourceType.HLS,
});
await callPlayerAndExpectEvents((player) => {
player.play();
}, EventSequence(EventType.Play, EventType.Playing));
await expectEvents(RepeatedEvent(EventType.TimeChanged, 5));
});
});
});
};
```

## Commit message convention
Expand All @@ -145,12 +192,20 @@ Our pre-commit hooks verify that your commit message matches this format when co

The `package.json` file contains various scripts for common tasks:

- `yarn bootstrap`: setup project by installing all dependencies and pods.
- `yarn pods`: install pods only.
- `yarn bootstrap`: setup the whole project by installing all dependencies and pods.
- `yarn bootstrap:example`: setup example project by installing all dependencies and pods.
- `yarn bootstrap:integration-test`: setup integration tests project by installing all dependencies and pods.
- `yarn build`: compile TypeScript files into `lib/` with ESBuild.
- `yarn typescript`: type-check files with TypeScript.
- `yarn lint`: lint files with ESLint.
- `yarn test`: run unit tests with Jest.
- `yarn format`: format files with Prettier.
- `yarn docs`: generate documentation with TypeDoc.
- `yarn brew`: install all dependencies for iOS development with Homebrew.
- `yarn example start`: start the Metro server for the example app.
- `yarn example android`: run the example app on Android.
- `yarn example pods`: install pods only.
- `yarn integration-test start`: start the Metro server for the integration tests.
- `yarn integration-test test:android`: run the player tests on Android emulator.
- `yarn integration-test test:ios`: run the player tests on iOS simulator.
- `yarn integration-test pods`: install pods only.
- `yarn example ios`: run the example app on iOS.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ This is an open-source project created to enable customers to integrate the Bitm

## Platform Support

This library requires at least React Native 0.64+ and React 17+ to work properly. The **officially supported** platforms are:
This library requires at least React Native 0.65+ and React 17+ to work properly. The **officially supported** platforms are:

- **iOS/iPadOS/tvOS:** 14.0+
- **Android:** 5.0+
Expand Down
2 changes: 1 addition & 1 deletion RNBitmovinPlayer.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ Pod::Spec.new do |s|
s.source_files = "ios/**/*.{h,m,mm,swift}"

s.dependency "React-Core"
s.dependency "BitmovinPlayer", "3.50.0"
s.dependency "BitmovinPlayer", "3.51.0"
s.ios.dependency "GoogleAds-IMA-iOS-SDK", "3.18.4"
s.tvos.dependency "GoogleAds-IMA-tvOS-SDK", "4.8.2"
end
96 changes: 69 additions & 27 deletions android/build.gradle
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
buildscript {
ext {
kotlinVersion = '1.7.21'
androidToolsVersion = '7.4.2'
ktlintVersion = '11.6.0'
}
// Buildscript is evaluated before everything else so we can't use getExtOrDefault
def kotlin_version = rootProject.ext.has("kotlinVersion") ? rootProject.ext.get("kotlinVersion") : project.properties["BitmovinPlayerReactNative_kotlinVersion"]
def ktlint_version = rootProject.ext.has("ktlintVersion") ? rootProject.ext.get("ktlintVersion") : project.properties["BitmovinPlayerReactNative_ktlintVersion"]
def android_tools_version = rootProject.ext.has("androidToolsVersion") ? rootProject.ext.get("androidToolsVersion") : project.properties["BitmovinPlayerReactNative_androidToolsVersion"]

repositories {
google()
mavenCentral()
Expand All @@ -12,54 +12,96 @@ buildscript {
}
}
dependencies {
classpath "com.android.tools.build:gradle:$androidToolsVersion"
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlinVersion"
classpath "org.jlleitschuh.gradle:ktlint-gradle:$ktlintVersion"
classpath "com.android.tools.build:gradle:$android_tools_version"
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath "org.jlleitschuh.gradle:ktlint-gradle:$ktlint_version"
}
}

def isNewArchitectureEnabled() {
return rootProject.hasProperty("newArchEnabled") && rootProject.getProperty("newArchEnabled") == "true"
}

apply plugin: 'com.android.library'
apply plugin: 'kotlin-android'
apply plugin: 'org.jlleitschuh.gradle.ktlint'

repositories {
mavenLocal()
maven {
// All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
url "$rootDir/../node_modules/react-native/android"
}
google()
mavenCentral()
maven { url 'https://artifacts.bitmovin.com/artifactory/public-releases' }
if (isNewArchitectureEnabled()) {
apply plugin: "com.facebook.react"
}

def getExtOrDefault(name) {
return rootProject.ext.has(name) ? rootProject.ext.get(name) : project.properties["BitmovinPlayerReactNative_" + name]
}

def getExtOrIntegerDefault(name) {
return rootProject.ext.has(name) ? rootProject.ext.get(name) : (project.properties["BitmovinPlayerReactNative_" + name]).toInteger()
}

def supportsNamespace() {
def parsed = com.android.Version.ANDROID_GRADLE_PLUGIN_VERSION.tokenize('.')
def major = parsed[0].toInteger()
def minor = parsed[1].toInteger()

// Namespace support was added in 7.3.0
return (major == 7 && minor >= 3) || major >= 8
}

android {
compileSdk 33
if (supportsNamespace()) {
namespace "com.bitmovin.player.reactnative"

sourceSets {
main {
manifest.srcFile "src/main/AndroidManifestNew.xml"
}
}
}

compileSdkVersion getExtOrIntegerDefault("compileSdkVersion")

defaultConfig {
minSdkVersion 21
targetSdkVersion 33
versionCode 1
versionName '1.0'
minSdkVersion getExtOrIntegerDefault("minSdkVersion")
targetSdkVersion getExtOrIntegerDefault("targetSdkVersion")

}

buildTypes {
release {
minifyEnabled false
}
}

lintOptions {
disable 'GradleCompatible'
disable "GradleCompatible"
}

compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}

buildFeatures {
buildConfig true
}
}

repositories {
google()
mavenCentral()
}

def kotlin_version = getExtOrDefault("kotlinVersion")

dependencies {
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlinVersion"
implementation 'com.google.ads.interactivemedia.v3:interactivemedia:3.31.0'
implementation 'com.google.android.gms:play-services-ads-identifier:18.0.1'
implementation 'com.bitmovin.player:player:3.51.0+jason'
// For < 0.71, this will be from the local maven repo
// For > 0.71, this will be replaced by `com.facebook.react:react-android:$version` by react gradle plugin
//noinspection GradleDynamicVersion
implementation 'com.facebook.react:react-native:+' // From node_modules
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"

// Bitmovin
implementation 'com.google.ads.interactivemedia.v3:interactivemedia:3.31.0'
implementation 'com.google.android.gms:play-services-ads-identifier:18.0.1'
implementation 'com.bitmovin.player:player:3.53.0+jason'
}
7 changes: 7 additions & 0 deletions android/gradle.properties
Original file line number Diff line number Diff line change
@@ -1 +1,8 @@
android.useAndroidX=true
BitmovinPlayerReactNative_kotlinVersion=1.7.0
BitmovinPlayerReactNative_minSdkVersion=21
BitmovinPlayerReactNative_targetSdkVersion=33
BitmovinPlayerReactNative_compileSdkVersion=33
BitmovinPlayerReactNative_ndkversion=21.4.7075529
BitmovinPlayerReactNative_androidToolsVersion=7.4.2
BitmovinPlayerReactNative_ktlintVersion=11.6.0
2 changes: 2 additions & 0 deletions android/src/main/AndroidManifestNew.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
</manifest>
Loading

0 comments on commit 2d85db8

Please sign in to comment.