Skip to content

Commit

Permalink
chore: rework examples (#4225)
Browse files Browse the repository at this point in the history
* remove unused examples

* init bare example with test app

* add react-native-video

* add test app suport in expo plugin

* expo plugin: skip keys that are already in pod file

* fix podfile

* add src files

* fix metro config

* finalize react native test app configuration

* init expo example

* remove old examples

* add guide for example

* Add link to examples apps in docs

* adopt bare example to CI tests

* update CI workflows

* CI build lib after node_modules install

* fix examples readme

* fix iOS CI

* Add Example for DRM

* Update examples/README.md

* fix links

* update examples README

* sync example code

* update README
  • Loading branch information
KrzysztofMoch authored Oct 20, 2024
1 parent 7c7d83b commit 9eb5502
Show file tree
Hide file tree
Showing 445 changed files with 5,505 additions and 106,900 deletions.
44 changes: 30 additions & 14 deletions .github/workflows/build-android.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,16 @@ on:
paths:
- '.github/workflows/build-android.yml'
- 'android/**'
- 'examples/basic/android/**'
- 'examples/bare/android/**'
- 'yarn.lock'
- 'examples/basic/yarn.lock'
- 'examples/bare/yarn.lock'
pull_request:
paths:
- '.github/workflows/build-android.yml'
- 'android/**'
- 'examples/basic/android/**'
- 'examples/bare/android/**'
- 'yarn.lock'
- 'examples/basic/yarn.lock'
- 'examples/bare/yarn.lock'

jobs:
build:
Expand All @@ -32,10 +32,18 @@ jobs:
java-version: 17
java-package: jdk

- name: Install node_modules
- name: Install node_modules at Root
uses: ./.github/actions/setup-node
with:
working-directory: examples/basic
working-directory: ./

- name: Build Library
run: yarn build

- name: Install node_modules at Example
uses: ./.github/actions/setup-node
with:
working-directory: examples/bare

- name: Restore Gradle cache
uses: actions/cache@v3
Expand All @@ -46,11 +54,11 @@ jobs:
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}
restore-keys: |
${{ runner.os }}-gradle-
- name: Run Gradle Build for basic example
run: cd examples/basic/android && ./gradlew assembleDebug --build-cache && cd ../../..
- name: Run Gradle Build for bare example
run: cd examples/bare/android && ./gradlew assembleDebug --build-cache && cd ../../..

build-without-ads:
name: Build Android Example App Without Ads
build-with-ads:
name: Build Android Example App With Ads
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
Expand All @@ -62,10 +70,18 @@ jobs:
java-version: 17
java-package: jdk

- name: Install node_modules
- name: Install node_modules at Root
uses: ./.github/actions/setup-node
with:
working-directory: ./

- name: Build Library
run: yarn build

- name: Install node_modules at Example
uses: ./.github/actions/setup-node
with:
working-directory: examples/basic
working-directory: examples/bare

- name: Restore Gradle cache
uses: actions/cache@v3
Expand All @@ -76,5 +92,5 @@ jobs:
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}
restore-keys: |
${{ runner.os }}-gradle-
- name: Run Gradle Build for basic example
run: cd examples/basic/android && export RNV_SAMPLE_ENABLE_ADS=false && ./gradlew assembleDebug --build-cache && cd ../../..
- name: Run Gradle Build for bare example
run: cd examples/bare/android && export RNV_SAMPLE_ENABLE_ADS=true && ./gradlew assembleDebug --build-cache && cd ../../..
91 changes: 68 additions & 23 deletions .github/workflows/build-ios.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,28 +9,37 @@ on:
- '.github/workflows/build-ios.yml'
- 'ios/**'
- '*.podspec'
- 'examples/basic/ios/**'
- 'examples/bare/ios/**'
pull_request:
paths:
- '.github/workflows/build-ios.yml'
- 'ios/**'
- '*.podspec'
- 'examples/basic/ios/**'
- 'examples/bare/ios/**'

jobs:
build:
name: Build iOS Example App
runs-on: macos-14 # This allow us to use Xcode 15.0.1 which is a lot faster - TODO change to "macos-latest" once it's out of beta
runs-on: macos-latest
defaults:
run:
working-directory: examples/basic/ios
working-directory: examples/bare/ios
steps:
- uses: actions/checkout@v4

- name: Install node_modules
- name: Install node_modules at Root
uses: ./.github/actions/setup-node
with:
working-directory: examples/basic
working-directory: ./

- name: Build Library
working-directory: ./
run: yarn build

- name: Install node_modules at Example
uses: ./.github/actions/setup-node
with:
working-directory: examples/bare

- name: Restore buildcache
uses: mikehardy/buildcache-action@v2
Expand All @@ -46,21 +55,27 @@ jobs:
uses: actions/cache@v3
with:
path: |
examples/basic/ios/Pods
examples/bare/ios/Pods
~/Library/Caches/CocoaPods
~/.cocoapods
key: ${{ runner.os }}-pods-${{ hashFiles('**/Podfile.lock') }}
restore-keys: |
${{ runner.os }}-pods-
- name: Generate Native Project
run: pod install

- name: Install Pods
run: pod install

- name: Install xcpretty
run: gem install xcpretty

- name: Build App
run: "set -o pipefail && xcodebuild \
-derivedDataPath build -UseModernBuildSystem=YES \
-workspace videoplayer.xcworkspace \
-scheme videoplayer \
-workspace BareExample.xcworkspace \
-scheme BareExample \
-sdk iphonesimulator \
-configuration Debug \
-destination 'platform=iOS Simulator,name=iPhone 14' \
Expand All @@ -69,17 +84,26 @@ jobs:

build-with-ads:
name: Build iOS Example App With Ads
runs-on: macos-14 # This allow us to use Xcode 15.0.1 which is a lot faster - TODO change to "macos-latest" once it's out of beta
runs-on: macos-latest
defaults:
run:
working-directory: examples/basic/ios
working-directory: examples/bare/ios
steps:
- uses: actions/checkout@v4

- name: Install node_modules
- name: Install node_modules at Root
uses: ./.github/actions/setup-node
with:
working-directory: ./

- name: Build Library
working-directory: ./
run: yarn build

- name: Install node_modules at Example
uses: ./.github/actions/setup-node
with:
working-directory: examples/basic
working-directory: examples/bare

- name: Restore buildcache
uses: mikehardy/buildcache-action@v2
Expand All @@ -95,21 +119,27 @@ jobs:
uses: actions/cache@v3
with:
path: |
examples/basic/ios/Pods
examples/bare/ios/Pods
~/Library/Caches/CocoaPods
~/.cocoapods
key: ${{ runner.os }}-pods-${{ hashFiles('**/Podfile.lock') }}
restore-keys: |
${{ runner.os }}-pods-
- name: Generate Native Project
run: export RNV_SAMPLE_ENABLE_ADS=true && pod install

- name: Install Pods
run: export RNV_SAMPLE_ENABLE_ADS=true && pod install

- name: Install xcpretty
run: gem install xcpretty

- name: Build App
run: "set -o pipefail && export RNV_SAMPLE_ENABLE_ADS=true && xcodebuild \
-derivedDataPath build -UseModernBuildSystem=YES \
-workspace videoplayer.xcworkspace \
-scheme videoplayer \
-workspace BareExample.xcworkspace \
-scheme BareExample \
-sdk iphonesimulator \
-configuration Debug \
-destination 'platform=iOS Simulator,name=iPhone 14' \
Expand All @@ -118,17 +148,26 @@ jobs:

build-with-caching:
name: Build iOS Example App With Caching
runs-on: macos-14 # This allow us to use Xcode 15.0.1 which is a lot faster - TODO change to "macos-latest" once it's out of beta
runs-on: macos-latest
defaults:
run:
working-directory: examples/basic/ios
working-directory: examples/bare/ios
steps:
- uses: actions/checkout@v4

- name: Install node_modules
- name: Install node_modules at Root
uses: ./.github/actions/setup-node
with:
working-directory: examples/basic
working-directory: ./

- name: Build Library
working-directory: ./
run: yarn build

- name: Install node_modules at Example
uses: ./.github/actions/setup-node
with:
working-directory: examples/bare

- name: Restore buildcache
uses: mikehardy/buildcache-action@v2
Expand All @@ -144,21 +183,27 @@ jobs:
uses: actions/cache@v3
with:
path: |
examples/basic/ios/Pods
examples/bare/ios/Pods
~/Library/Caches/CocoaPods
~/.cocoapods
key: ${{ runner.os }}-pods-${{ hashFiles('**/Podfile.lock') }}
restore-keys: |
${{ runner.os }}-pods-
- name: Generate Native Project
run: export RNV_SAMPLE_VIDEO_CACHING=true && pod install

- name: Install Pods
run: export RNV_SAMPLE_VIDEO_CACHING=true && pod install

- name: Install xcpretty
run: gem install xcpretty

- name: Build App
run: "set -o pipefail && export RNV_SAMPLE_VIDEO_CACHING=true && xcodebuild \
-derivedDataPath build -UseModernBuildSystem=YES \
-workspace videoplayer.xcworkspace \
-scheme videoplayer \
-workspace BareExample.xcworkspace \
-scheme BareExample \
-sdk iphonesimulator \
-configuration Debug \
-destination 'platform=iOS Simulator,name=iPhone 14' \
Expand Down
5 changes: 5 additions & 0 deletions docs/pages/_meta.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,10 @@
"type": "separator",
"title": ""
},
"example_apps": {
"title": "Example Apps",
"newWindow": true,
"href": "https://github.com/TheWidlarzGroup/react-native-video/tree/master/examples"
},
"projects": "Useful projects"
}
6 changes: 0 additions & 6 deletions examples/FabricExample/.buckconfig

This file was deleted.

2 changes: 0 additions & 2 deletions examples/FabricExample/.bundle/config

This file was deleted.

16 changes: 0 additions & 16 deletions examples/FabricExample/.eslintrc.js

This file was deleted.

67 changes: 0 additions & 67 deletions examples/FabricExample/.gitignore

This file was deleted.

Loading

0 comments on commit 9eb5502

Please sign in to comment.