Skip to content
Merged

lexe #50

Show file tree
Hide file tree
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .githooks/post-checkout
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/bin/sh
command -v git-lfs >/dev/null 2>&1 || { printf >&2 "\n%s\n\n" "This repository is configured for Git LFS but 'git-lfs' was not found on your path. If you no longer wish to use Git LFS, remove this hook by deleting the 'post-checkout' file in the hooks directory (set by 'core.hookspath'; usually '.git/hooks')."; exit 2; }
git lfs post-checkout "$@"
3 changes: 3 additions & 0 deletions .githooks/post-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/bin/sh
command -v git-lfs >/dev/null 2>&1 || { printf >&2 "\n%s\n\n" "This repository is configured for Git LFS but 'git-lfs' was not found on your path. If you no longer wish to use Git LFS, remove this hook by deleting the 'post-commit' file in the hooks directory (set by 'core.hookspath'; usually '.git/hooks')."; exit 2; }
git lfs post-commit "$@"
3 changes: 3 additions & 0 deletions .githooks/post-merge
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/bin/sh
command -v git-lfs >/dev/null 2>&1 || { printf >&2 "\n%s\n\n" "This repository is configured for Git LFS but 'git-lfs' was not found on your path. If you no longer wish to use Git LFS, remove this hook by deleting the 'post-merge' file in the hooks directory (set by 'core.hookspath'; usually '.git/hooks')."; exit 2; }
git lfs post-merge "$@"
3 changes: 3 additions & 0 deletions .githooks/pre-push
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/bin/sh
command -v git-lfs >/dev/null 2>&1 || { printf >&2 "\n%s\n\n" "This repository is configured for Git LFS but 'git-lfs' was not found on your path. If you no longer wish to use Git LFS, remove this hook by deleting the 'pre-push' file in the hooks directory (set by 'core.hookspath'; usually '.git/hooks')."; exit 2; }
git lfs pre-push "$@"
169 changes: 169 additions & 0 deletions .github/workflows/build-react-native-lexe.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,169 @@
name: Build react-native-lni-lexe

on:
pull_request:
paths:
- '.github/workflows/build-react-native-lexe.yml'
- 'Cargo.toml'
- 'crates/lni/**'
- 'bindings/react-native-lexe/**'
push:
branches: [master, main]
tags:
- 'react-native-lni-lexe-v*'
paths:
- '.github/workflows/build-react-native-lexe.yml'
- 'Cargo.toml'
- 'crates/lni/**'
- 'bindings/react-native-lexe/**'
workflow_dispatch:

concurrency:
group: react-native-lni-lexe-${{ github.ref }}
cancel-in-progress: ${{ !startsWith(github.ref, 'refs/tags/') }}

env:
CARGO_TERM_COLOR: always
ANDROID_NDK_VERSION: 27.1.12297006

jobs:
build:
name: Build native package
runs-on: macos-latest
permissions:
contents: read

steps:
# actions/checkout@v4
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5
Comment thread
coderabbitai[bot] marked this conversation as resolved.
Outdated
with:
persist-credentials: false

- name: Setup Node.js
# actions/setup-node@v4
uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020
with:
node-version: '22'

- name: Install Rust targets
# dtolnay/rust-toolchain@stable
uses: dtolnay/rust-toolchain@4be9e76fd7c4901c61fb841f559994984270fce7
with:
toolchain: stable
targets: >-
aarch64-apple-ios,
aarch64-apple-ios-sim,
aarch64-linux-android,
armv7-linux-androideabi,
i686-linux-android,
x86_64-linux-android

- name: Install native build dependencies
run: |
brew install protobuf
cargo install cargo-ndk --version 4.1.2 --locked
"$ANDROID_HOME/cmdline-tools/latest/bin/sdkmanager" "ndk;$ANDROID_NDK_VERSION" >/dev/null
test -d "$ANDROID_HOME/ndk/$ANDROID_NDK_VERSION"
echo "ANDROID_NDK_HOME=$ANDROID_HOME/ndk/$ANDROID_NDK_VERSION" >> "$GITHUB_ENV"
echo "ANDROID_NDK_ROOT=$ANDROID_HOME/ndk/$ANDROID_NDK_VERSION" >> "$GITHUB_ENV"
echo "NDK_HOME=$ANDROID_HOME/ndk/$ANDROID_NDK_VERSION" >> "$GITHUB_ENV"

- name: Install JavaScript dependencies
working-directory: bindings/react-native-lexe
run: |
corepack enable
yarn install --immutable

- name: Verify Rust dependency lockfile
run: cargo metadata --locked --format-version 1 --no-deps >/dev/null

- name: Build iOS and Android bindings
working-directory: bindings/react-native-lexe
run: |
yarn ubrn:ios
yarn ubrn:android
yarn verify:native

- name: Verify generated source is current
run: git diff --exit-code -- bindings/react-native-lexe

- name: Build JavaScript package
working-directory: bindings/react-native-lexe
run: yarn build

- name: Lint and typecheck JavaScript package
working-directory: bindings/react-native-lexe
run: |
yarn lint
yarn typecheck

- name: Link Android example (arm64-v8a)
working-directory: bindings/react-native-lexe
run: yarn verify:android

- name: Validate release tag
if: startsWith(github.ref, 'refs/tags/react-native-lni-lexe-v')
working-directory: bindings/react-native-lexe
run: |
package_version=$(node -p "require('./package.json').version")
tag_version=${GITHUB_REF_NAME#react-native-lni-lexe-v}
if [ "$package_version" != "$tag_version" ]; then
echo "::error::Tag version $tag_version does not match package version $package_version"
exit 1
fi

- name: Create and inspect npm tarball
working-directory: bindings/react-native-lexe
run: |
package_dir="$RUNNER_TEMP/react-native-lni-lexe-package"
mkdir -p "$package_dir"
npm pack --pack-destination "$package_dir"
package=$(find "$package_dir" -maxdepth 1 -name '*.tgz' -print -quit)
test -n "$package"
while IFS= read -r artifact; do
tar -tzf "$package" "package/$artifact" >/dev/null
done < <(node scripts/verify-native-artifacts.mjs --list)

- name: Upload npm tarball
# actions/upload-artifact@v4
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02
with:
name: react-native-lni-lexe-npm
path: ${{ runner.temp }}/react-native-lni-lexe-package/*.tgz
if-no-files-found: error
retention-days: 14

publish:
name: Publish npm package
if: startsWith(github.ref, 'refs/tags/react-native-lni-lexe-v')
needs: build
runs-on: ubuntu-latest
permissions:
contents: read

steps:
- name: Setup Node.js
# actions/setup-node@v4
uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020
with:
node-version: '22'
registry-url: 'https://registry.npmjs.org'

- name: Download npm tarball
# actions/download-artifact@v4
uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093
with:
name: react-native-lni-lexe-npm
path: package

- name: Publish to npm
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
run: |
if [ -z "$NODE_AUTH_TOKEN" ]; then
echo "::error::NPM_TOKEN is not configured"
exit 1
fi
package=$(find package -maxdepth 1 -name '*.tgz' -print -quit)
test -n "$package"
npm publish "$package" --access public
17 changes: 15 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
# Ignore Cargo-specific files
# Keep the workspace lockfile for reproducible CI and release builds.
**/target/
/Cargo.lock

# Ignore Rust-specific files
**/*.rs.bk
Expand Down Expand Up @@ -128,3 +127,17 @@ bindings/lni_react_native/src/generated/**
bindings/lni_react_native/cpp/generated/**

**/lni_react_native_old/**

# Keep the React Native package's Android source tree; the broad Android
# patterns above otherwise hide it.
!bindings/react-native-lexe/android/
!bindings/react-native-lexe/example/android/

# The example uses Gradle's standard per-developer debug signing key. Do not
# commit an additional private key from the generated project scaffold.
bindings/react-native-lexe/example/android/app/debug.keystore

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win

Missing ! prefix to track the debug keystore.

This line explicitly ignores the debug.keystore. In React Native projects, the debug keystore is typically committed to version control so that anyone cloning the repository can build the Android example app out-of-the-box without missing keystore errors or signing mismatches.

Given the context, it appears the ! prefix was accidentally omitted.

♻️ Proposed fix
-bindings/react-native-lexe/example/android/app/debug.keystore
+!bindings/react-native-lexe/example/android/app/debug.keystore
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
bindings/react-native-lexe/example/android/app/debug.keystore
!bindings/react-native-lexe/example/android/app/debug.keystore
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In @.gitignore at line 137, Update the debug.keystore entry in .gitignore to use
the negation prefix, ensuring
bindings/react-native-lexe/example/android/app/debug.keystore is tracked instead
of ignored.


# Release CI builds these and adds them to the npm tarball. They are not
# versioned because each build is hundreds of megabytes across all targets.
bindings/react-native-lexe/ReactNativeLexeFramework.xcframework/
bindings/react-native-lexe/android/src/main/jniLibs/
Loading
Loading