-
Notifications
You must be signed in to change notification settings - Fork 152
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: updated build tests to run on pull request
- Loading branch information
Showing
6 changed files
with
175 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,129 @@ | ||
name: Main tests | ||
|
||
on: | ||
pull_request: | ||
branches: | ||
- master | ||
|
||
jobs: | ||
|
||
setup: | ||
name: Setup code and environment needed for building, linting and tests | ||
runs-on: macos-latest | ||
timeout-minutes: 15 | ||
steps: | ||
- name: Check out Git repository | ||
uses: actions/checkout@v3 | ||
|
||
- name: Set up Node environment | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version: 16 | ||
|
||
- name: Cache Java | ||
uses: actions/setup-java@v3 | ||
with: | ||
java-version: "11" | ||
distribution: "adopt" | ||
cache: "gradle" | ||
|
||
# Workaround for https://github.com/actions/setup-java/issues/65 | ||
- name: Backup JAVA_HOME | ||
id: java-home | ||
run: echo "::set-output name=path::$JAVA_HOME" | ||
|
||
- name: Validate Gradle wrapper | ||
uses: gradle/wrapper-validation-action@v1 | ||
|
||
- name: Cache module node modules | ||
uses: actions/cache@v3 | ||
id: cache-node-modules | ||
with: | ||
path: node_modules | ||
key: yarn-${{ hashFiles('yarn.lock') }} | ||
|
||
- name: Cache Example application node modules | ||
uses: actions/cache@v3 | ||
id: cache-app-node-modules | ||
with: | ||
path: ./Example/node_modules | ||
key: yarn-${{ hashFiles('Example/yarn.lock') }} | ||
|
||
- name: Cache application pods | ||
uses: actions/cache@v3 | ||
id: cache-app-pods | ||
with: | ||
path: ./Example/ios/Pods | ||
key: pods-${{ hashFiles('Example/ios/Podfile.lock') }} | ||
|
||
- name: Install node modules if cache not present | ||
run: yarn install --immutable | ||
if: steps.cache-node-modules.outputs.cache-hit != 'true' | ||
|
||
- name: Install application node modules if cache not present | ||
run: cd ./Example && yarn install --immutable | ||
if: steps.cache-app-node-modules.outputs.cache-hit != 'true' | ||
|
||
- name: Install application pods if cache not present | ||
run: cd ./Example/ios && pod repo update && pod install | ||
if: steps.cache-app-pods.outputs.cache-hit != 'true' | ||
|
||
lint: | ||
runs-on: ubuntu-latest | ||
needs: setup | ||
timeout-minutes: 5 | ||
steps: | ||
- name: Check out Git repository | ||
uses: actions/checkout@v3 | ||
|
||
- name: Restore node modules from cache | ||
uses: actions/cache@v3 | ||
with: | ||
path: node_modules | ||
key: yarn-${{ hashFiles('yarn.lock') }} | ||
|
||
- name: Lint | ||
run: yarn lint | ||
|
||
test: | ||
runs-on: ubuntu-latest | ||
needs: setup | ||
timeout-minutes: 5 | ||
steps: | ||
- name: Check out Git repository | ||
uses: actions/checkout@v3 | ||
|
||
- name: Restore node modules from cache | ||
uses: actions/cache@v3 | ||
with: | ||
path: node_modules | ||
key: yarn-${{ hashFiles('yarn.lock') }} | ||
|
||
- name: Run tests | ||
run: yarn test | ||
|
||
build-android: | ||
runs-on: ubuntu-latest | ||
needs: [setup] | ||
timeout-minutes: 10 | ||
steps: | ||
- name: Check out Git repository | ||
uses: actions/checkout@v3 | ||
|
||
- name: Restore node modules from cache | ||
uses: actions/cache@v3 | ||
with: | ||
path: node_modules | ||
key: yarn-${{ hashFiles('yarn.lock') }} | ||
|
||
- name: Restore application node modules from cache | ||
uses: actions/cache@v3 | ||
with: | ||
path: ./Example/node_modules | ||
key: yarn-${{ hashFiles('Example/yarn.lock') }} | ||
|
||
- name: Build example application | ||
run: | | ||
export JAVA_HOME=${{ steps.java-home.outputs.JAVA_HOME }} | ||
cd ./Example/android | ||
./gradlew assembleDebug |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,27 @@ | ||
import { NativeModules } from "react-native"; | ||
|
||
const { RNRestart } = NativeModules; | ||
const { RNRestart: rnRestart } = NativeModules; | ||
|
||
type RestartType = { | ||
/** | ||
* @deprecated use `restart` instead | ||
*/ | ||
Restart(): void; | ||
restart(): void; | ||
getReason(): Promise<string>; | ||
}; | ||
|
||
export default RNRestart as RestartType; | ||
const Restart = (reason?: string) => { | ||
if (!reason) { | ||
rnRestart.Restart(null); | ||
} else { | ||
rnRestart.Restart(reason); | ||
} | ||
}; | ||
const RNRestart: RestartType = { | ||
...rnRestart, | ||
restart: Restart, | ||
Restart, | ||
}; | ||
|
||
export default RNRestart; |