Skip to content

Release 1.5.1 (#362) #649

Release 1.5.1 (#362)

Release 1.5.1 (#362) #649

Workflow file for this run

# Integration workflow: runs on pull requests targeting master/develop and on pushes to master.
# This workflow performs code checks, caching of dependencies, and SonarQube analysis.
name: Integration
on:
workflow_dispatch:
push:
branches:
- master
pull_request:
types: [ opened, synchronize, reopened ]
branches:
- master
- develop
concurrency:
group: integration-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
jobs:
build:
name: Integration
runs-on: macos-latest
env:
GRADLE_OPTS: >-
-Dorg.gradle.internal.http.connectionTimeout=60000
-Dorg.gradle.internal.http.socketTimeout=60000
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up Node 20
uses: actions/setup-node@v4
with:
node-version: 20
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
distribution: 'zulu'
java-version: 17
- name: Configure API keys and google-services.json
shell: bash
env:
GOOGLE_AUTH_SERVER_CLIENT_ID: ${{ secrets.GOOGLE_AUTH_SERVER_CLIENT_ID }}
GOOGLE_AUTH_SERVER_CLIENT_ID_STAGING: ${{ secrets.GOOGLE_AUTH_SERVER_CLIENT_ID_STAGING }}
GOOGLE_MAPS_ANDROID_API_KEY_STAGING: ${{ secrets.GOOGLE_MAPS_ANDROID_API_KEY_STAGING }}
GOOGLE_MAPS_ANDROID_API_KEY_PRODUCTION: ${{ secrets.GOOGLE_MAPS_ANDROID_API_KEY_PRODUCTION }}
GOOGLE_SERVICES_JSON_STAGING: ${{ secrets.GOOGLE_SERVICES_JSON_STAGING }}
GOOGLE_SERVICES_JSON: ${{ secrets.GOOGLE_SERVICES_JSON }}
GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}
run: |
echo google.auth.server.client.id=$GOOGLE_AUTH_SERVER_CLIENT_ID > ./local.properties
echo google.auth.server.client.id.staging=$GOOGLE_AUTH_SERVER_CLIENT_ID_STAGING >> ./local.properties
echo google.maps.android.api.key.staging=$GOOGLE_MAPS_ANDROID_API_KEY_STAGING >> ./local.properties
echo google.maps.android.api.key.production=$GOOGLE_MAPS_ANDROID_API_KEY_PRODUCTION >> ./local.properties
echo "✅ local.properties configured for staging."
mkdir -p ./apps/android/src/staging/
echo "$GOOGLE_SERVICES_JSON_STAGING" > ./apps/android/src/staging/google-services.json.asc
gpg -d --passphrase "$GPG_PASSPHRASE" --batch ./apps/android/src/staging/google-services.json.asc > ./apps/android/src/staging/google-services.json
if [ ! -s ./apps/android/src/staging/google-services.json ]; then
echo "❌ Decryption failed or file is empty (staging)!"
exit 1
fi
mkdir -p ./apps/android/src/production/
echo "$GOOGLE_SERVICES_JSON" > ./apps/android/src/production/google-services.json.input
if grep -q '"project_info"' ./apps/android/src/production/google-services.json.input; then
cp ./apps/android/src/production/google-services.json.input ./apps/android/src/production/google-services.json
else
gpg -d --passphrase "$GPG_PASSPHRASE" --batch ./apps/android/src/production/google-services.json.input > ./apps/android/src/production/google-services.json
fi
if [ ! -s ./apps/android/src/production/google-services.json ]; then
echo "❌ Decryption failed or file is empty (production)!"
exit 1
fi
echo "✅ Production google-services.json prepared."
- name: Cache SonarQube packages
uses: actions/cache@v4
with:
path: ~/.sonar/cache
key: ${{ runner.os }}-sonar
restore-keys: ${{ runner.os }}-sonar
- name: Cache Gradle packages
uses: actions/cache@v3
with:
path: ~/.gradle/caches
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle') }}
restore-keys: ${{ runner.os }}-gradle
- name: Build, check and analyze with SonarQube
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
shell: bash
run: |
for attempt in 1 2; do
if ./gradlew check sonar --stacktrace; then
exit 0
fi
if [ "$attempt" -eq 2 ]; then
exit 1
fi
echo "Gradle check+sonar failed on attempt $attempt. Retrying once..."
done