Skip to content

Commit

Permalink
chore: init react-native-jsi-base-coder
Browse files Browse the repository at this point in the history
  • Loading branch information
jeremybarbet committed May 9, 2022
0 parents commit 4ad48fd
Show file tree
Hide file tree
Showing 100 changed files with 18,108 additions and 0 deletions.
20 changes: 20 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
module.exports = {
extends: ['plugin:@typescript-eslint/recommended', 'prettier'],
parser: '@typescript-eslint/parser',
plugins: ['@typescript-eslint', 'prettier', 'simple-import-sort'],
ignorePatterns: ['.eslintrc.js'],
rules: {
'simple-import-sort/imports': [
'error',
{
groups: [
['^\\u0000'],
['^react', '^@?\\w'],
['^(utils)(/.*|$)'],
['^\\.\\.(?!/?$)', '^\\.\\./?$'],
['^\\./(?=.*/)(?!/?$)', '^\\.(?!/?$)', '^\\./?$'],
],
},
],
},
};
2 changes: 2 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Auto detect text files and perform LF normalization
* text=auto
65 changes: 65 additions & 0 deletions .github/workflows/build-android.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
name: Build Android

on:
push:
branches:
- main
paths:
- '.github/workflows/build-android.yml'
- 'android/**'
- 'example/android/**'
- 'yarn.lock'
- 'example/yarn.lock'

pull_request:
paths:
- '.github/workflows/build-android.yml'
- 'android/**'
- 'example/android/**'
- 'yarn.lock'
- 'example/yarn.lock'

jobs:
build_example:
name: Build Android Example App
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2

- name: Setup JDK 1.8
uses: actions/setup-java@v1
with:
java-version: 1.8

- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "::set-output name=dir::$(yarn cache dir)"

- name: Restore node_modules from cache
uses: actions/cache@v2
id: yarn-cache
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: ${{ runner.os }}-yarn-

- name: Install node_modules
run: yarn install --frozen-lockfile

- name: Install node_modules for example/
run: yarn install --frozen-lockfile --cwd example

- name: Restore Gradle cache
uses: actions/cache@v2
with:
path: |
~/.gradle/caches
~/.gradle/wrapper
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}
restore-keys: ${{ runner.os }}-gradle-

- name: Run Gradle Build for android/
run: cd android && ./gradlew assembleDebug --build-cache && cd ..

- name: Run Gradle Build for example/android/
run: cd example/android && ./gradlew assembleDebug --build-cache && cd ../..
83 changes: 83 additions & 0 deletions .github/workflows/build-ios.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
name: Build iOS

on:
push:
branches:
- main
paths:
- '.github/workflows/build-ios.yml'
- 'ios/**'
- '*.podspec'
- 'example/ios/**'

pull_request:
paths:
- '.github/workflows/build-ios.yml'
- 'ios/**'
- '*.podspec'
- 'example/ios/**'

jobs:
build:
name: Build iOS Example App
runs-on: macOS-latest
defaults:
run:
working-directory: example/ios

steps:
- uses: actions/checkout@v2

- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "::set-output name=dir::$(yarn cache dir)"

- name: Restore node_modules from cache
uses: actions/cache@v2
id: yarn-cache
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: ${{ runner.os }}-yarn-

- name: Install node_modules for example/
run: yarn install --frozen-lockfile --cwd ..

- name: Restore buildcache
uses: mikehardy/buildcache-action@v1
continue-on-error: true

- name: Setup Ruby (bundle)
uses: ruby/setup-ruby@v1
with:
ruby-version: 2.6
bundler-cache: true
working-directory: example/ios

- name: Restore Pods cache
uses: actions/cache@v2
with:
path: |
example/ios/Pods
~/Library/Caches/CocoaPods
~/.cocoapods
key: ${{ runner.os }}-pods-${{ hashFiles('**/Podfile.lock') }}
restore-keys: ${{ runner.os }}-pods-

- name: Install Pods
run: bundle exec pod check || bundle exec pod install

- name: Install xcpretty
run: gem install xcpretty

- name: Build App
run: "set -o pipefail && xcodebuild \
CC=clang CPLUSPLUS=clang++ LD=clang LDPLUSPLUS=clang++ \
-derivedDataPath build -UseModernBuildSystem=YES \
-workspace BaseCoderExample.xcworkspace \
-scheme BaseCoderExample \
-sdk iphonesimulator \
-configuration Debug \
-destination 'platform=iOS Simulator,name=iPhone 11 Pro' \
build \
CODE_SIGNING_ALLOWED=NO | xcpretty"
21 changes: 21 additions & 0 deletions .github/workflows/notice-yarn-changes.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
name: Notice yarn.lock changes

on: [pull_request]

jobs:
check:
runs-on: ubuntu-latest
permissions:
pull-requests: write
steps:
- name: Checkout
uses: actions/checkout@v2

- name: Notice yarn.lock changes
uses: Simek/yarn-lock-changes@main
with:
token: ${{ secrets.GITHUB_TOKEN }}
collapsibleThreshold: '25'
failOnDowngrade: 'false'
path: 'yarn.lock'
updateComment: 'true'
64 changes: 64 additions & 0 deletions .github/workflows/validate-android.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
name: Validate Android

on:
push:
branches:
- main
paths:
- '.github/workflows/validate-android.yml'
- 'android/**'
- '.editorconfig'
pull_request:
paths:
- '.github/workflows/validate-android.yml'
- 'android/**'
- '.editorconfig'

jobs:
lint:
name: Gradle Lint
runs-on: ubuntu-latest
defaults:
run:
working-directory: ./android
steps:
- uses: actions/checkout@v2
- name: Setup JDK 1.8
uses: actions/setup-java@v1
with:
java-version: 1.8

- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "::set-output name=dir::$(yarn cache dir)"

- name: Restore node_modules from cache
uses: actions/cache@v2
id: yarn-cache
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: ${{ runner.os }}-yarn-

- name: Install node_modules
run: yarn install --frozen-lockfile --cwd ..

- name: Install node_modules for example/
run: yarn install --frozen-lockfile --cwd ../example

- name: Restore Gradle cache
uses: actions/cache@v2
with:
path: |
~/.gradle/caches
~/.gradle/wrapper
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}
restore-keys: ${{ runner.os }}-gradle-

- name: Run Gradle Lint
run: ./gradlew lint --build-cache

- name: Parse Gradle Lint Report
uses: yutailang0119/[email protected]
with:
xml_path: android/build/reports/lint-results.xml
36 changes: 36 additions & 0 deletions .github/workflows/validate-cpp.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: Validate C++

on:
push:
branches:
- main
paths:
- '.github/workflows/validate-cpp.yml'
- 'cpp/**'
- 'android/src/main/cpp/**'

pull_request:
paths:
- '.github/workflows/validate-cpp.yml'
- 'cpp/**'
- 'android/src/main/cpp/**'

jobs:
lint:
name: cpplint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2

- uses: reviewdog/action-cpplint@master
with:
github_token: ${{ secrets.github_token }}
reporter: github-pr-review
flags: --linelength=230
targets: --recursive cpp android/src/main/cpp
filter: "-legal/copyright\
,-readability/todo\
,-build/namespaces\
,-whitespace/comments\
,-build/include_order\
"
100 changes: 100 additions & 0 deletions .github/workflows/validate-js.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
name: Validate JS

on:
push:
branches:
- main
paths:
- '.github/workflows/validate-js.yml'
- 'src/**'
- '*.json'
- '*.js'
- '*.lock'
- 'example/src/**'
- 'example/*.json'
- 'example/*.js'
- 'example/*.lock'
- 'example/*.tsx'

pull_request:
paths:
- '.github/workflows/validate-js.yml'
- 'src/**'
- '*.json'
- '*.js'
- '*.lock'
- 'example/src/**'
- 'example/*.json'
- 'example/*.js'
- 'example/*.lock'
- 'example/*.tsx'

jobs:
compile:
name: Compile JS (tsc)
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2

- name: Install reviewdog
uses: reviewdog/action-setup@v1

- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "::set-output name=dir::$(yarn cache dir)"

- name: Restore node_modules from cache
uses: actions/cache@v2
id: yarn-cache
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: ${{ runner.os }}-yarn-

- name: Install node_modules
run: yarn install --frozen-lockfile

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

- name: Run TypeScript # Reviewdog tsc errorformat: %f:%l:%c - error TS%n: %m
run: |
yarn typescript | reviewdog -name="tsc" -efm="%f(%l,%c): error TS%n: %m" -reporter="github-pr-review" -filter-mode="nofilter" -fail-on-error -tee
env:
REVIEWDOG_GITHUB_API_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Run TypeScript in example/ # Reviewdog tsc errorformat: %f:%l:%c - error TS%n: %m
run: |
cd example && yarn typescript | reviewdog -name="tsc" -efm="%f(%l,%c): error TS%n: %m" -reporter="github-pr-review" -filter-mode="nofilter" -fail-on-error -tee && cd ..
env:
REVIEWDOG_GITHUB_API_TOKEN: ${{ secrets.GITHUB_TOKEN }}

lint:
name: Lint JS (eslint, prettier)
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2

- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "::set-output name=dir::$(yarn cache dir)"

- name: Restore node_modules from cache
uses: actions/cache@v2
id: yarn-cache
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: ${{ runner.os }}-yarn-

- name: Install node_modules
run: yarn install --frozen-lockfile

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

- name: Run ESLint
run: yarn lint:ci

- name: Verify no files have changed after auto-fix
run: git diff --exit-code HEAD
Loading

0 comments on commit 4ad48fd

Please sign in to comment.