-
Notifications
You must be signed in to change notification settings - Fork 61
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Initial Github Action workflow + static analysis (+33 squashed commits)
Squashed commits: [3ac28e0] Run static analysis in parallel [be45ad5] Move static analysis to reusable workflow [9a35a8d] Support for detekt [e2abeaa] Better reporting [82dfa8f] Split ktlint tasks [431cf69] Use other plugin for publishing checkstyle results [9091c1a] Always collect ktlint results [7157a9a] Syntax [ae75c5e] Better gradle caching Testing ktlint results [9b7e579] Correct ktlint report path [dac6a27] Fix files cached by ktlint [643c9d0] Run correct ktlint task [895d2be] Run Ktlint and gather results [fcf5de4] More cleanup [c9a1fd2] Cleanup [a80290c] Add Realm Java Compatibility project (#882) [bd7057f] Introduce a new top-level task for publishing packages used by CI nodes. [a68dd30] Use better Gradle task for caching [e951681] Use enabled flag for publications. [652ddb4] Use same version of NDK [6da6985] Cache NDK + use publish task [0263693] Only build for Android [73d879e] More syntax [f13d290] Syntax error [d40aba7] Install CMake and Ninja [8b99435] Add ccache [80e6095] Setup Java [99703bf] Update pr.yml Checkout code [f1c52d1] Remove description [0e7a2a9] wip [3fc1971] Run on ubuntu [10d4e0e] Attempt to build [15360c4] Trigger draft PR
- Loading branch information
Showing
47 changed files
with
1,385 additions
and
96 deletions.
There are no files selected for viewing
This file contains 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,85 @@ | ||
name: Static Analysis | ||
|
||
on: | ||
workflow_call: | ||
|
||
jobs: | ||
ktlint: | ||
runs-on: ubuntu-latest | ||
steps: | ||
|
||
- name: Checkout code | ||
uses: actions/checkout@v3 | ||
with: | ||
submodules: "recursive" | ||
|
||
- name: Setup Gradle and task/dependency caching | ||
uses: gradle/gradle-build-action@v2 | ||
with: | ||
cache-read-only: false # TODO How to configure caching here? | ||
|
||
- name: Run Ktlint | ||
run: ./gradlew ktlintCheck | ||
|
||
- name: Stash Ktlint results | ||
if: always() | ||
run: | | ||
rm -rf /tmp/ktlint | ||
rm -rf /tmp/detekt | ||
mkdir /tmp/ktlint | ||
mkdir /tmp/detekt | ||
rsync -a --delete --ignore-errors examples/kmm-sample/androidApp/build/reports/ktlint/ /tmp/ktlint/example/ || true | ||
rsync -a --delete --ignore-errors test/build/reports/ktlint/ /tmp/ktlint/test/ || true | ||
rsync -a --delete --ignore-errors packages/cinterop/build/reports/ktlint/ /tmp/ktlint/cinterop/ || true | ||
rsync -a --delete --ignore-errors packages/library-base/build/reports/ktlint/ /tmp/ktlint/library-base/ || true | ||
rsync -a --delete --ignore-errors packages/library-sync/build/reports/ktlint/ /tmp/ktlint/library-sync/ || true | ||
rsync -a --delete --ignore-errors packages/plugin-compiler/build/reports/ktlint/ /tmp/ktlint/plugin-compiler/ || true | ||
rsync -a --delete --ignore-errors packages/gradle-plugin/build/reports/ktlint/ /tmp/ktlint/plugin-gradle/ || true | ||
rsync -a --delete --ignore-errors benchmarks/build/reports/ktlint/ /tmp/ktlint/benchmarks/ || true | ||
- name: Publish Ktlint results | ||
uses: jwgmeligmeyling/checkstyle-github-action@master | ||
if: always() | ||
with: | ||
name: Ktlint Results | ||
title: Ktlint Analyzer report | ||
path: '/tmp/ktlint/**/*.xml' | ||
|
||
detekt: | ||
runs-on: ubuntu-latest | ||
steps: | ||
|
||
- name: Checkout code | ||
uses: actions/checkout@v3 | ||
with: | ||
submodules: "recursive" | ||
|
||
- name: Setup Gradle and task/dependency caching | ||
uses: gradle/gradle-build-action@v2 | ||
with: | ||
cache-read-only: false # TODO How to configure caching here? | ||
|
||
- name: Run Detekt | ||
run: ./gradlew detekt | ||
|
||
- name: Stash Detekt results | ||
if: always() | ||
run: | | ||
rm -rf /tmp/detekt | ||
mkdir /tmp/detekt | ||
rsync -a --delete --ignore-errors examples/kmm-sample/androidApp/build/reports/detekt/ /tmp/detekt/example/ || true | ||
rsync -a --delete --ignore-errors test/build/reports/detekt/ /tmp/detekt/test/ || true | ||
rsync -a --delete --ignore-errors packages/cinterop/build/reports/detekt/ /tmp/detekt/cinterop/ || true | ||
rsync -a --delete --ignore-errors packages/library-base/build/reports/detekt/ /tmp/detekt/library-base/ || true | ||
rsync -a --delete --ignore-errors packages/library-sync/build/reports/detekt/ /tmp/detekt/library-sync/ || true | ||
rsync -a --delete --ignore-errors packages/plugin-compiler/build/reports/detekt/ /tmp/detekt/plugin-compiler/ || true | ||
rsync -a --delete --ignore-errors packages/gradle-plugin/build/reports/detekt/ /tmp/detekt/plugin-gradle/ || true | ||
rsync -a --delete --ignore-errors benchmarks/build/reports/detekt/ /tmp/detekt/benchmarks/ || true | ||
- name: Publish Detekt results | ||
uses: jwgmeligmeyling/checkstyle-github-action@master | ||
if: always() | ||
with: | ||
name: Detekt Results | ||
title: Detekt Analyzer report | ||
path: '/tmp/detekt/**/*.xml' |
This file contains 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 |
---|---|---|
@@ -1,8 +1,67 @@ | ||
name: 'PR Build' | ||
description: 'Build and test a pull request' | ||
"on": | ||
name: PR Build | ||
on: | ||
pull_request: | ||
paths-ignore: | ||
- '**.md' | ||
env: | ||
REALM_DISABLE_ANALYTICS: true | ||
jobs: | ||
static-analysis: | ||
uses: ./.github/workflows/include_static_analysis.yml | ||
|
||
build-packages: | ||
runs-on: ubuntu-latest | ||
needs: static-analysis | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v3 | ||
with: | ||
submodules: "recursive" | ||
|
||
- name: Validate Gradle Wrapper | ||
uses: gradle/[email protected] | ||
|
||
# TODO I'm not sure this catches changes to our Config.kt, what is the impact? | ||
# https://github.com/actions/setup-java#caching-packages-dependencies | ||
- name: Setup Java 11 | ||
uses: actions/setup-java@v3 | ||
with: | ||
distribution: zulu | ||
java-version: 11 | ||
|
||
# TODO Default behavior is only caching from main/master. Unclear what the best caching strategy is for us. | ||
# TODO What is the rules and limits for caching on Github | ||
- name: Setup Gradle and task/dependency caching | ||
uses: gradle/gradle-build-action@v2 | ||
with: | ||
cache-read-only: ${{ github.ref != 'refs/heads/master' && github.ref != 'refs/heads/releases' && github.ref != 'refs/heads/feature/github-actions' }} | ||
|
||
- name: Setup cmake | ||
uses: jwlawson/[email protected] | ||
with: | ||
cmake-version: '3.21.4' | ||
|
||
- name: Setup Ninja | ||
uses: ashutoshvarma/setup-ninja@master | ||
|
||
# TODO How to do ccache caching? It is unclear what the tradeoffs are? | ||
- name: Install ccache | ||
uses: hendrikmuhs/[email protected] | ||
with: | ||
key: realm-kotlin-${{ matrix.os }} | ||
|
||
- name: Prepend ccache executables to the PATH | ||
run: echo PATH="/usr/lib/ccache:/usr/local/opt/ccache/libexec:$PATH" >> $GITHUB_ENV | ||
|
||
# TOOD This matches 23.2.8568313, but what happens if we a define specific version in our build? | ||
- name: Setup NDK | ||
uses: nttld/setup-ndk@v1 | ||
with: | ||
ndk-version: r23c | ||
|
||
|
||
# - name: Build packages | ||
# working-directory: packages | ||
# run: ./gradlew publishCIPackages --info | ||
|
||
|
This file contains 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
This file contains 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
This file contains 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,70 @@ | ||
/* | ||
* Copyright 2022 Realm Inc. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
plugins { | ||
id 'com.android.application' | ||
id 'org.jetbrains.kotlin.android' | ||
id 'org.jetbrains.kotlin.kapt' | ||
id "io.realm.kotlin" | ||
} | ||
|
||
apply plugin: "realm-android" | ||
|
||
android { | ||
compileSdkVersion = 31 | ||
|
||
defaultConfig { | ||
applicationId "io.realm.kotlin.demo.javacompatibility" | ||
minSdk 21 | ||
targetSdk 31 | ||
versionCode 1 | ||
versionName "1.0" | ||
|
||
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" | ||
} | ||
|
||
buildTypes { | ||
release { | ||
minifyEnabled false | ||
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' | ||
} | ||
} | ||
compileOptions { | ||
sourceCompatibility JavaVersion.VERSION_1_8 | ||
targetCompatibility JavaVersion.VERSION_1_8 | ||
} | ||
kotlinOptions { | ||
jvmTarget = '1.8' | ||
} | ||
} | ||
|
||
realm { | ||
syncEnabled = true | ||
} | ||
|
||
dependencies { | ||
|
||
implementation 'androidx.core:core-ktx:1.7.0' | ||
implementation 'androidx.appcompat:appcompat:1.4.1' | ||
implementation 'com.google.android.material:material:1.6.0' | ||
implementation 'androidx.constraintlayout:constraintlayout:2.1.3' | ||
|
||
implementation "io.realm.kotlin:library-sync:${Realm.version}" | ||
|
||
testImplementation 'junit:junit:4.13.2' | ||
androidTestImplementation 'androidx.test.ext:junit:1.1.3' | ||
androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0' | ||
} |
This file contains 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,21 @@ | ||
# Add project specific ProGuard rules here. | ||
# You can control the set of applied configuration files using the | ||
# proguardFiles setting in build.gradle. | ||
# | ||
# For more details, see | ||
# http://developer.android.com/guide/developing/tools/proguard.html | ||
|
||
# If your project uses WebView with JS, uncomment the following | ||
# and specify the fully qualified class name to the JavaScript interface | ||
# class: | ||
#-keepclassmembers class fqcn.of.javascript.interface.for.webview { | ||
# public *; | ||
#} | ||
|
||
# Uncomment this to preserve the line number information for | ||
# debugging stack traces. | ||
#-keepattributes SourceFile,LineNumberTable | ||
|
||
# If you keep the line number information, uncomment this to | ||
# hide the original source file name. | ||
#-renamesourcefileattribute SourceFile |
Oops, something went wrong.