Skip to content

Commit

Permalink
refactor: conversion to nitro modules (margelo#404)
Browse files Browse the repository at this point in the history
  • Loading branch information
boorad authored Aug 15, 2024
1 parent 24783a3 commit e1c779f
Show file tree
Hide file tree
Showing 265 changed files with 6,460 additions and 21,206 deletions.
26 changes: 26 additions & 0 deletions .clang-format
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# Config for clang-format version 16

# Standard
BasedOnStyle: llvm
Standard: c++14

# Indentation
IndentWidth: 2
ColumnLimit: 140

# Includes
SortIncludes: CaseSensitive
SortUsingDeclarations: true

# Pointer and reference alignment
PointerAlignment: Left
ReferenceAlignment: Left
ReflowComments: true

# Line breaking options
BreakBeforeBraces: Attach
BreakConstructorInitializers: BeforeColon
AlwaysBreakTemplateDeclarations: true
AllowShortFunctionsOnASingleLine: Empty
IndentCaseLabels: true
NamespaceIndentation: Inner
8 changes: 7 additions & 1 deletion .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@ version: 2

updates:
- package-ecosystem: "npm"
target-branch: "main"
directory: "/"
schedule:
interval: "daily"
interval: "weekly"
- package-ecosystem: "npm"
target-branch: "0.x"
directory: "/"
schedule:
interval: "weekly"
55 changes: 23 additions & 32 deletions .github/workflows/build-android.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,21 @@ on:
- main
paths:
- '.github/workflows/build-android.yml'
- 'android/**'
- 'packages/react-native-quick-crypto/android/**'
- 'packages/react-native-quick-crypto/nitrogen/generated/android/**'
- 'packages/react-native-quick-crypto/nitrogen/generated/shared/**'
- 'example/android/**'
- 'yarn.lock'
- 'example/yarn.lock'
- 'bun.lockb'
- 'example/bun.lockb'
pull_request:
paths:
- '.github/workflows/build-android.yml'
- 'android/**'
- 'packages/react-native-quick-crypto/android/**'
- 'packages/react-native-quick-crypto/nitrogen/generated/android/**'
- 'packages/react-native-quick-crypto/nitrogen/generated/shared/**'
- 'example/android/**'
- 'yarn.lock'
- 'example/yarn.lock'
- 'bun.lockb'
- 'example/bun.lockb'

jobs:
build_android_example:
Expand All @@ -29,8 +33,10 @@ jobs:
run: |
sudo rm -rf /usr/share/dotnet
sudo rm -rf /opt/ghc
sudo rm -rf "/usr/local/share/boost"
sudo rm -rf "$AGENT_TOOLSDIRECTORY"
- uses: oven-sh/setup-bun@v2
with:
bun-version: 1.1.22

- name: Setup JDK
uses: actions/setup-java@v4
Expand All @@ -41,28 +47,16 @@ jobs:

- name: Setup Android SDK
uses: android-actions/setup-android@v3

- uses: actions/setup-node@v4
with:
node-version: 20
- run: corepack enable
accept-android-sdk-licenses: true
log-accepted-android-sdk-licenses: false
# this cmdline tools version barked the least in GHA runners
# hopefully we can remove it in the future
cmdline-tools-version: 9477386

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

- name: Restore node_modules from cache
uses: actions/cache@v4
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: Bootstrap JS
run: |
bun install
- name: Restore Gradle cache
uses: actions/cache@v4
Expand All @@ -74,8 +68,5 @@ jobs:
restore-keys: |
${{ runner.os }}-gradle-
- name: Run Gradle Build for android/
run: cd android && ./gradlew assembleDebug && cd ..

- name: Run Gradle Build for example/android/
- name: Run Gradle Build for example app
run: cd example/android && ./gradlew assembleDebug --build-cache && cd ../..
38 changes: 17 additions & 21 deletions .github/workflows/build-ios.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,43 +6,34 @@ on:
- main
paths:
- '.github/workflows/build-ios.yml'
- 'ios/**'
- 'packages/react-native-quick-crypto/ios/**'
- 'packages/react-native-quick-crypto/nitrogen/generated/ios/**'
- 'packages/react-native-quick-crypto/nitrogen/generated/shared/**'
- '*.podspec'
- 'example/ios/**'
pull_request:
paths:
- '.github/workflows/build-ios.yml'
- 'ios/**'
- 'packages/react-native-quick-crypto/ios/**'
- 'packages/react-native-quick-crypto/nitrogen/generated/ios/**'
- 'packages/react-native-quick-crypto/nitrogen/generated/shared/**'
- '*.podspec'
- 'example/ios/**'

jobs:
build_ios_example:
name: Build iOS Example App
runs-on: macOS-latest
defaults:
run:
working-directory: example/ios
steps:
- uses: actions/checkout@v4

- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "dir=$(yarn cache dir)" >> $GITHUB_OUTPUT
- name: Restore node_modules from cache
uses: actions/cache@v4
id: yarn-cache
- uses: oven-sh/setup-bun@v2
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 ..
bun-version: 1.1.22

# - name: Restore buildcache
# uses: mikehardy/buildcache-action@v2
# continue-on-error: true
- name: Bootstrap JS
run: |
bun install
- name: Setup Ruby (bundle)
uses: ruby/setup-ruby@v1
Expand All @@ -61,14 +52,19 @@ jobs:
key: ${{ runner.os }}-pods-${{ hashFiles('**/Podfile.lock') }}
restore-keys: |
${{ runner.os }}-pods-
- name: Install Gems
working-directory: example
run: bundle config set deployment 'true' && bundle install

- name: Install Pods
run: yarn pods
run: bun pods

- name: Install xcpretty
run: gem install xcpretty

- name: Build App
working-directory: example/ios
run: "set -o pipefail && xcodebuild \
CC=clang CPLUSPLUS=clang++ LD=clang LDPLUSPLUS=clang++ \
-derivedDataPath build -UseModernBuildSystem=YES \
Expand Down
68 changes: 0 additions & 68 deletions .github/workflows/release-publish.yml

This file was deleted.

50 changes: 15 additions & 35 deletions .github/workflows/validate-android.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,24 +6,25 @@ on:
- main
paths:
- '.github/workflows/validate-android.yml'
- 'android/**'
- 'packages/react-native-quick-crypto/android/**'
- '.editorconfig'
pull_request:
paths:
- '.github/workflows/validate-android.yml'
- 'android/**'
- 'packages/react-native-quick-crypto/android/**'
- '.editorconfig'

jobs:
validate_android:
name: Gradle Lint
runs-on: ubuntu-latest
defaults:
run:
working-directory: ./android
steps:
- uses: actions/checkout@v4

- uses: oven-sh/setup-bun@v2
with:
bun-version: 1.1.22

- name: Setup JDK
uses: actions/setup-java@v4
with:
Expand All @@ -33,28 +34,16 @@ jobs:

- name: Setup Android SDK
uses: android-actions/setup-android@v3

- uses: actions/setup-node@v4
with:
node-version: 20
- run: corepack enable

- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "dir=$(yarn cache dir)" >> $GITHUB_OUTPUT
accept-android-sdk-licenses: true
log-accepted-android-sdk-licenses: false
# this cmdline tools version barked the least in GHA runners
# hopefully we can remove it in the future
cmdline-tools-version: 9477386

- name: Restore node_modules from cache
uses: actions/cache@v4
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: Bootstrap JS
run: |
bun install
- name: Restore Gradle cache
uses: actions/cache@v4
Expand All @@ -67,19 +56,10 @@ jobs:
${{ runner.os }}-gradle-
- name: Run Gradle Lint
run: cd ../example/android && ./gradlew lint
run: cd example/android && ./gradlew lint

- name: Parse Gradle Lint Report
uses: yutailang0119/action-android-lint@v4
with:
# ignore-warnings: true
report-path: example/android/app/build/reports/*.xml
# ktlint:
# name: Kotlin Lint
# runs-on: ubuntu-latest
# steps:
# - uses: actions/checkout@v4
# - name: Run KTLint
# uses: mrousavy/[email protected]
# with:
# github_token: ${{ secrets.github_token }}
14 changes: 8 additions & 6 deletions .github/workflows/validate-cpp.yml
Original file line number Diff line number Diff line change
@@ -1,18 +1,20 @@
name: Validate C++
name: 'Validate C++'

on:
push:
branches:
- main
paths:
- '.github/workflows/validate-cpp.yml'
- 'cpp/**'
- 'android/src/main/cpp/**'
- 'packages/react-native-quick-crypto/android/src/main/cpp/**'
- 'packages/react-native-quick-crypto/cpp/**'
- 'packages/react-native-quick-crypto/nitrogen/generated/shared/**'
pull_request:
paths:
- '.github/workflows/validate-cpp.yml'
- 'cpp/**'
- 'android/src/main/cpp/**'
- 'packages/react-native-quick-crypto/android/src/main/cpp/**'
- 'packages/react-native-quick-crypto/cpp/**'
- 'packages/react-native-quick-crypto/nitrogen/generated/shared/**'

jobs:
validate_cpp:
Expand All @@ -25,7 +27,7 @@ jobs:
github_token: ${{ secrets.github_token }}
reporter: github-pr-review
flags: --linelength=230
targets: --recursive cpp android/src/main/cpp
targets: --recursive packages/react-native-quick-crypto/cpp packages/react-native-quick-crypto/android/src/main/cpp packages/react-native-quick-crypto/nitrogen/generated/shared/c++
filter: "-legal/copyright\
,-readability/todo\
,-build/namespaces\
Expand Down
Loading

0 comments on commit e1c779f

Please sign in to comment.