diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index c24b2482..f4bac6b9 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -243,3 +243,63 @@ jobs: JAVA_OPTS: '-XX:MaxHeapSize=6g' run: | yarn turbo run build:android --cache-dir="${{ env.TURBO_CACHE_DIR }}" + + build-android-libsql: + runs-on: ubuntu-latest + env: + TURBO_CACHE_DIR: .turbo/android + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Turn on libsql + run: | + node ./scripts/turnOnLibsql.js + + - name: Setup + uses: ./.github/actions/setup + + - name: Cache turborepo for Android + uses: actions/cache@v3 + with: + path: ${{ env.TURBO_CACHE_DIR }} + key: ${{ runner.os }}-turborepo-android-${{ hashFiles('yarn.lock') }} + restore-keys: | + ${{ runner.os }}-turborepo-android- + + - name: Check turborepo cache for Android + run: | + TURBO_CACHE_STATUS=$(node -p "($(yarn turbo run build:android --cache-dir="${{ env.TURBO_CACHE_DIR }}" --dry=json)).tasks.find(t => t.task === 'build:android').cache.status") + + if [[ $TURBO_CACHE_STATUS == "HIT" ]]; then + echo "turbo_cache_hit=1" >> $GITHUB_ENV + fi + + - name: Install JDK + if: env.turbo_cache_hit != 1 + uses: actions/setup-java@v3 + with: + distribution: 'zulu' + java-version: '17' + + - name: Finalize Android SDK + if: env.turbo_cache_hit != 1 + run: | + /bin/bash -c "yes | $ANDROID_HOME/cmdline-tools/latest/bin/sdkmanager --licenses > /dev/null" + + - name: Cache Gradle + if: env.turbo_cache_hit != 1 + uses: actions/cache@v3 + with: + path: | + ~/.gradle/wrapper + ~/.gradle/caches + key: ${{ runner.os }}-gradle-${{ hashFiles('example/android/gradle/wrapper/gradle-wrapper.properties') }} + restore-keys: | + ${{ runner.os }}-gradle- + + - name: Build example for Android + env: + JAVA_OPTS: '-XX:MaxHeapSize=6g' + run: | + yarn turbo run build:android --cache-dir="${{ env.TURBO_CACHE_DIR }}" diff --git a/scripts/turnOnLibsql.js b/scripts/turnOnLibsql.js new file mode 100644 index 00000000..ff5cdedd --- /dev/null +++ b/scripts/turnOnLibsql.js @@ -0,0 +1,17 @@ +const fs = require('fs'); + +console.log('Current working directory:', process.cwd()); + +// Read the package.json file +const packageJson = JSON.parse(fs.readFileSync('./example/package.json')); + +// Modify the op-sqlite.sqlcipher key to true +packageJson['op-sqlite']['libsql'] = true; + +// Save the updated package.json file +fs.writeFileSync( + './example/package.json', + JSON.stringify(packageJson, null, 2) +); + +console.log('package.json updated successfully!'); diff --git a/scripts/turnOnSQLCipher.js b/scripts/turnOnSQLCipher.js index f14c93f4..85d44111 100644 --- a/scripts/turnOnSQLCipher.js +++ b/scripts/turnOnSQLCipher.js @@ -5,12 +5,13 @@ console.log('Current working directory:', process.cwd()); // Read the package.json file const packageJson = JSON.parse(fs.readFileSync('./example/package.json')); -console.log("ROPO package.json:", packageJson); - // Modify the op-sqlite.sqlcipher key to true packageJson['op-sqlite']['sqlcipher'] = true; // Save the updated package.json file -fs.writeFileSync('./example/package.json', JSON.stringify(packageJson, null, 2)); +fs.writeFileSync( + './example/package.json', + JSON.stringify(packageJson, null, 2) +); -console.log('package.json updated successfully!'); \ No newline at end of file +console.log('package.json updated successfully!');