Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ci: add android and compose lint [WPB-9287] #3021

Merged
merged 14 commits into from
May 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
66 changes: 66 additions & 0 deletions .github/workflows/code-analysis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
name: "Code Analysis"

on: [workflow_call]

permissions:
contents: read

jobs:
lint:
runs-on: buildjet-4vcpu-ubuntu-2204
# Add a bit more Metaspace size as it tends to fail on GH runner when running linter,
# Reduce a bit the memory allocation pool, as the 8GB set in gradle.properties is too much for CI
# AboutLibraries seems to go crazy when running lint checks. So we explicitly don't run it.
env:
GRADLE_OPTS: '-Dorg.gradle.jvmargs="-XX:MaxMetaspaceSize=1g -Xmx2G"'
DISABLE_ABOUT_LIBRARIES: TRUE
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@5188e9b5527a0a094cee21e2fe9a8ca44b4629af

- name: Run Linter
run: |
./gradlew lint
- 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

style:
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@5188e9b5527a0a094cee21e2fe9a8ca44b4629af
- 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
33 changes: 0 additions & 33 deletions .github/workflows/codestyle.yml

This file was deleted.

9 changes: 4 additions & 5 deletions .github/workflows/gradle-run-unit-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,9 @@ concurrency:
cancel-in-progress: true

jobs:
detekt:
uses: ./.github/workflows/codestyle.yml
code-analysis:
uses: ./.github/workflows/code-analysis.yml
unit-tests:
needs: [detekt]
runs-on: buildjet-8vcpu-ubuntu-2204

steps:
Expand Down Expand Up @@ -89,14 +88,14 @@ jobs:

build-beta:
if: ${{ github.event_name == 'pull_request' }}
needs: [unit-tests]
needs: [unit-tests, code-analysis]
uses: ./.github/workflows/build-app.yml
with:
flavour: "beta-debug"

build-dev:
if: ${{ github.event_name == 'pull_request' }}
needs: [unit-tests]
needs: [unit-tests, code-analysis]
uses: ./.github/workflows/build-app.yml
with:
flavour: "dev-debug"
Expand Down
5 changes: 5 additions & 0 deletions app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,11 @@ android {
}
}

aboutLibraries {
val isAboutLibrariesDisabled = System.getenv("DISABLE_ABOUT_LIBRARIES")?.equals("true", true) ?: false
registerAndroidTasks = !isAboutLibrariesDisabled
}

dependencies {
implementation("com.wire.kalium:kalium-logic")
implementation("com.wire.kalium:kalium-util")
Expand Down
Loading
Loading