Merge pull request #118 from HLCaptain/mapbox-upgrade #180
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: SonarCloud Analysis and Tests | |
on: | |
push: | |
branches: [ main ] | |
pull_request: | |
branches: [ main ] | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up JDK 17 | |
uses: actions/setup-java@v3 | |
with: | |
java-version: '17' | |
distribution: 'temurin' | |
cache: gradle | |
- name: Cache SonarCloud packages | |
uses: actions/[email protected] | |
with: | |
path: | | |
~/.sonar/cache | |
key: ${{ runner.os }}-sonar | |
restore-keys: | | |
${{ runner.os }}-sonar | |
- name: Caching via actions/[email protected] | |
uses: actions/[email protected] | |
with: | |
path: | | |
~/.gradle/caches | |
~/.gradle/wrapper | |
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }} | |
restore-keys: | | |
${{ runner.os }}-gradle- | |
- name: Put keys into gradle.properties | |
run: | | |
echo -e "\n" >> gradle.properties | |
echo "MAPBOX_ACCESS_TOKEN=${{ secrets.MAPBOX_ACCESS_TOKEN }}" >> gradle.properties | |
echo "MAPBOX_DOWNLOADS_TOKEN=${{ secrets.MAPBOX_DOWNLOADS_TOKEN }}" >> gradle.properties | |
echo "SDK_REGISTRY_TOKEN=${{ secrets.MAPBOX_DOWNLOADS_TOKEN }}" >> gradle.properties | |
- name: Put keys into local.properties for Gradle Secrets Android plugin | |
run: | | |
echo -e "\n" >> local.properties | |
echo "ADMOB_APPLICATION_ID=${{ secrets.ADMOB_APPLICATION_ID }}" >> local.properties | |
- name: Create blank google-services.json | |
run: cat app/google-services.json | base64 | |
- name: Put data into google-services.json file | |
env: | |
DATA: ${{ secrets.GOOGLE_SERVICES_JSON }} | |
run: echo $DATA > app/google-services.json | |
- name: Grant execute permission for gradlew | |
run: chmod +x gradlew | |
- name: Build and Run Unit tests | |
run: bash ./gradlew test | |
- name: Build and Analyze via SonarCloud | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any | |
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} | |
run: ./gradlew build sonarqube --info |