Skip to content

Commit

Permalink
Merge branch 'develop' into feat/testservice-debugging
Browse files Browse the repository at this point in the history
  • Loading branch information
mythsunwind committed Nov 14, 2023
2 parents 94c994b + b0c7e37 commit 572407c
Show file tree
Hide file tree
Showing 791 changed files with 27,571 additions and 6,591 deletions.
22 changes: 22 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# To get started with Dependabot version updates, you'll need to specify which
# package ecosystems to update and where the package manifests are located.
# Please see the documentation for all configuration options:
# https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates

version: 2
updates:
- package-ecosystem: "gradle"
open-pull-requests-limit: 1
directory: "/"
schedule:
interval: "daily"
reviewers:
- "wireapp/android"

- package-ecosystem: "github-actions"
open-pull-requests-limit: 1
directory: "/"
schedule:
interval: "weekly"
reviewers:
- "wireapp/android"
115 changes: 102 additions & 13 deletions .github/workflows/cherry-pick-rc-to-develop.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,25 @@
# GitHub Action: Cherry-pick from `release/candidate` to `TARGET_BRANCH`
#
# This action automates the process of cherry-picking merged PRs from `release/candidate` branch to `TARGET_BRANCH`.
# It is triggered whenever a pull request is merged into `release/candidate`.
#
# The action performs the following steps:
# 1. Checkout the merged PR.
# 2. If changes are made outside the specified submodule or no submodule is specified, the action proceeds.
# 3. If a submodule name is provided in the `SUBMODULE_NAME` environment variable:
# a. The action creates a temporary branch.
# b. Updates the submodule to its latest version from `develop`.
# c. Commits the submodule updates.
# 4. Squashes the commit with the commit message of the merged PR (if a submodule was updated).
# 5. Cherry-picks the squashed (or original if no squashing occurred) commit to a new branch based on `develop`.
# 6. If any conflicts arise during the cherry-pick, they are committed.
# 7. The branch with the cherry-picked changes is pushed.
# 8. A new pull request is created against `develop` with the cherry-picked changes.
#
# Note: Ensure you add a "cherry-pick" label to your project. This label is required for the creation of cherry-picked PRs.
# If needed, you can also set the `TARGET_BRANCH` environment variable to specify a different target branch for the cherry-pick.
# By default, it's set to `develop`.

name: "Cherry-pick from rc to develop"

on:
Expand All @@ -7,6 +29,11 @@ on:
types:
- closed

env:

TARGET_BRANCH: develop
# SUBMODULE_NAME:

jobs:
cherry-pick:
runs-on: ubuntu-latest
Expand All @@ -17,9 +44,10 @@ jobs:

steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
fetch-depth: 0
submodules: recursive

- name: Append -cherry-pick to branch name
id: extract
Expand All @@ -29,27 +57,88 @@ jobs:
echo "New branch name: $NEW_BRANCH_NAME"
echo "newBranchName=$NEW_BRANCH_NAME" >> $GITHUB_ENV
- name: Check for changes excluding submodule
id: check_changes
run: |
if [[ -n "${{ env.SUBMODULE_NAME }}" ]]; then
# If SUBMODULE_NAME is set
NUM_CHANGES=$(git diff origin/${{ env.TARGET_BRANCH }} --name-only | grep -v "^${{ env.SUBMODULE_NAME }}/" | wc -l)
else
# If SUBMODULE_NAME is not set
NUM_CHANGES=$(git diff origin/${{ env.TARGET_BRANCH }} --name-only | wc -l)
fi
if [ "$NUM_CHANGES" -gt 0 ]; then
echo "shouldCherryPick=true" >> $GITHUB_ENV
else
if [[ -n "${{ env.SUBMODULE_NAME }}" ]]; then
echo "No changes outside of ${{ env.SUBMODULE_NAME }} submodule, skipping cherry-pick"
else
echo "No changes detected, skipping cherry-pick"
fi
echo "shouldCherryPick=false" >> $GITHUB_ENV
fi
- uses: fregante/setup-git-user@v2

- name: Update submodule
if: env.SUBMODULE_NAME && env.shouldCherryPick == 'true'
run: |
set -x
# Create a temporary branch and get the last commit message
git checkout -b temp-branch-for-cherry-pick
LAST_COMMIT_MESSAGE=$(git log --format=%B -n 1 ${{ github.event.pull_request.merge_commit_sha }})
cd ${{ env.SUBMODULE_NAME }}
git checkout ${{ env.TARGET_BRANCH }}
git pull origin ${{ env.TARGET_BRANCH }}
cd ..
git add ${{ env.SUBMODULE_NAME }}
git commit -m "Update submodule ${{ env.SUBMODULE_NAME }} to latest from ${{ env.TARGET_BRANCH }}"
echo "lastCommitMessage=LAST_COMMIT_MESSAGE" >> $GITHUB_ENV
- name: Get Cherry-pick commit
id: get-cherry
if: env.shouldCherryPick == 'true'
run: |
if [[ -n "${{ env.SUBMODULE_NAME }}" ]]; then
# If SUBMODULE_NAME is set
git reset --soft HEAD~2
git commit -m "${{ env.lastCommitMessage }}"
fi
# Get the SHA of the current commit (either squashed or not based on the condition above)
CHERRY_PICK_COMMIT=$(git rev-parse HEAD)
echo "cherryPickCommit=$CHERRY_PICK_COMMIT" >> $GITHUB_ENV
- name: Cherry-pick commits
id: cherry
id: commit-cherry-pick
if: env.shouldCherryPick == 'true'
run: |
git fetch origin develop:develop
git checkout -b ${{ env.newBranchName }} develop
# Cherry-picking the last commit on the base branch
OUTPUT=$(git cherry-pick ${{ github.event.pull_request.merge_commit_sha }} --strategy-option theirs || true)
CONFLICTS=$(echo "$OUTPUT" | grep 'CONFLICT' || echo "")
if [ -n "$CONFLICTS" ]; then
git add .
git cherry-pick --continue || true
# Checkout the desired branch and cherry-pick the commit
git checkout ${{ env.TARGET_BRANCH }}
git checkout -b ${{ env.newBranchName }}
OUTPUT=$(git cherry-pick ${{ env.cherryPickCommit }} || true)
# Handle conflicts
CONFLICTED_FILES=$(git diff --name-only --diff-filter=U | awk 'ORS="\\\\n"' | sed 's/\\\\n$/\\n/')
echo "Captured conflicted files: $CONFLICTED_FILES"
if [[ "$OUTPUT" == *"CONFLICT"* ]]; then
# Commit the remaining conflicts
git commit -am "Commit with unresolved merge conflicts outside of ${{ env.SUBMODULE_NAME }}"
fi
# Push branch and remove temp
git push origin ${{ env.newBranchName }} || (echo "Failed to push to origin" && exit 1)
echo "conflicts=$CONFLICTS" >> $GITHUB_ENV
echo "conflictedFiles=$CONFLICTED_FILES" >> $GITHUB_ENV
if [[ -n "${{ env.SUBMODULE_NAME }}" ]]; then
git branch -D temp-branch-for-cherry-pick
fi
- name: Create PR
if: env.shouldCherryPick == 'true'
env:
PR_TITLE: ${{ github.event.pull_request.title }}
PR_BRANCH: ${{ env.newBranchName }}
PR_ASSIGNEE: ${{ github.event.pull_request.user.login }}
PR_BODY: "${{ format('Cherry pick from the original PR: \n- #{0}\n\n---- \n\n ⚠️ Conflicts during cherry-pick:\n{1}\n\n{2}', github.event.pull_request.number, env.conflicts, github.event.pull_request.body) }}"
run: gh pr create --title "$PR_TITLE" --body "$PR_BODY" --base develop --head "$PR_BRANCH" --label "cherry-pick" --assignee "$PR_ASSIGNEE"
run: |
PR_BODY=$(echo -e "Cherry pick from the original PR: \n- #${{ github.event.pull_request.number }}\n\n---- \n\n ⚠️ Conflicts during cherry-pick:\n${{ env.conflictedFiles }}\n\n${{ github.event.pull_request.body }}")
gh pr create --title "$PR_TITLE" --body "$PR_BODY" --base ${{ env.TARGET_BRANCH }} --head "$PR_BRANCH" --label "cherry-pick" --assignee "$PR_ASSIGNEE"
2 changes: 1 addition & 1 deletion .github/workflows/codestyle.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up JDK 11
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/generate-changelog.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:

steps:
- name: 'Checkout Git repository with history for all branches and tags'
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
fetch-depth: 0

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/generate-dokka.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout project
uses: actions/checkout@v2
uses: actions/checkout@v4
with:
fetch-depth: 0

Expand Down
7 changes: 2 additions & 5 deletions .github/workflows/gradle-android-instrumented-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,20 +21,17 @@ jobs:

steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Set up JDK
uses: actions/setup-java@v3
uses: buildjet/setup-java@v3
with:
java-version: '17'
distribution: 'temurin'
cache: gradle

- name: Gradle Setup
uses: gradle/gradle-build-action@v2

- name: Validate Gradle wrapper
uses: gradle/wrapper-validation-action@e6e38bacfdf1a337459f332974bb2327a31aaf4b

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/gradle-android-unit-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:

steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
fetch-depth: 0

Expand Down
6 changes: 2 additions & 4 deletions .github/workflows/gradle-ios-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:

steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
fetch-depth: 0

Expand All @@ -27,12 +27,10 @@ jobs:
with:
java-version: '17'
distribution: 'temurin'
cache: gradle
# cache: gradle # Cache disabled as we use Gradle Setup below

- name: Gradle Setup
uses: gradle/gradle-build-action@v2
with:
cache-disabled: true

- name: Validate Gradle wrapper
uses: gradle/wrapper-validation-action@e6e38bacfdf1a337459f332974bb2327a31aaf4b
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/gradle-jvm-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ jobs:
container: wirebot/cryptobox:1.4.0
steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
fetch-depth: 0

Expand Down Expand Up @@ -84,7 +84,7 @@ jobs:
**/build/test-results/**/*.xml
- name: Upload Test Report
uses: codecov/codecov-action@v2
uses: codecov/codecov-action@v3
with:
files: "build/reports/kover/report.xml"

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@v0.9
- uses: srvaroa/labeler@v1.6.3
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
4 changes: 2 additions & 2 deletions .github/workflows/semantic-commit-lint.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name: "Semantic Commit Linting of PR titles"

on:
pull_request:
pull_request_target:
types: [ opened, edited, synchronize ]

jobs:
Expand All @@ -13,7 +13,7 @@ jobs:
HEAD: ${{github.head_ref}}
steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
fetch-depth: 0
# Please look up the latest version from
Expand Down
16 changes: 0 additions & 16 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,22 +7,6 @@

## How to build

### GitHub Packages authentication

In order to download some open source libraries published on GitHub Pacakges, a GitHub Personal Access Token is needed with `packages:read` scope.

1. You can generate one quickly [on this page](https://github.com/settings/tokens/new?description=ReadPackages&scopes=read:packages). Or, for more details, see [Creating a personal access token](https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/creating-a-personal-access-token).

2. In `local.properties` add:
```
github.package_registry.user=<github_username>
github.package_registry.token=<github_token>
```

Alternatively the credentials are also read from your environment if `GITHUB_USER` and `GITHUB_TOKEN` exists.

> *Note*: See [GitHub packages docs](https://docs.github.com/en/packages/learn-github-packages/introduction-to-github-packages#authenticating-to-github-packages) for more details and.
### Dependencies

- JDK 17 (ex: openjdk-17-jdk on Ubuntu)
Expand Down
7 changes: 0 additions & 7 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -71,13 +71,6 @@ allprojects {
mavenLocal()
google()
mavenCentral()
maven {
url = uri("https://maven.pkg.github.com/wireapp/core-crypto")
credentials {
username = getLocalProperty("github.package_registry.user", System.getenv("GITHUB_USER"))
password = getLocalProperty("github.package_registry.token", System.getenv("GITHUB_TOKEN"))
}
}
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ fun LibraryExtension.commonAndroidLibConfig(
includeNativeInterop: Boolean,
namespaceSuffix: String
) {
val sanitizedSuffix = namespaceSuffix.replace('-','.')
val sanitizedSuffix = namespaceSuffix.replace('-', '.')
namespace = "$BASE_NAMESPACE.$sanitizedSuffix"
compileSdk = Android.Sdk.compile
sourceSets.getByName("main").manifest.srcFile("src/androidMain/AndroidManifest.xml")
Expand All @@ -58,6 +58,7 @@ fun LibraryExtension.commonAndroidLibConfig(
resources.pickFirsts.add("google/protobuf/*.proto")
jniLibs.pickFirsts.add("**/libsodium.so")
}

// No Android Unit test. JVM does that. Android runs on emulator
sourceSets.remove(sourceSets.getByName("test"))

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ package com.wire.kalium.plugins

import org.jetbrains.kotlin.gradle.targets.jvm.KotlinJvmTarget

fun KotlinJvmTarget.commonJvmConfig(includeNativeInterop: Boolean) {
fun KotlinJvmTarget.commonJvmConfig(includeNativeInterop: Boolean, enableIntegrationTests: Boolean = false) {
compilations.all {
kotlinOptions.jvmTarget = "17"
kotlinOptions.freeCompilerArgs += "-opt-in=kotlin.RequiresOptIn"
Expand All @@ -35,4 +35,9 @@ fun KotlinJvmTarget.commonJvmConfig(includeNativeInterop: Boolean) {
}
}
}
if (enableIntegrationTests) {
testRuns.getByName("integrationTest").executionTask.configure {
useJUnit()
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ class LibraryPlugin : Plugin<Project> {
val enableJs: Property<Boolean>
val enableJsTests: Property<Boolean>
val includeNativeInterop: Property<Boolean>
val enableIntegrationTests: Property<Boolean>
}

@get:Nested
Expand All @@ -53,7 +54,8 @@ class LibraryPlugin : Plugin<Project> {
enableApple = multiplatformConfiguration.enableApple.getOrElse(true),
enableJs = multiplatformConfiguration.enableJs.getOrElse(true),
enableJsTests = multiplatformConfiguration.enableJsTests.getOrElse(true),
includeNativeInterop = multiplatformConfiguration.includeNativeInterop.getOrElse(false)
includeNativeInterop = multiplatformConfiguration.includeNativeInterop.getOrElse(false),
enableIntegrationTests = multiplatformConfiguration.enableIntegrationTests.getOrElse(false)
)
}
}
Expand Down
Loading

0 comments on commit 572407c

Please sign in to comment.