Skip to content

Commit

Permalink
ci: run code style and lint in parallel
Browse files Browse the repository at this point in the history
  • Loading branch information
vitorhugods committed May 22, 2024
1 parent 80c72fd commit 4e2feee
Showing 1 changed file with 28 additions and 6 deletions.
34 changes: 28 additions & 6 deletions .github/workflows/codestyle.yml
Original file line number Diff line number Diff line change
@@ -1,21 +1,46 @@
name: "Check Codestyle"
name: "Code Analysis"

on: [workflow_call]

permissions:
contents: read

jobs:
static-code-analysis:
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
Expand All @@ -33,9 +58,6 @@ jobs:
- name: Run Detekt
run: |
./gradlew detektAll
- 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.
Expand Down

0 comments on commit 4e2feee

Please sign in to comment.