Comprobacion test local correcto #49
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: Android Tests | |
on: | |
push: | |
branches: | |
- main | |
- develop | |
jobs: | |
# android-unit-tests: | |
# name: Android Unit Tests | |
# runs-on: ubuntu-22.04 | |
# steps: | |
# - name: Checkout repository | |
# uses: actions/checkout@v4 | |
# - name: Set up JDK 17 | |
# uses: actions/setup-java@v4 | |
# with: | |
# distribution: "temurin" | |
# java-version: 17 | |
# cache: "gradle" | |
# - name: Gradle cache | |
# uses: gradle/actions/setup-gradle@v3 | |
# - name: Make gradlew executable | |
# working-directory: ./AndroidProject | |
# run: chmod +x ./gradlew | |
# - name: Android units tests | |
# working-directory: ./AndroidProject | |
# env: | |
# GITHUB_TOKEN: ${{ secrets.TOKEN }} | |
# run: ./gradlew clean jacocoTestReport sonarqube | |
# - name: Android unit tests artifacts | |
# if: always() | |
# uses: actions/upload-artifact@v4 | |
# with: | |
# name: unit-tests-artifacts | |
# path: ./AndroidProject/app/build/reports/tests/testDebugUnitTest/ | |
android-tests: | |
name: Android Tests | |
runs-on: ubuntu-latest | |
steps: | |
- name: checkout | |
uses: actions/checkout@v4 | |
- name: Enable KVM | |
run: | | |
echo 'KERNEL=="kvm", GROUP="kvm", MODE="0666", OPTIONS+="static_node=kvm"' | sudo tee /etc/udev/rules.d/99-kvm4all.rules | |
sudo udevadm control --reload-rules | |
sudo udevadm trigger --name-match=kvm | |
- name: Set up JDK 17 | |
uses: actions/setup-java@v4 | |
with: | |
distribution: "temurin" | |
java-version: 17 | |
cache: "gradle" | |
- name: Gradle cache | |
uses: gradle/actions/setup-gradle@v3 | |
- name: Make gradlew executable | |
working-directory: ./AndroidProject | |
run: chmod +x ./gradlew | |
- name: Run Android tests | |
uses: reactivecircus/android-emulator-runner@v2 | |
with: | |
api-level: 29 | |
working-directory: ./AndroidProject | |
profile: pixel_2 | |
target: google_apis | |
disable-animations: true | |
emulator-options: -no-window -gpu off -no-snapshot -noaudio -no-boot-anim | |
script: ./gradlew clean jacocoTestReport sonar | |
- name: Android tests reports | |
if: always() | |
uses: actions/upload-artifact@v4 | |
with: | |
name: test-reports | |
path: ./AndroidProject/app/build/reports/ | |
- name: Android tests outputs | |
if: always() | |
uses: actions/upload-artifact@v4 | |
with: | |
name: test-outputs | |
path: ./AndroidProject/app/build/outputs/ | |
# build: | |
# name: Build APK | |
# runs-on: ubuntu-22.04 | |
# needs: [android-tests] | |
# if: github.ref == 'refs/heads/main' | |
# steps: | |
# - name: Checkout repository | |
# uses: actions/checkout@v4 | |
# - name: Set up JDK 17 | |
# uses: actions/setup-java@v4 | |
# with: | |
# distribution: "temurin" | |
# java-version: 17 | |
# cache: "gradle" | |
# - name: Gradle cache | |
# uses: gradle/actions/setup-gradle@v3 | |
# - name: Make gradlew executable | |
# working-directory: ./AndroidProject | |
# run: chmod +x ./gradlew | |
# - name: Build APK | |
# working-directory: ./AndroidProject | |
# run: ./gradlew assembleDebug | |
# - name: Upload APK as artifact | |
# uses: actions/upload-artifact@v4 | |
# with: | |
# name: app-debug-apk | |
# path: AndroidProject/app/build/outputs/apk/debug/app-debug.apk | |