Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/main' into nh/GHA/release
Browse files Browse the repository at this point in the history
  • Loading branch information
nhachicha committed Mar 8, 2024
2 parents 60ef040 + 583ef40 commit dd00b06
Show file tree
Hide file tree
Showing 7 changed files with 77 additions and 25 deletions.
22 changes: 22 additions & 0 deletions .github/workflows/check-pr-title.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# NOTE: This is a common file that is overwritten by realm/ci-actions sync service
# and should only be modified in that repository.

name: "Check PR Title"
on:
pull_request:
types: [opened, synchronize, reopened, ready_for_review, labeled, unlabeled, converted_to_draft, edited]

jobs:
check-pr-title:
name: Check PR Title
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
submodules: false
- name: Enforce PR title
uses: realm/ci-actions/title-checker@main
with:
regex: R[A-Z]{2,6}-[0-9]{1,6}
error-hint: Invalid PR title. Make sure it's prefixed with the JIRA ticket the PR addresses or add the no-jira-ticket label.
ignore-labels: 'no-jira-ticket'
12 changes: 6 additions & 6 deletions .github/workflows/include-deploy-snapshot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,12 +41,12 @@ jobs:
path: ./packages/build/m2-buildrepo

- name: Publish SNAPSHOT to Maven Central
env:
GPG_SIGNING_KEY: ${{ secrets.GPG_SIGNING_KEY_BASE_64 }}
GPG_PASS_PHRASE: ${{ secrets.GPG_PASS_PHRASE }}
MAVEN_CENTRAL_USER: ${{ secrets.MAVEN_CENTRAL_USER }}
MAVEN_CENTRAL_PASSWORD: ${{ secrets.MAVEN_CENTRAL_PASSWORD }}
# env:
# GPG_SIGNING_KEY: ${{ secrets.GPG_SIGNING_KEY_BASE_64 }}
# GPG_PASS_PHRASE: ${{ secrets.GPG_PASS_PHRASE }}
# MAVEN_CENTRAL_USER: ${{ secrets.MAVEN_CENTRAL_USER }}
# MAVEN_CENTRAL_PASSWORD: ${{ secrets.MAVEN_CENTRAL_PASSWORD }}
working-directory: tools
run: |
export GPG_TTY=$(tty)
kotlin ./publish_snapshots.main.kts "../" "${{ inputs.version-label }}" "$GPG_SIGNING_KEY" "$GPG_PASS_PHRASE" "$MAVEN_CENTRAL_USER" "$MAVEN_CENTRAL_PASSWORD"
kotlin ./publish_snapshots.main.kts "../" "${{ inputs.version-label }}" "${{ secrets.GPG_SIGNING_KEY_BASE_64 }}" "${{ secrets.GPG_PASS_PHRASE }}" "${{ secrets.MAVEN_CENTRAL_USER }}" "${{ secrets.MAVEN_CENTRAL_PASSWORD }}"
5 changes: 5 additions & 0 deletions .github/workflows/include-integration-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,11 @@ on:
required: true
type: string

env:
REALM_DISABLE_ANALYTICS: true
REALM_PRINT_ANALYTICS: true
REALM_FAIL_ON_ANALYTICS_ERRORS: true

jobs:

# TODO: The Monkey seems to crash the app all the time, but with failures that are not coming from the app. Figure out why.
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/issue-labeler.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
template: [ bug.yml, feature.yml ]

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- name: Parse issue form
uses: stefanbuck/github-issue-parser@c1a559d78bfb8dd05216dab9ffd2b91082ff5324 # v3.0.1
Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ concurrency:

env:
REALM_DISABLE_ANALYTICS: true
REALM_PRINT_ANALYTICS: true
CMAKE_C_COMPILER: /usr/local/bin/ccache-clang
CMAKE_CXX_COMPILER: /usr/local/bin/ccache-clang++
# Workflow environment variables are not available in Job if statements: https://github.com/actions/runner/issues/1661
Expand Down Expand Up @@ -231,7 +232,7 @@ jobs:
!cancelled() &&
!contains(needs.*.result, 'failure') &&
!contains(needs.*.result, 'cancelled') &&
needs.check-cache.outputs.jni-windows-lib-cache-hit != 'true'
needs.check-cache.outputs.jni-macos-lib-cache-hit != 'true'
steps:
- name: Checkout code
Expand Down
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
### Fixed
* Cache notification callback JNI references at startup to ensure that symbols can be resolved in core callbacks. (Issue [#1577](https://github.com/realm/realm-kotlin/issues/1577))
* Using `Realm.asFlow()` could miss an update if a write was started right after opening the Realm. (Issue [#1582](https://github.com/realm/realm-kotlin/issues/1582))
* Guarded analytic errors so that they do not fail user builds.
* [Sync] `NullPointerException` while waiting for the synchronization of a subscription set if the client was set in `AwaitingMark` state. (Issue [#1671](https://github.com/realm/realm-kotlin/issues/1671) [JIRA](https://jira.mongodb.org/browse/RKOTLIN-1027))
* Github Action: Snapshot publishing with Github Action. (Issue [#1654](https://github.com/realm/realm-kotlin/issues/1654) [JIRA](https://jira.mongodb.org/browse/RKOTLIN-1018))
* Github Action: automate release process to Maven Central. (Issue [JIRA](https://jira.mongodb.org/browse/RKOTLIN-709))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -217,18 +217,23 @@ class RealmCompilerSubplugin : KotlinCompilerPluginSupportPlugin, AnalyticsError
options.add(SubpluginOption(key = featureListPathKey, featureListPath))

// Gather target specific information
val targetInfo: TargetInfo? = gatherTargetInfo(kotlinCompilation)
val targetInfo: TargetInfo? = muteErrors {
gatherTargetInfo(kotlinCompilation)
}

// If we have something to submit register it for submission after the compilation has
// gathered the feature list information
targetInfo?.let {
kotlinCompilation.compileTaskProvider.get().doLast {
val analyticsService = provider.get()
val json = analyticsService.toJson(targetInfo)
if (printAnalytics) {
analyticsService.print(json)
}
if (submitAnalytics) {
analyticsService.submit(json)
muteErrors {
val analyticsService = provider.get()
val json = analyticsService.toJson(targetInfo)
if (printAnalytics) {
analyticsService.print(json)
}
if (submitAnalytics) {
analyticsService.submit(json)
}
}
}
}
Expand All @@ -237,6 +242,20 @@ class RealmCompilerSubplugin : KotlinCompilerPluginSupportPlugin, AnalyticsError
options
}
}

/**
* Wrapper that ignores error if `failOnAnalyticsError=true`.
*/
private fun <R> muteErrors(block: () -> R): R? {
return try {
block()
} catch (e: Throwable) {
when {
failOnAnalyticsError -> { throw e }
else -> { null }
}
}
}
}

/**
Expand Down Expand Up @@ -336,15 +355,19 @@ fun nativeTarget(target: KonanTarget) = when (target.family) {
}

// Helper method to ensure that we align architecture strings for Kotlin native builds
fun nativeArch(target: KonanTarget) = when (target.architecture) {
Architecture.X64 -> io.realm.kotlin.gradle.analytics.Architecture.X64.serializedName
Architecture.X86 -> io.realm.kotlin.gradle.analytics.Architecture.X86.serializedName
Architecture.ARM64 -> io.realm.kotlin.gradle.analytics.Architecture.ARM64.serializedName
Architecture.ARM32 -> io.realm.kotlin.gradle.analytics.Architecture.ARM.serializedName
Architecture.MIPS32 -> "Mips"
Architecture.MIPSEL32 -> "MipsEL32"
Architecture.WASM32 -> "Wasm"
else -> unknown(target.architecture.name)
fun nativeArch(target: KonanTarget): String = try {
when (target.architecture) {
Architecture.X64 -> io.realm.kotlin.gradle.analytics.Architecture.X64.serializedName
Architecture.X86 -> io.realm.kotlin.gradle.analytics.Architecture.X86.serializedName
Architecture.ARM64 -> io.realm.kotlin.gradle.analytics.Architecture.ARM64.serializedName
Architecture.ARM32 -> io.realm.kotlin.gradle.analytics.Architecture.ARM.serializedName
Architecture.MIPS32 -> "Mips"
Architecture.MIPSEL32 -> "MipsEL32"
Architecture.WASM32 -> "Wasm"
else -> unknown(target.architecture.name)
}
} catch (e: Throwable) {
unknown(target.architecture.name)
}

// Helper method to ensure that we align architecture strings for Android platforms
Expand Down

0 comments on commit dd00b06

Please sign in to comment.