Skip to content

Commit

Permalink
Merge branch 'develop' into dependabot/gradle/sqldelight-2.0.2
Browse files Browse the repository at this point in the history
  • Loading branch information
yamilmedina committed Aug 8, 2024
2 parents 63eece0 + be8472c commit 756d615
Show file tree
Hide file tree
Showing 170 changed files with 3,723 additions and 2,043 deletions.
127 changes: 85 additions & 42 deletions .github/workflows/benchmarks-check.yml
Original file line number Diff line number Diff line change
@@ -1,49 +1,92 @@
name: Benchmark Checks
on:
merge_group:
pull_request:
types: [ opened, synchronize ]
workflow_dispatch:
push:
branches:
- develop
pull_request:
branches:
- develop
types: [ opened, synchronize ]
workflow_dispatch:

concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.event.merge_group.head_sha }}
cancel-in-progress: true
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
detekt:
uses: ./.github/workflows/codestyle.yml
benchmarks-check:
needs: [ detekt ]
runs-on: ubuntu-latest
container: wirebot/cryptobox:1.4.0
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Java and Gradle
uses: ./.github/actions/setup-java-gradle
- name: Run Benchmarks
run: ./gradlew benchmark
- name: Generate HTML Report
run: ./gradlew jmhReport
- name: Archive Reports
if: always()
uses: actions/upload-artifact@v4
with:
name: benchmarks-reports
path: ./benchmarks/build/reports/benchmarks/**
- name: Create Benchmark Table
id: benchmark-table
uses: boswelja/[email protected]
with:
benchmark-results: ./benchmarks/build/reports/benchmarks/main/**/jvm.json
- name: Post Results
run: |
echo '## Benchmarks results ⏱️' >> $GITHUB_STEP_SUMMARY
echo '${{steps.benchmark-table.outputs.benchmark-table}}️' >> $GITHUB_STEP_SUMMARY
detekt:
uses: ./.github/workflows/codestyle.yml
benchmarks-check:
needs: [ detekt ]
permissions:
pull-requests: write
runs-on: ubuntu-latest
container: wirebot/cryptobox:1.4.0
env:
BENCHER_PROJECT: kalium-hgtkc47o
BENCHER_API_TOKEN: ${{ secrets.BENCHER_API_TOKEN }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Java and Gradle
uses: ./.github/actions/setup-java-gradle
- name: Run Benchmarks
run: ./gradlew benchmark
- name: Generate HTML Report
run: ./gradlew jmhReport
- name: Archive Reports
if: always()
uses: actions/upload-artifact@v4
with:
name: benchmarks-reports
path: ./benchmarks/build/reports/benchmarks/**
- name: Create Benchmark Table
id: benchmark-table
uses: boswelja/[email protected]
with:
benchmark-results: ./benchmarks/build/reports/benchmarks/main/**/jvm.json
- name: Post Results
run: |
echo '## Benchmarks results ⏱️' >> $GITHUB_STEP_SUMMARY
echo '${{steps.benchmark-table.outputs.benchmark-table}}️' >> $GITHUB_STEP_SUMMARY
- name: Cleanup Gradle Cache
# Remove some files from the Gradle cache, so they aren't cached by GitHub Actions.
# Restoring these files from a GitHub Actions cache might cause problems for future builds.
run: |
rm -f ~/.gradle/caches/modules-2/modules-2.lock
rm -f ~/.gradle/caches/modules-2/gc.properties
- name: Set JMH report full path
id: path
shell: bash
run: |
REPORT_FULL_PATH_REF="$(set -- ./benchmarks/build/reports/benchmarks/main/**/jvm.json; echo $1)"
echo "report_full_path=$REPORT_FULL_PATH_REF" >> $GITHUB_OUTPUT
unset REPORT_FULL_PATH_REF
- name: Install bencher
uses: bencherdev/[email protected]

- name: Run Bencher on PR
if: github.event.pull_request.head.repo.full_name == github.repository && github.event_name == 'pull_request'
run: |
bencher run \
--branch '${{ github.head_ref }}' \
--branch-start-point '${{ github.base_ref }}' \
--branch-start-point-hash '${{ github.event.pull_request.base.sha }}' \
--adapter java_jmh \
--testbed ubuntu-latest \
--err \
--github-actions '${{ secrets.GITHUB_TOKEN }}' \
--file ${{ steps.path.outputs.report_full_path }}
- name: Run Bencher on base branch
if: github.event_name == 'push' && github.ref_name == 'develop'
run: |
bencher run \
--branch develop \
--adapter java_jmh \
--testbed ubuntu-latest \
--err \
--file ${{ steps.path.outputs.report_full_path }}
- name: Cleanup Gradle Cache
# Remove some files from the Gradle cache, so they aren't cached by GitHub Actions.
# Restoring these files from a GitHub Actions cache might cause problems for future builds.
run: |
rm -f ~/.gradle/caches/modules-2/modules-2.lock
rm -f ~/.gradle/caches/modules-2/gc.properties
6 changes: 6 additions & 0 deletions .github/workflows/gradle-android-instrumented-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,12 @@ jobs:
with:
api-level: ${{ matrix.api-level }}

- name: Enable KVM group perms
run: |
echo 'KERNEL=="kvm", GROUP="kvm", MODE="0666", OPTIONS+="static_node=kvm"' | sudo tee /etc/udev/rules.d/99-kvm4all.rules
sudo udevadm control --reload-rules
sudo udevadm trigger --name-match=kvm
- name: Android Instrumentation Tests
uses: reactivecircus/android-emulator-runner@v2
env:
Expand Down
8 changes: 6 additions & 2 deletions .github/workflows/gradle-jvm-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@ concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.event.merge_group.head_sha }}
cancel-in-progress: true

env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}

jobs:
detekt:
uses: ./.github/workflows/codestyle.yml
Expand Down Expand Up @@ -83,9 +86,10 @@ jobs:
files: |
**/build/test-results/**/*.xml
- name: Upload Test Report
uses: codecov/codecov-action@v3
- name: Upload test report to codecov
uses: codecov/codecov-action@ab904c41d6ece82784817410c45d8b8c02684457
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: "build/reports/kover/report.xml"

- name: Archive Kover report
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/label-pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,6 @@ jobs:
name: Label PR based on title
runs-on: ubuntu-latest
steps:
- uses: srvaroa/labeler@v1.6.3
- uses: srvaroa/labeler@v1.8.2
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
package com.wire.kalium.cryptography

import com.wire.crypto.BufferedDecryptedMessage
import com.wire.crypto.Ciphersuite
import com.wire.crypto.ConversationConfiguration
import com.wire.crypto.CoreCrypto
import com.wire.crypto.CustomConfiguration
Expand All @@ -28,7 +29,6 @@ import com.wire.crypto.MlsCredentialType
import com.wire.crypto.MlsGroupInfoEncryptionType
import com.wire.crypto.MlsRatchetTreeType
import com.wire.crypto.MlsWirePolicy
import com.wire.crypto.Ciphersuite
import io.ktor.util.decodeBase64Bytes
import io.ktor.util.encodeBase64
import kotlin.time.Duration
Expand Down Expand Up @@ -332,18 +332,26 @@ class MLSClientImpl(
return clientId?.let {
WireIdentity(
CryptoQualifiedClientId.fromEncodedString(value.clientId)!!,
value.x509Identity?.handle,
value.x509Identity?.displayName,
value.x509Identity?.domain,
value.x509Identity?.certificate,
toDeviceStatus(value.status),
value.thumbprint,
value.x509Identity?.serialNumber,
value.x509Identity?.notAfter?.toLong()
toCredentialType(value.credentialType),
value.x509Identity?.let {
toX509Identity(it)
}
)
}
}

fun toX509Identity(value: com.wire.crypto.X509Identity) = WireIdentity.X509Identity(
handle = WireIdentity.Handle.fromString(value.handle, value.domain),
displayName = value.displayName,
domain = value.domain,
certificate = value.certificate,
serialNumber = value.serialNumber,
notBefore = value.notBefore.toLong(),
notAfter = value.notAfter.toLong()
)

fun toDeviceStatus(value: com.wire.crypto.DeviceStatus) = when (value) {
com.wire.crypto.DeviceStatus.VALID -> CryptoCertificateStatus.VALID
com.wire.crypto.DeviceStatus.EXPIRED -> CryptoCertificateStatus.EXPIRED
Expand Down Expand Up @@ -403,6 +411,11 @@ class MLSClientImpl(
CredentialType.X509 -> MlsCredentialType.X509
}

fun toCredentialType(value: MlsCredentialType) = when (value) {
MlsCredentialType.BASIC -> CredentialType.Basic
MlsCredentialType.X509 -> CredentialType.X509
}

fun toCrlRegistration(value: com.wire.crypto.CrlRegistration) = CrlRegistration(
value.dirty,
value.expiration
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,54 +78,19 @@ data class CryptoQualifiedClientId(

data class WireIdentity(
val clientId: CryptoQualifiedClientId,
val certificate: Certificate?,
val status: CryptoCertificateStatus,
val thumbprint: String,
val credentialType: CredentialType,
val x509Identity: X509Identity?
) {
companion object {
@Suppress("LongParameterList")
operator fun invoke(
clientId: CryptoQualifiedClientId,
handle: String?,
displayName: String?,
domain: String?,
certificate: String?,
status: CryptoCertificateStatus,
thumbprint: String?,
serialNumber: String?,
endTimestampSeconds: Long?
): WireIdentity {
@Suppress("ComplexCondition")
val certificateData = if (handle == null || displayName == null || domain == null || certificate == null
|| thumbprint == null || serialNumber == null || endTimestampSeconds == null
) {
null
} else {
Certificate(
Handle.fromString(handle, domain),
displayName,
domain,
certificate,
thumbprint,
serialNumber,
endTimestampSeconds
)
}
return WireIdentity(
clientId = clientId,
certificate = certificateData,
status = status
)
}
}

data class Certificate(
data class X509Identity(
val handle: Handle,
val displayName: String,
val domain: String,
val certificate: String,
val thumbprint: String,
val serialNumber: String,
val endTimestampSeconds: Long
val notBefore: Long,
val notAfter: Long
)

// WireIdentity handle format is "{scheme}%40{username}@{domain}"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@ package com.wire.kalium.logic.data.call

import com.wire.kalium.logic.data.conversation.Conversation
import com.wire.kalium.logic.data.id.ConversationId
import com.wire.kalium.logic.data.user.OtherUserMinimized
import com.wire.kalium.logic.data.user.UserId
import com.wire.kalium.logic.data.user.type.UserType

data class CallMetadataProfile(
val data: Map<ConversationId, CallMetadata>
Expand All @@ -37,7 +40,26 @@ data class CallMetadata(
val callerTeamName: String?,
val establishedTime: String? = null,
val callStatus: CallStatus,
val participants: List<Participant> = emptyList(),
val participants: List<ParticipantMinimized> = emptyList(),
val maxParticipants: Int = 0, // Was used for tracking
val protocol: Conversation.ProtocolInfo
)
val protocol: Conversation.ProtocolInfo,
val activeSpeakers: Map<UserId, List<String>> = mapOf(),
val users: List<OtherUserMinimized> = listOf()
) {
fun getFullParticipants(): List<Participant> = participants.map { participant ->
val user = users.firstOrNull { it.id == participant.userId }
val isSpeaking = (activeSpeakers[participant.id]?.contains(participant.clientId) ?: false) && !participant.isMuted
Participant(
id = participant.id,
clientId = participant.clientId,
name = user?.name,
isMuted = participant.isMuted,
isCameraOn = participant.isCameraOn,
isSpeaking = isSpeaking,
isSharingScreen = participant.isSharingScreen,
hasEstablishedAudio = participant.hasEstablishedAudio,
avatarAssetId = user?.completePicture,
userType = user?.userType ?: UserType.NONE
)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ package com.wire.kalium.logic.data.call
* [OneOnOne] for a 1:1 call
* [Conference] for a group cal
*/
enum class ConversationType {
enum class ConversationTypeForCall {
OneOnOne,
Conference,
ConferenceMls,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,3 +34,13 @@ data class Participant(
val avatarAssetId: UserAssetId? = null,
val userType: UserType = UserType.NONE,
)

data class ParticipantMinimized(
val id: QualifiedID,
val userId: QualifiedID,
val clientId: String,
val isMuted: Boolean,
val isCameraOn: Boolean,
val isSharingScreen: Boolean = false,
val hasEstablishedAudio: Boolean,
)
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,8 @@ data class MLSMigrationModel(
)

data class ConferenceCallingModel(
val status: Status
val status: Status,
val useSFTForOneOnOneCalls: Boolean
)

data class E2EIModel(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,12 @@

package com.wire.kalium.logic.data.id

import kotlinx.serialization.SerialName
import kotlinx.serialization.Serializable
import kotlin.jvm.JvmInline

@JvmInline
value class PlainId(val value: String)
@Serializable
value class PlainId(@SerialName("value") val value: String)

typealias TeamId = PlainId
Loading

0 comments on commit 756d615

Please sign in to comment.