<commit_before># Builds, tests and publishes the output to the Play store internal track.
name: Android CI

on:
  push:
    branches:
      - master
    paths-ignore:
      - ".github/**"
      - "!.github/workflows/android.yml"
      - "*.md"
      - ".dependabot/**"
  pull_request:
    branches:
      - master

jobs:
  test:
    name: Build & Test
    runs-on: macos-latest
    steps:
    - uses: actions/checkout@v2
    - name: set up JDK 11
      uses: actions/setup-java@v1
      with:
        java-version: 11
    - uses: actions/cache@v2
      with:
        path: |
          ~/.gradle/caches
          ~/.gradle/wrapper
        key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*') }}
        restore-keys: |
          ${{ runner.os }}-gradle-
    - name: Build with Gradle
      run: ./gradlew assembleDebug
      working-directory: project
      timeout-minutes: 10
    - name: Run unit tests
      run: ./gradlew check jacocoTestDebugUnitTestReport
      working-directory: project
      timeout-minutes: 10
    - name: Test with Gradle on the emulator api=29
      uses: reactivecircus/android-emulator-runner@v2
      with:
        api-level: 29
        script: cd project && ./gradlew createDebugCoverageReport
        profile: pixel_3a
        target: google_apis
      timeout-minutes: 15
    - name: Gather xunit files into a single dir
      run: | 
          mkdir -p ./project/app/build/test-results/collected/
          cp -v ./project/app/build/test-results/testDebugUnitTest/*.xml ./project/app/build/test-results/collected/ || true
          cp -v ./project/app/build/outputs/androidTest-results/connected/*.xml ./project/app/build/test-results/collected/ || true
      if: always()
    - name: Upload unit test result artifact
      uses: actions/upload-artifact@v2
      with:
        name: unit-test-results
        path: project/app/build/test-results/testDebugUnitTest
      if: always()
    - name: Upload connected test result artifact
      uses: actions/upload-artifact@v2
      with:
        name: test-reports
        path: project/app/build/reports/
      if: always()
    - name: Report Test results
      uses: growse/xunit-mattermost-reporter@v1
      with:
        mattermostWebhookUrl: ${{ secrets.MATTERMOST_WEBHOOK }}
        xUnitTestPath: "./project/app/build/test-results/collected/"
      if: always()
    - uses: codecov/codecov-action@v1
      name: Upload espresso coverage to codecov
      if: always()
      with:
        file: ./project/app/build/reports/coverage/debug/report.xml
        flags: uitests
    - uses: codecov/codecov-action@v1
      name: Upload unit coverage to codecov<commit_msg>Don't post to MM on PR forks<commit_after># Builds, tests and publishes the output to the Play store internal track.
name: Android CI

on:
  push:
    branches:
      - master
    paths-ignore:
      - ".github/**"
      - "!.github/workflows/android.yml"
      - "*.md"
      - ".dependabot/**"
  pull_request:
    branches:
      - master

jobs:
  test:
    name: Build & Test
    runs-on: macos-latest
    steps:
    - uses: actions/checkout@v2
    - name: set up JDK 11
      uses: actions/setup-java@v1
      with:
        java-version: 11
    - uses: actions/cache@v2
      with:
        path: |
          ~/.gradle/caches
          ~/.gradle/wrapper
        key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*') }}
        restore-keys: |
          ${{ runner.os }}-gradle-
    - name: Build with Gradle
      run: ./gradlew assembleDebug
      working-directory: project
      timeout-minutes: 10
    - name: Run unit tests
      run: ./gradlew check jacocoTestDebugUnitTestReport
      working-directory: project
      timeout-minutes: 10
    - name: Test with Gradle on the emulator api=29
      uses: reactivecircus/android-emulator-runner@v2
      with:
        api-level: 29
        script: cd project && ./gradlew createDebugCoverageReport
        profile: pixel_3a
        target: google_apis
      timeout-minutes: 15
    - name: Gather xunit files into a single dir
      run: | 
          mkdir -p ./project/app/build/test-results/collected/
          cp -v ./project/app/build/test-results/testDebugUnitTest/*.xml ./project/app/build/test-results/collected/ || true
          cp -v ./project/app/build/outputs/androidTest-results/connected/*.xml ./project/app/build/test-results/collected/ || true
      if: always()
    - name: Upload unit test result artifact
      uses: actions/upload-artifact@v2
      with:
        name: unit-test-results
        path: project/app/build/test-results/testDebugUnitTest
      if: always()
    - name: Upload connected test result artifact
      uses: actions/upload-artifact@v2
      with:
        name: test-reports
        path: project/app/build/reports/
      if: always()
    - name: Report Test results      
      uses: growse/xunit-mattermost-reporter@v1
      with:
        mattermostWebhookUrl: ${{ secrets.MATTERMOST_WEBHOOK }}
        xUnitTestPath: "./project/app/build/test-results/collected/"
      if:  github.repository == 'owntracks/android'
    - uses: codecov/codecov-action@v1
      name: Upload espresso coverage to codecov
      if: always()
      with:
        file: ./project/app/build/reports/coverage/debug/report.xml
        flags: uitests
    - uses: codecov/codecov-action@v1
      name: Upload unit coverage to codecov
{'fraction_non_alphanumeric': 0.113822652757079, 'fraction_numerical': 0.00894187779433681, 'mean_word_length': 2.1360981308411215, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 6}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1979359', 'n_tokens_mistral': 1731, 'n_tokens_neox': 1638, 'n_words': 402}