You've already forked element-x-android
mirror of
https://github.com/element-hq/element-x-android.git
synced 2026-10-23 18:49:00 +03:00
The GitHub cache is limited to 10 GB per repository. About 15 jobs were writing the Gradle cache on develop, each adding up to several GB (dependencies, transforms and build cache), so the cache was always at the limit and entries were evicted. A job could then restore a Gradle User Home without its matching dependencies entry, which broke the nightly build on all the PRs. Only the debug build job and the unit tests job now write the cache on develop. All the other jobs only read it. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
64 lines
2.8 KiB
YAML
64 lines
2.8 KiB
YAML
name: Sonar
|
|
|
|
on:
|
|
workflow_dispatch:
|
|
pull_request:
|
|
merge_group:
|
|
push:
|
|
branches: [ main, develop ]
|
|
|
|
permissions: {}
|
|
|
|
# Enrich gradle.properties for CI/CD
|
|
env:
|
|
GRADLE_OPTS: -Dorg.gradle.jvmargs=-Xmx8g -XX:MaxMetaspaceSize=512m -Dfile.encoding=UTF-8 -XX:+HeapDumpOnOutOfMemoryError -XX:+UseG1GC -Dkotlin.daemon.jvm.options=-Xmx4g
|
|
CI_GRADLE_ARG_PROPERTIES: --stacktrace --warn -Dsonar.gradle.skipCompile=true --no-configuration-cache
|
|
GROUP: ${{ format('sonar-{0}', github.ref) }}
|
|
|
|
jobs:
|
|
sonar:
|
|
name: Sonar Quality Checks
|
|
runs-on: ubuntu-latest
|
|
# Allow all jobs on main and develop. Just one per PR.
|
|
concurrency:
|
|
group: ${{ format('sonar-{0}', github.ref) }}
|
|
cancel-in-progress: ${{ github.ref != 'refs/heads/main' && github.ref != 'refs/heads/develop' }}
|
|
steps:
|
|
- name: Free Disk Space (Ubuntu)
|
|
uses: jlumbroso/free-disk-space@54081f138730dfa15788a46383842cd2f914a1be
|
|
with:
|
|
# This might remove tools that are actually needed, if set to "true" but frees about 6 GB
|
|
tool-cache: true
|
|
# All of these default to true, but we should only need the 'android' one (and maybe swap-storage?)
|
|
android: false
|
|
dotnet: true
|
|
haskell: true
|
|
# This takes way too long to run (~2 minutes) and it saves only ~5.5GB
|
|
large-packages: false
|
|
docker-images: true
|
|
swap-storage: false
|
|
|
|
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
|
with:
|
|
# Ensure we are building the branch and not the branch after being merged on develop
|
|
# https://github.com/actions/checkout/issues/881
|
|
ref: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.sha || github.ref }}
|
|
persist-credentials: false
|
|
- name: Use JDK 21
|
|
uses: actions/setup-java@de7274f081f381c8f8158605e0321c36c376e2e6 # v6.0.1
|
|
with:
|
|
distribution: 'temurin' # See 'Supported distributions' for available options
|
|
java-version: '21'
|
|
- name: Configure gradle
|
|
uses: gradle/actions/setup-gradle@3f5f9adaf7d9fecd50b5935e54106014257a94e6 # v6.4.0
|
|
with:
|
|
cache-read-only: true # Only the debug build and unit tests jobs write the Gradle cache, see build.yml
|
|
- name: Build debug code and test fixtures
|
|
run: ./gradlew assembleGplayDebug createFullJarDebugTestFixtures :app:createFullJarGplayDebugTestFixtures $CI_GRADLE_ARG_PROPERTIES
|
|
- name: 🔊 Publish results to Sonar
|
|
env:
|
|
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
|
|
ORG_GRADLE_PROJECT_SONAR_LOGIN: ${{ secrets.SONAR_TOKEN }}
|
|
if: ${{ always() && env.SONAR_TOKEN != '' && env.ORG_GRADLE_PROJECT_SONAR_LOGIN != '' }}
|
|
run: ./gradlew sonar $CI_GRADLE_ARG_PROPERTIES
|