diff --git a/.github/actions/setup-maestro/action.yml b/.github/actions/setup-maestro/action.yml index efbc604f..fedd25a4 100644 --- a/.github/actions/setup-maestro/action.yml +++ b/.github/actions/setup-maestro/action.yml @@ -5,10 +5,11 @@ runs: steps: - run: | echo "Installing Maestro CLI..." - curl -Ls "https://get.maestro.mobile.dev" | bash + export MAESTRO_VERSION=1.40.0; curl -Ls "https://get.maestro.mobile.dev" | bash # Add Maestro to PATH for subsequent steps - echo "${HOME}/.maestro/bin" >> $GITHUB_PATH + export PATH="$PATH":"$HOME/.maestro/bin" + echo "$HOME/.maestro/bin" >> $GITHUB_PATH # Verify installation maestro --version || echo "Maestro installation verification failed" diff --git a/.github/workflows/ci-packages.yml b/.github/workflows/ci-packages.yml index cb340938..15bf350c 100644 --- a/.github/workflows/ci-packages.yml +++ b/.github/workflows/ci-packages.yml @@ -7,6 +7,7 @@ on: - 'src/**' - '.github/workflows/**' - '.github/actions/**' + - 'scripts/**' - 'package.json' - 'bun.lock' - 'assets/template/**' @@ -16,6 +17,7 @@ on: - 'src/**' - '.github/workflows/**' - '.github/actions/**' + - 'scripts/**' - 'package.json' - 'bun.lock' - 'assets/template/**' @@ -515,12 +517,40 @@ jobs: working-directory: ${{ env.WORKING_DIR }}/example/ios run: pod install + - name: Setup ccache + run: | + brew install ccache + ccache --version + ccache --zero-stats + + - name: Cache ccache + uses: actions/cache@v4 + with: + path: ~/Library/Caches/ccache + key: ${{ runner.os }}-ccache-${{ matrix.package-type }}-${{ github.sha }} + restore-keys: | + ${{ runner.os }}-ccache-${{ matrix.package-type }}- + ${{ runner.os }}-ccache- + + - name: Configure ccache + run: | + ccache --set-config=max_size=2G + ccache --set-config=compression=true + ccache --set-config=compression_level=6 + - name: Install Maestro CLI uses: ./.github/actions/setup-maestro - name: Run tests + env: + USE_CCACHE: 1 + CCACHE_DIR: ~/Library/Caches/ccache run: ${{ matrix.pm }} ios:e2e ${{ env.WORKING_DIR }}/example ${{ matrix.package-type }} + - name: Print ccache statistics + if: always() + run: ccache --show-stats + - name: Upload test artifacts if: always() uses: actions/upload-artifact@v4 diff --git a/assets/template/bunfig.toml b/assets/template/bunfig.toml new file mode 100644 index 00000000..57f75baf --- /dev/null +++ b/assets/template/bunfig.toml @@ -0,0 +1,2 @@ +[install] +linker = "hoisted" diff --git a/assets/template/package.json b/assets/template/package.json index df943731..ea3bf366 100644 --- a/assets/template/package.json +++ b/assets/template/package.json @@ -53,12 +53,12 @@ "@semantic-release/changelog": "^6.0.3", "@semantic-release/git": "^10.0.1", "@types/jest": "^29.5.12", - "@types/react": "19.1.0", - "nitrogen": "^0.29.4", - "react": "19.1.0", - "react-native": "0.81.1", + "@types/react": "19.1.1", + "nitrogen": "^0.29.8", + "react": "19.1.1", + "react-native": "0.82", "react-native-builder-bob": "^0.37.0", - "react-native-nitro-modules": "^0.2942", + "react-native-nitro-modules": "^0.29.8", "conventional-changelog-conventionalcommits": "^9.1.0", "semantic-release": "^24.2.9", "typescript": "^5.8.3" diff --git a/bunfig.toml b/bunfig.toml new file mode 100644 index 00000000..57f75baf --- /dev/null +++ b/bunfig.toml @@ -0,0 +1,2 @@ +[install] +linker = "hoisted" diff --git a/commitlint.config.cjs b/commitlint.config.cjs index 186619e5..1ee388d9 100644 --- a/commitlint.config.cjs +++ b/commitlint.config.cjs @@ -2,5 +2,6 @@ module.exports = { extends: ['@commitlint/config-conventional'], rules: { 'footer-max-line-length': [0, 'always'], + 'body-max-line-length': [0, 'always'], }, } diff --git a/scripts/e2e-maestro.sh b/scripts/e2e-maestro.sh index 42750e6d..73578980 100755 --- a/scripts/e2e-maestro.sh +++ b/scripts/e2e-maestro.sh @@ -2,11 +2,15 @@ trap 'exit' INT +# Save the script directory (project root) +SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && cd .. && pwd )" + PLATFORM=${1:-} EXAMPLE_DIR=${2:-} PACKAGE_TYPE=${3:-} -echo "๐Ÿš€ Running e2e tests for $PLATFORM" +echo "๐Ÿš€ Running e2e video recording for $PLATFORM" +echo "๐Ÿ“‚ Project root: $SCRIPT_DIR" # Validate passed platform case $PLATFORM in @@ -46,17 +50,29 @@ if [ "$PLATFORM" == "ios" ]; then # Build the app with optimizations and pretty output export USE_CCACHE=1 + # Configure ccache if available (optional optimization) + if command -v ccache >/dev/null 2>&1; then + export CCACHE_DIR="${CCACHE_DIR:-$HOME/Library/Caches/ccache}" + mkdir -p "$CCACHE_DIR" + export PATH="/opt/homebrew/bin:$PATH" + echo "โœ… ccache is available" + echo "๐Ÿ“ฆ ccache directory: $CCACHE_DIR" + ccache --max-size=2G 2>/dev/null || true + else + echo "โš ๏ธ ccache not found (optional). Install with: brew install ccache" + fi buildCmd="xcodebuild \ - CC=clang CPLUSPLUS=clang++ LD=clang LDPLUSPLUS=clang++ \ - -derivedDataPath build \ - -UseModernBuildSystem=YES \ -workspace $SCHEME.xcworkspace \ - -configuration Release \ -scheme $SCHEME \ + -configuration Release \ -destination id=$iphone16Id \ - -parallelizeTargets \ + -derivedDataPath build \ -jobs $(sysctl -n hw.ncpu) \ + ONLY_ACTIVE_ARCH=YES \ + ARCHS=arm64 \ + VALID_ARCHS=arm64 \ + EXCLUDED_ARCHS=x86_64 \ CODE_SIGNING_ALLOWED=NO" echo "๐Ÿ”จ Building iOS app..." @@ -92,7 +108,8 @@ if [ "$PLATFORM" == "ios" ]; then echo "๐Ÿ“ฒ Installing app from: $APP_PATH" xcrun simctl install $iphone16Id "$APP_PATH" - cd ../../.. + # Return to project root + cd "$SCRIPT_DIR" else cd $EXAMPLE_DIR/android chmod +x ./gradlew @@ -113,7 +130,9 @@ else # Stop Gradle daemon to free up memory echo "๐Ÿงน Stopping Gradle daemon..." ./gradlew --stop - cd ../../.. + + # Return to project root + cd "$SCRIPT_DIR" fi echo "๐Ÿ“‚ Script directory: $(pwd)" @@ -121,27 +140,30 @@ echo "" test_file="e2e-tests/$PACKAGE_TYPE.e2e.yaml" -echo "๐Ÿงช Using test file: $test_file" +echo "๐ŸŽฌ Using flow file for recording: $test_file" if [ ! -f "$test_file" ]; then - echo "โŒ Error! Test file not found: $test_file" + echo "โŒ Error! Flow file not found: $test_file" echo "" exit 1 fi -testCmd="maestro test \"$test_file\" -e APP_ID=$APP_ID --flatten-debug-output" -echo "๐ŸŽฏ Running test: $testCmd" +# Create output directory for videos +mkdir -p e2e-artifacts + +recordCmd="maestro record \"$test_file\" -e APP_ID=$APP_ID --local" +echo "๐ŸŽฏ Recording test video: $recordCmd" echo "๐Ÿ“ฑ APP_ID: $APP_ID" -if ! eval "$testCmd --debug-output e2e-artifacts/$PACKAGE_TYPE"; then - echo "Test ${test_file} failed. Retrying in 30 seconds..." +if ! eval "$recordCmd --debug-output e2e-artifacts/$PACKAGE_TYPE"; then + echo "Recording ${test_file} failed. Retrying in 30 seconds..." sleep 30 - if ! eval "$testCmd --debug-output e2e-artifacts/$PACKAGE_TYPE-retry-1"; then - echo "Test ${test_file} failed again. Retrying for the last time in 120 seconds..." + if ! eval "$recordCmd --debug-output e2e-artifacts/$PACKAGE_TYPE-retry-1"; then + echo "Recording ${test_file} failed again. Retrying for the last time in 120 seconds..." sleep 120 - if ! eval "$testCmd --debug-output e2e-artifacts/$PACKAGE_TYPE-retry-2"; then - echo "Test ${test_file} failed again. Exiting..." + if ! eval "$recordCmd --debug-output e2e-artifacts/$PACKAGE_TYPE-retry-2"; then + echo "Recording ${test_file} failed again. Exiting..." exit 1 fi fi diff --git a/src/generate-nitro-package.ts b/src/generate-nitro-package.ts index b0a821fd..29c44be6 100644 --- a/src/generate-nitro-package.ts +++ b/src/generate-nitro-package.ts @@ -297,6 +297,10 @@ export class NitroModuleFactory { 'LICENSE', ] + if (this.config.pm === 'bun') { + filesToCopy.push('bunfig.toml') + } + await copyTemplateFiles( this.config, [__dirname, '..', 'assets', 'template'],