Skip to content

Commit

Permalink
Test 2
Browse files Browse the repository at this point in the history
  • Loading branch information
borichellow committed May 21, 2024
1 parent 0186038 commit 74907ce
Show file tree
Hide file tree
Showing 15 changed files with 771 additions and 8 deletions.
46 changes: 46 additions & 0 deletions .github/workflows/build-app.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
name: "Build App"

on:
workflow_call:
inputs:
flavour:
required: true
type: string

jobs:
build-app:
runs-on: buildjet-8vcpu-ubuntu-2204
steps:
- name: Checkout
uses: actions/checkout@v4
with:
submodules: recursive # Needed in order to fetch Kalium sources for building
fetch-depth: 0
- name: Set up JDK 17
uses: buildjet/setup-java@v4
with:
java-version: '17'
distribution: 'temurin'
cache: gradle
- name: Build beta flavour
if: ${{ inputs.flavour == 'beta-debug' }}
env:
GITHUB_USER: ${{ github.actor }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
./gradlew assembleBetaDebug -p ./ --no-daemon
cp app/build/outputs/apk/beta/debug/com.wire.*.apk wire-android-${{inputs.flavour}}-pr-${{ github.event.pull_request.number }}.apk
- name: Build dev flavour
if: ${{ inputs.flavour == 'dev-debug' }}
env:
GITHUB_USER: ${{ github.actor }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
./gradlew assembleDevDebug -p ./ --no-daemon
cp app/build/outputs/apk/dev/debug/com.wire.*.apk wire-android-${{inputs.flavour}}-pr-${{ github.event.pull_request.number }}.apk
- name: Upload APK
if: success()
uses: actions/upload-artifact@v3
with:
name: wire-android-${{inputs.flavour}}-pr-${{ github.event.pull_request.number }}.apk
path: ./wire-android-${{inputs.flavour}}-pr-${{ github.event.pull_request.number }}.apk
59 changes: 59 additions & 0 deletions .github/workflows/check-kalium-commitish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
name: "Validate Kalium References"

on:
pull_request:
types: [ opened, synchronize ] # Don't rerun on `edited` to save time
paths:
- 'kalium'

jobs:
validate-kalium-ref:
runs-on: ubuntu-20.04

steps:
- name: Checkout
uses: actions/checkout@v4
with:
submodules: recursive # Needed in order to fetch Kalium sources for building
fetch-depth: 0

- name: Run git merge-base
id: validate_kalium
env:
GH_BASE_REF: ${{github.base_ref}}
continue-on-error: true
# git merge-base --is-ancestor A B returns 0 when A is ancestor of B
# In our case, if FROM is not an ancestor of TO, then it returns 1
run: |
KALIUM_TO_REF="$(git rev-parse HEAD:kalium)"
git fetch
git checkout "$GH_BASE_REF"
git pull
git submodule update
KALIUM_FROM_REF="$(git rev-parse HEAD:kalium)"
echo "kalium_from=$KALIUM_FROM_REF" >> $GITHUB_OUTPUT
echo "kalium_to=$KALIUM_TO_REF" >> $GITHUB_OUTPUT
cd kalium
git merge-base --is-ancestor "$KALIUM_FROM_REF" "$KALIUM_TO_REF" || echo "is_kalium_rollback=$?" >> $GITHUB_OUTPUT
unset KALIUM_TO_REF
unset KALIUM_FROM_REF
- name: Leave a comment
if: ${{ steps.validate_kalium.outputs.is_kalium_rollback == 1 }}
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
PR_AUTHOR: ${{ github.event.pull_request.user.login }}
KALIUM_FROM: ${{ steps.validate_kalium.outputs.kalium_from }}
KALIUM_TO: ${{ steps.validate_kalium.outputs.kalium_to }}
GH_BASE_REF: ${{github.base_ref}}
GH_HEAD_REF: ${{github.head_ref}}
run: |
gh pr comment "$GH_HEAD_REF" --body "@$PR_AUTHOR looks like you are rolling back kalium to a previous commitish.
This means that the PR's target branch ($GH_BASE_REF) is using a newer version of Kalium, and the changes in this PR will rollback Kalium to an older version.
| $GH_BASE_REF | This PR |
| ------------ | ------- |
| [$KALIUM_FROM](https://github.com/wireapp/kalium/tree/$KALIUM_FROM) | [$KALIUM_TO](https://github.com/wireapp/kalium/tree/$KALIUM_TO) |
Is this intentional?"
48 changes: 48 additions & 0 deletions .github/workflows/cherry-pick-pr-to-newer-release-cycle.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
# GitHub Action: Cherry-pick merged PRs 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 the target branch.
# 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 target.
# 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.

name: "Cherry-pick from RC to develop"

on:
pull_request:
branches:
- release/candidate
types:
- closed

jobs:
cherry-pick:
runs-on: ubuntu-latest
if: github.event.pull_request.merged == true

env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

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

- name: Cherry pick to `develop`
uses: wireapp/[email protected]
with:
target-branch: develop
submodules-target-branch: develop
pr-title-suffix: 🍒
pr-labels: cherry-pick
33 changes: 33 additions & 0 deletions .github/workflows/codestyle.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: "Check Codestyle"

on: [workflow_call]

permissions:
contents: read

jobs:
static-code-analysis:
runs-on: buildjet-2vcpu-ubuntu-2204
steps:
- name: Checkout
uses: actions/checkout@v4
with:
submodules: recursive # Needed in order to fetch Kalium sources for building
fetch-depth: 0
- name: Set up JDK 17
uses: buildjet/setup-java@v4
with:
java-version: '17'
distribution: 'temurin'
cache: gradle
- name: Validate Gradle wrapper
uses: gradle/wrapper-validation-action@216d1ad2b3710bf005dc39237337b9673fd8fcd5
- name: Run Detekt
run: |
./gradlew detektAll
- 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
59 changes: 59 additions & 0 deletions .github/workflows/crowdin-source-updater.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
name: "Crowdin Action - Base Source Updater"

# **What it does**: Download new source from crowdin project.
# **Why we have it**: We want to be able to pull-update base (EN) translations to the project.
# **Who does it impact**: Everyone collaborating on the project, and the translators.
# For more info: https://github.com/crowdin/github-action/blob/master/action.yml

on:
workflow_dispatch:

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
synchronize-with-crowdin:
runs-on: ubuntu-latest

env:
GITHUB_USER: "AndroidBob"
GITHUB_TOKEN: ${{ secrets.ANDROID_BOB_GH_TOKEN }}

steps:
- name: Checkout
uses: actions/checkout@v4

- name: "Exit if the branch is not default 'develop'"
run: |
if [[ "${{ github.ref }}" != "refs/heads/develop" ]]; then
echo "Branch is not develop, exiting."
exit 0
fi
- name: Crowdin action
uses: crowdin/github-action@v1
with:
project_id: ${{ secrets.CROWDIN_PROJECT_ID }}
token: ${{ secrets.CROWDIN_API_TOKEN }}

download_sources: true
push_sources: true
upload_sources: false
download_translations: true
upload_translations: false

create_pull_request: true
localization_branch_name: chore/sync-and-update-localization-source
commit_message: "chore: update localization sources from Crowdin"
pull_request_title: "chore: update localization sources from Crowdin"
pull_request_body: "This PR pulls in the latest localization **source** from Crowdin."
github_user_name: "AndroidBob"
github_user_email: "[email protected]"

pull_request_labels: "l10n, crowdin"
pull_request_assignees: "AndroidBob"
pull_request_team_reviewers: "wireapp/android"
pull_request_base_branch_name: ${{env.BASE_BRANCH}}

config: "crowdin.yml"
72 changes: 72 additions & 0 deletions .github/workflows/crowdin-translations-updater.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
name: "Crowdin Action"

# **What it does**: Upload strings to crowdin project for translations and creates a PR with updates.
# **Why we have it**: We want to externalize and automate the translations process.
# **Who does it impact**: Everyone collaborating on the project.
# For more info: https://github.com/crowdin/github-action/blob/master/action.yml

on:
push:
branches: [ develop ]

workflow_dispatch:
inputs:
baseBranch:
description: "Base branch to create the PR and update the localization strings"
required: true
default: "develop"
type: choice
options:
- "develop"
- "release/candidate"

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
synchronize-with-crowdin:
runs-on: ubuntu-latest

env:
GITHUB_USER: "AndroidBob"
GITHUB_TOKEN: ${{ secrets.ANDROID_BOB_GH_TOKEN }}

steps:
- name: Checkout
uses: actions/checkout@v4

- name: "Set base branch from input"
env:
INPUT_BASE_BRANCH: ${{github.event.inputs.baseBranch}}
if: "${{ github.event.inputs.baseBranch != '' }}"
run: echo "BASE_BRANCH=$INPUT_BASE_BRANCH" >> "$GITHUB_ENV"

- name: "Set base branch to default branch"
if: "${{ github.event.inputs.baseBranch == '' }}"
run: echo "BASE_BRANCH=develop" >> "$GITHUB_ENV"

- name: Crowdin action
uses: crowdin/github-action@v1
with:
project_id: ${{ secrets.CROWDIN_PROJECT_ID }}
token: ${{ secrets.CROWDIN_API_TOKEN }}

upload_sources: true
download_translations: true
upload_translations: false

create_pull_request: true
localization_branch_name: chore/sync-and-update-localization-${{env.BASE_BRANCH}}
commit_message: "chore: update localization strings via Crowdin"
pull_request_title: "chore: update localization strings via Crowdin"
pull_request_body: "This PR pulls in the latest localization translations from Crowdin."
github_user_name: "AndroidBob"
github_user_email: "[email protected]"

pull_request_labels: "l10n, crowdin"
pull_request_assignees: "AndroidBob"
pull_request_team_reviewers: "wireapp/android"
pull_request_base_branch_name: ${{env.BASE_BRANCH}}

config: "crowdin.yml"
59 changes: 59 additions & 0 deletions .github/workflows/generate-changelog.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
name: 'Generate Changelog'

on:
workflow_dispatch:
inputs:
current-release-tag:
type: string
description: 'The tag of the current release starting with v'
required: false
default: ''
push:
tags:
- 'v*'

jobs:
Changelog:
runs-on: ubuntu-latest

steps:
- name: 'Checkout Git repository with history for all branches and tags'
uses: actions/checkout@v4
with:
fetch-depth: 0
submodules: recursive # Needed in order to fetch Kalium sources for building

- name: 'Set current Git tag from input'
env:
INPUT_RELEASE_TAG: ${{github.event.inputs.current-release-tag}}
if: "${{ github.event.inputs.current-release-tag != '' }}"
run: echo "CURRENT_TAG=$INPUT_RELEASE_TAG" >> "$GITHUB_ENV"

- name: 'Set current Git tag from commit'
if: "${{ github.event.inputs.current-release-tag == '' }}"
run: echo "CURRENT_TAG=$(git tag --points-at ${{github.sha}} | grep -E '^v[0-9]+\.[0-9]+\.[0-9]+(\+|$)' | tail -n 1)" >> "$GITHUB_ENV"

- name: 'Set previous Git tag from commit'
run: echo "PREVIOUS_TAG=$(git tag | grep -E '^v[0-9]+\.[0-9]+\.[0-9]+(\+|$)' | tail -n 2 | head -n 1)" >> "$GITHUB_ENV"

- name: 'Print environment variables'
run: |
echo -e "PREVIOUS_TAG = $PREVIOUS_TAG"
echo -e "CURRENT_TAG = $CURRENT_TAG"
echo -e "Node.js version = $(node --version)"
- name: 'Generate changelog'
run: |
echo "{}" > ./package.json
npx [email protected] -t "$PREVIOUS_TAG...$CURRENT_TAG"
- name: 'Attach changelog to tag'
uses: softprops/action-gh-release@v2
env:
GITHUB_TOKEN: ${{github.token}}
with:
tag_name: ${{env.CURRENT_TAG}}
name: ${{env.CURRENT_TAG}}
body_path: ./CHANGELOG.md
draft: false
prerelease: false
Loading

0 comments on commit 74907ce

Please sign in to comment.