-
Notifications
You must be signed in to change notification settings - Fork 1
KMP upgrade #4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
KMP upgrade #4
Changes from all commits
Commits
Show all changes
41 commits
Select commit
Hold shift + click to select a range
0125a05
KMP upgrade
edwardpure c3c9d75
enhance CI configuration and update stress testing support
edwardpure 57c8869
update Android logger implementation and CI configuration for Ubuntu …
edwardpure 3ea3b76
fix logging
edwardstock 0d92021
fix multi-classpath lib loading
edwardstock 7696a59
fix duplicated symbols
edwardstock 2b6cb56
add ios prebuilt libs; fix linux arm64 image
edwardstock 2965f5f
add ios prebuilt libs; fix linux arm64 image
edwardstock f2c06a4
android sdk setup
edwardstock 5224de0
fix android native lib publication
edwardstock 7307496
remove ubuntu arm64 as it's not supported to build linux arm64
edwardstock ca0859f
limit concurrency
edwardstock 200037c
fix timezone
edwardstock c64d2e5
cache sdk
edwardstock 70c18d7
fix scripts calling
edwardstock c46c62f
setup codeql
edwardstock 1cdd73a
add read-only permissions to actions
edwardstock 84cd774
submodules
edwardstock 138b901
update codeql custom config via workflow; fix native build scripts
edwardstock 73700dd
fix codeql
edwardstock 7aed329
fix codeql for cpp
edwardstock 887d5ed
remove koltin analysis
edwardstock 5a81619
fix @Throws conflict
edwardstock 78ca6e7
minor improvements
edwardstock 1a05ff6
update tests to cover updated logic
edwardstock 877a432
update ugly api and use direct methods
edwardstock 628ef4a
refactor: reorganize package structure and improve API consistency
edwardstock 1c32e56
add proguard rules
edwardstock 7759e02
add separator to entry key
edwardstock 8eb2a98
fix ios example; cleanup warnings
edwardstock bc39874
linux x64 test script; attempt to remove writing xml test result
edwardstock f12326d
add mocked LevelDB
edwardstock 6cf9df6
move mocks to public api
edwardstock 6c9f1d1
fixing critical bugs; updated documentation
edwardstock 4ef9097
chore(build): KMP infra cleanup — drop androidLibrary deprecation, fi…
edwardstock 0e05990
update gradle.properties
edwardstock bda7eb2
update kover
edwardstock 22d540a
Kover coverage on PRs + fix the excludes for a library
edwardstock cf07fb2
improve coverage
edwardstock 353f9b7
update infra
edwardstock 563d26e
fix android sdk for linux
edwardstock File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,23 @@ | ||
| # Normalize line endings: store text files as LF in the repository, | ||
| # regardless of the contributor's OS. Working-tree checkout stays native. | ||
| * text=auto eol=lf | ||
|
|
||
| # Windows scripts stay CRLF byte-for-byte (Gradle ships gradlew.bat as CRLF); | ||
| # -text means git never converts them, so they are not normalized to LF. | ||
| *.bat -text | ||
| *.cmd -text | ||
| *.ps1 -text | ||
|
|
||
| # Binary artifacts — never touch their bytes. | ||
| *.png binary | ||
| *.webp binary | ||
| *.jpg binary | ||
| *.jpeg binary | ||
| *.ico binary | ||
| *.so binary | ||
| *.dylib binary | ||
| *.dll binary | ||
| *.a binary | ||
| *.jar binary | ||
| *.keystore binary | ||
| *.xcuserstate binary |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,10 @@ | ||
| name: Cache Gradle wrapper | ||
| description: Cache Gradle wrapper distributions | ||
| runs: | ||
| using: composite | ||
| steps: | ||
| - name: Cache Gradle wrapper | ||
| uses: actions/cache@v4 | ||
| with: | ||
| path: ~/.gradle/wrapper/dists | ||
| key: ${{ runner.os }}-gradle-wrapper-${{ hashFiles('**/gradle/wrapper/gradle-wrapper.properties') }} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,17 @@ | ||
| name: Cache Kotlin/Native (konan) | ||
| description: >- | ||
| Cache the ~/.konan toolchain (Kotlin/Native compiler, LLVM, platform sysroots) so native jobs do | ||
| not re-download it from scratch on every run. | ||
| runs: | ||
| using: composite | ||
| steps: | ||
| - name: Cache konan | ||
| uses: actions/cache@v4 | ||
| with: | ||
| path: ~/.konan | ||
| # The konan toolchain version tracks the Kotlin version, which lives in libs.versions.toml. | ||
| key: konan-${{ runner.os }}-${{ hashFiles('gradle/libs.versions.toml') }} | ||
| # On a miss (e.g. Kotlin bumped) restore the previous konan and let it download only the | ||
| # delta, instead of pulling the whole toolchain again. | ||
| restore-keys: | | ||
| konan-${{ runner.os }}- |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,41 @@ | ||
| name: Check publish secrets | ||
| description: Fail fast when Maven Central or GPG secrets are missing | ||
| inputs: | ||
| maven_username: | ||
| description: Maven Central username | ||
| required: true | ||
| maven_password: | ||
| description: Maven Central password | ||
| required: true | ||
| gpg_private_key: | ||
| description: GPG private key | ||
| required: true | ||
| gpg_passphrase: | ||
| description: GPG passphrase | ||
| required: true | ||
| runs: | ||
| using: composite | ||
| steps: | ||
| - name: Verify publish secrets | ||
| shell: bash | ||
| run: | | ||
| missing=0 | ||
| if [ -z "${{ inputs.maven_username }}" ]; then | ||
| echo "Missing secret: MAVEN_CENTRAL_USERNAME" | ||
| missing=1 | ||
| fi | ||
| if [ -z "${{ inputs.maven_password }}" ]; then | ||
| echo "Missing secret: MAVEN_CENTRAL_PASSWORD" | ||
| missing=1 | ||
| fi | ||
| if [ -z "${{ inputs.gpg_private_key }}" ]; then | ||
| echo "Missing secret: GPG_PRIVATE_KEY" | ||
| missing=1 | ||
| fi | ||
| if [ -z "${{ inputs.gpg_passphrase }}" ]; then | ||
| echo "Missing secret: GPG_PASSPHRASE" | ||
| missing=1 | ||
| fi | ||
| if [ "$missing" -ne 0 ]; then | ||
| exit 1 | ||
| fi |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,42 @@ | ||
| name: Setup Android SDK/NDK/CMake | ||
| description: Install Android SDK, required NDK, and CMake for native builds. | ||
|
|
||
| runs: | ||
| using: "composite" | ||
| steps: | ||
| - name: Configure Android SDK environment | ||
| shell: bash | ||
| run: | | ||
| set -euo pipefail | ||
| case "${RUNNER_OS}" in | ||
| Linux) SDK_ROOT="$HOME/android-sdk" ;; | ||
| macOS) SDK_ROOT="$HOME/Library/Android/sdk" ;; | ||
| *) echo "Unsupported OS: ${RUNNER_OS}" >&2; exit 1 ;; | ||
| esac | ||
| echo "ANDROID_SDK_ROOT=${SDK_ROOT}" >> "${GITHUB_ENV}" | ||
| echo "ANDROID_HOME=${SDK_ROOT}" >> "${GITHUB_ENV}" | ||
| echo "${SDK_ROOT}/cmdline-tools/latest/bin" >> "${GITHUB_PATH}" | ||
| echo "${SDK_ROOT}/platform-tools" >> "${GITHUB_PATH}" | ||
|
|
||
| - name: Cache Android SDK | ||
| uses: actions/cache@v4 | ||
| env: | ||
| ANDROID_SDK_CACHE_KEY: >- | ||
| android-sdk-${{ runner.os }}-${{ hashFiles( | ||
| '.github/actions/setup-android-tools/action.yml', | ||
| '.github/actions/setup-android-tools/install_cmdline_tools.sh', | ||
| '.github/actions/setup-android-tools/install_sdk_packages.sh' | ||
| ) }} | ||
| with: | ||
| path: ${{ env.ANDROID_SDK_ROOT }} | ||
| key: ${{ env.ANDROID_SDK_CACHE_KEY }} | ||
| restore-keys: | | ||
| android-sdk-${{ runner.os }}- | ||
|
|
||
| - name: Install Android commandline tools | ||
| shell: bash | ||
| run: bash ./.github/actions/setup-android-tools/install_cmdline_tools.sh | ||
|
|
||
| - name: Install Android SDK packages | ||
| shell: bash | ||
| run: bash ./.github/actions/setup-android-tools/install_sdk_packages.sh |
22 changes: 22 additions & 0 deletions
22
.github/actions/setup-android-tools/install_cmdline_tools.sh
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,22 @@ | ||
| #!/usr/bin/env bash | ||
| set -euo pipefail | ||
|
|
||
| if command -v sdkmanager >/dev/null 2>&1; then | ||
| exit 0 | ||
| fi | ||
|
|
||
| mkdir -p "${ANDROID_SDK_ROOT}/cmdline-tools" | ||
| case "${RUNNER_OS}" in | ||
| Linux) TOOLS_ZIP="commandlinetools-linux-14742923_latest.zip" ;; | ||
| macOS) TOOLS_ZIP="commandlinetools-mac-14742923_latest.zip" ;; | ||
| *) echo "Unsupported OS: ${RUNNER_OS}" >&2; exit 1 ;; | ||
| esac | ||
| export TOOLS_ZIP | ||
|
|
||
| curl -fsSL "https://dl.google.com/android/repository/${TOOLS_ZIP}" -o "${RUNNER_TEMP}/${TOOLS_ZIP}" | ||
| if command -v unzip >/dev/null 2>&1; then | ||
| unzip -q "${RUNNER_TEMP}/${TOOLS_ZIP}" -d "${ANDROID_SDK_ROOT}/cmdline-tools" | ||
| else | ||
| python3 -c 'import os, zipfile; sdk_root=os.environ["ANDROID_SDK_ROOT"]; zip_path=os.path.join(os.environ["RUNNER_TEMP"], os.environ["TOOLS_ZIP"]); dest_dir=os.path.join(sdk_root, "cmdline-tools"); zipfile.ZipFile(zip_path, "r").extractall(dest_dir)' | ||
| fi | ||
| mv "${ANDROID_SDK_ROOT}/cmdline-tools/cmdline-tools" "${ANDROID_SDK_ROOT}/cmdline-tools/latest" |
11 changes: 11 additions & 0 deletions
11
.github/actions/setup-android-tools/install_sdk_packages.sh
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| #!/usr/bin/env bash | ||
| set -euo pipefail | ||
|
|
||
| yes | sdkmanager --sdk_root="${ANDROID_SDK_ROOT}" --licenses >/dev/null || true | ||
| # API 37 is published only as the versioned package platforms;android-37.0 — there is no bare | ||
| # platforms;android-37 in the SDK repo (see actions/runner-images#13859). | ||
| sdkmanager --sdk_root="${ANDROID_SDK_ROOT}" "platform-tools" "platforms;android-37.0" "ndk;29.0.14206865" "cmake;4.1.2" | ||
| # AGP resolves compileSdk 37 to the target hash "android-37", but the platform installs into | ||
| # platforms/android-37.0. Alias it so Gradle can find the platform. -sfn keeps it idempotent across | ||
| # cache-restored runs (overwrites a stale link instead of nesting one inside the target dir). | ||
| ln -sfn android-37.0 "${ANDROID_SDK_ROOT}/platforms/android-37" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,16 @@ | ||
| name: LevelDB Multiplatform CodeQL Config | ||
|
|
||
| paths-ignore: | ||
| - "**/.gradle/**" | ||
| - "**/build/**" | ||
| - "**/out/**" | ||
| - "**/bin/**" | ||
| - "**/.idea/**" | ||
| - "**/.kotlin/**" | ||
| - "**/node_modules/**" | ||
| - "android-example/**" | ||
| - "ios-example/**" | ||
| - "native/leveldb/**" | ||
| - "native/.dockcross*/**" | ||
| - "native/prebuilt/**" | ||
| - "third_party/**" |
This file was deleted.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,74 @@ | ||
| name: PR Check | ||
| permissions: | ||
| contents: read | ||
| pull-requests: write | ||
| on: | ||
| pull_request: | ||
|
|
||
| concurrency: | ||
| group: ci-${{ github.ref }} | ||
| cancel-in-progress: true | ||
|
|
||
| jobs: | ||
| test: | ||
| name: Tests (${{ matrix.os }}) | ||
| runs-on: ${{ matrix.os }} | ||
| strategy: | ||
| fail-fast: false | ||
| matrix: | ||
| include: | ||
| - os: ubuntu-22.04 | ||
| gradle_args: ":leveldb:check :leveldb:koverXmlReport" | ||
| - os: macos-latest | ||
| gradle_args: ":leveldb:check" | ||
| - os: windows-latest | ||
| gradle_args: ":leveldb:mingwX64Test" | ||
|
|
||
| steps: | ||
| - name: Checkout | ||
| uses: actions/checkout@v4 | ||
| with: | ||
| fetch-depth: 0 | ||
| submodules: true | ||
|
|
||
| - name: Set up JDK 17 | ||
| uses: actions/setup-java@v4 | ||
| with: | ||
| distribution: "temurin" | ||
| java-version: "17" | ||
|
|
||
| - name: Set up Android tools | ||
| if: runner.os == 'Linux' | ||
| uses: ./.github/actions/setup-android-tools | ||
|
|
||
| - name: Cache Gradle wrapper | ||
| uses: ./.github/actions/cache-gradle-wrapper | ||
|
|
||
| - name: Gradle cache | ||
| uses: gradle/actions/setup-gradle@v4 | ||
|
|
||
| - name: Cache konan | ||
| uses: ./.github/actions/cache-konan | ||
|
|
||
| - name: Run tests | ||
| env: | ||
| JAVA_TOOL_OPTIONS: "-XX:+CreateCoredumpOnCrash -XX:ErrorFile=leveldb/hs_err_pid%p.log" | ||
| run: ./gradlew ${{ matrix.gradle_args }} | ||
|
|
||
| - name: Post coverage to PR | ||
| if: matrix.os == 'ubuntu-22.04' | ||
| uses: mi-kas/kover-report@v1 | ||
| with: | ||
| path: leveldb/build/reports/kover/report.xml | ||
| token: ${{ secrets.GITHUB_TOKEN }} | ||
| title: Code coverage | ||
| update-comment: true | ||
|
|
||
| - name: Upload JVM crash logs | ||
| if: failure() | ||
| uses: actions/upload-artifact@v4 | ||
| with: | ||
| name: jvm-crash-${{ matrix.os }} | ||
| path: | | ||
| leveldb/hs_err_pid*.log | ||
| leveldb/core* | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,63 @@ | ||
| name: CodeQL | ||
|
|
||
| on: | ||
| pull_request: | ||
| push: | ||
| branches: [ master ] | ||
|
|
||
| jobs: | ||
| analyze: | ||
| name: CodeQL (${{ matrix.language }}) | ||
| runs-on: ubuntu-latest | ||
| permissions: | ||
| actions: read | ||
| contents: read | ||
| security-events: write | ||
|
|
||
| strategy: | ||
| fail-fast: false | ||
| matrix: | ||
| include: | ||
| - language: c-cpp | ||
| build-mode: manual | ||
| # kotlin 2.3 is not supported by CodeQL yet | ||
| # - language: java-kotlin | ||
| # build-mode: manual | ||
| - language: actions | ||
| build-mode: none | ||
|
|
||
| steps: | ||
| - name: Checkout | ||
| uses: actions/checkout@v4 | ||
| with: | ||
| fetch-depth: 0 | ||
| submodules: true | ||
|
|
||
| - name: Setup Java | ||
| if: matrix.language == 'java-kotlin' | ||
| uses: actions/setup-java@v4 | ||
| with: | ||
| distribution: temurin | ||
| java-version: "21" | ||
|
|
||
| - name: Initialize CodeQL | ||
| uses: github/codeql-action/init@v3 | ||
| with: | ||
| languages: ${{ matrix.language }} | ||
| build-mode: ${{ matrix.build-mode }} | ||
| config-file: ./.github/codeql/codeql-config.yml | ||
|
|
||
| - name: Build native C/C++ (for CodeQL) | ||
| if: matrix.language == 'c-cpp' | ||
| working-directory: native | ||
| run: | | ||
| cmake --preset linux-x86_64-debug | ||
| cmake --build --preset linux-x86_64-debug | ||
|
|
||
| - name: Build Java/Kotlin | ||
| if: matrix.language == 'java-kotlin' | ||
| run: | | ||
| ./gradlew :leveldb:check --no-daemon | ||
|
|
||
| - name: Analyze | ||
| uses: github/codeql-action/analyze@v3 |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.