Skip to content

Commit

Permalink
Add CI step for libsql compilation
Browse files Browse the repository at this point in the history
  • Loading branch information
ospfranco committed Jul 14, 2024
1 parent 1c440e6 commit 7691c08
Show file tree
Hide file tree
Showing 3 changed files with 82 additions and 4 deletions.
60 changes: 60 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}"
17 changes: 17 additions & 0 deletions scripts/turnOnLibsql.js
Original file line number Diff line number Diff line change
@@ -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!');
9 changes: 5 additions & 4 deletions scripts/turnOnSQLCipher.js
Original file line number Diff line number Diff line change
Expand Up @@ -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!');
console.log('package.json updated successfully!');

0 comments on commit 7691c08

Please sign in to comment.