🔖 Bump to version 7.0.0 (#311) #1350
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: CI | |
on: | |
push: | |
branches: | |
- main | |
- v*.*.* # Version branches such as v4.2.1 | |
pull_request: | |
workflow_dispatch: | |
inputs: | |
git-ref: | |
description: Git Ref (optional) | |
required: false | |
jobs: | |
java-tests: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout (latest) | |
uses: actions/checkout@v3 | |
if: github.event.inputs.git-ref == '' | |
- name: Checkout (custom ref) | |
uses: actions/checkout@v3 | |
if: github.event.inputs.git-ref != '' | |
with: | |
ref: ${{ github.event.inputs.git-ref }} | |
- name: Store Gradle cache | |
uses: actions/cache@v3 | |
with: | |
path: ~/.gradle/caches | |
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*') }} | |
restore-keys: ${{ runner.os }}-gradle- | |
- name: Disable TCP/UDP Offloading (Linux) | |
shell: bash | |
run: sudo ethtool -K eth0 tx off rx off | |
- name: Set up Android SDK | |
uses: malinskiy/action-android/install-sdk@release/0.1.4 | |
# This cache below is not fully working: it should go above the "Set up Android SDK" but: | |
# - The action does not support having a SDK already setup -> platform-tools, licenses are re-downloaded | |
# - Having this cache still prevents Gradle to re-download every time the build-tools. | |
- name: Store Android SDK | |
uses: actions/cache@v3 | |
with: | |
path: ${{ env.ANDROID_HOME }} | |
key: ${{ runner.os }}-android-${{ hashFiles('**/*.gradle*') }} | |
restore-keys: ${{ runner.os }}-android- | |
- name: Build & Run Java tests | |
run: ./gradlew build assemble assembleAndroidTest | |
- name: Junit Report to Annotations | |
uses: turpif/junit-report-annotations-action@v2.0.1 | |
if: failure() | |
with: | |
access-token: ${{ secrets.GITHUB_TOKEN }} | |
name: "Java JUnit Report" | |
- name: Upload all human readable reports (JUnit+Lint+Detekt+Jacoco) | |
uses: actions/upload-artifact@v3 | |
if: failure() | |
with: | |
name: junit-report | |
path: "**/build/reports/**/*" | |
- name: Upload XML reports for quality-tests | |
uses: actions/upload-artifact@v3 | |
with: | |
name: java-quality-reports | |
path: | | |
**/reports/**/*.xml | |
**/TEST-*.xml | |
android-tests: | |
runs-on: ubuntu-latest | |
timeout-minutes: 30 | |
strategy: | |
fail-fast: false | |
matrix: | |
include: | |
- api: '30' | |
abi: 'x86' | |
tag: 'google_apis' | |
- api: '31' | |
abi: 'x86_64' | |
tag: 'google_apis' | |
# api 32 is an interim release of Android without api changes, so it is skipped here | |
- api: '33' | |
abi: 'x86_64' | |
tag: 'google_apis' | |
- api: '34' | |
abi: 'x86_64' | |
tag: 'google_apis' | |
steps: | |
- name: Checkout (latest) | |
uses: actions/checkout@v3 | |
if: github.event.inputs.git-ref == '' | |
- name: Checkout (custom ref) | |
uses: actions/checkout@v3 | |
if: github.event.inputs.git-ref != '' | |
with: | |
ref: ${{ github.event.inputs.git-ref }} | |
- name: Enable KVM group perms | |
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: Setup Java 11 | |
uses: actions/setup-java@v3 | |
with: | |
distribution: 'temurin' | |
java-version: '11' | |
- name: Store Gradle cache | |
uses: actions/cache@v3 | |
with: | |
path: ~/.gradle/caches | |
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*') }} | |
restore-keys: ${{ runner.os }}-gradle- | |
- name: Run all Android tests | |
uses: reactivecircus/android-emulator-runner@v2 | |
with: | |
api-level: ${{ matrix.api }} | |
target: ${{ matrix.tag }} | |
arch: ${{ matrix.abi }} | |
# Use a medium size skin rather than default size. Some tests need to have a decent size. | |
emulator-options: -no-window -no-snapshot-save -noaudio -no-boot-anim -skin 360x640 | |
disable-animations: true | |
script: | | |
adb logcat -c # clear logs | |
mkdir artifacts && touch artifacts/logcat.log && chmod +w artifacts/logcat.log | |
adb logcat >> artifacts/logcat.log & | |
./gradlew gordon --tests=androidx.test.filters.FlakyTest && ./gradlew connectedCheck -Pandroid.testInstrumentationRunnerArguments.notAnnotation=androidx.test.filters.FlakyTest | |
- name: Upload logcat output | |
uses: actions/upload-artifact@v3 | |
if: failure() | |
with: | |
name: logcat-${{ matrix.api }} | |
path: artifacts/logcat.log | |
- name: Junit Report to Annotations | |
uses: turpif/junit-report-annotations-action@v2.0.1 | |
if: failure() | |
with: | |
access-token: ${{ secrets.GITHUB_TOKEN }} | |
name: "Android JUnit Report (API ${{ matrix.api }})" | |
- name: Upload all human readable reports (JUnit+Jacoco) | |
uses: actions/upload-artifact@v3 | |
if: failure() | |
with: | |
name: junit-report-${{ matrix.api }} | |
path: "**/build/reports" | |
- name: Upload XML reports for quality-tests | |
uses: actions/upload-artifact@v3 | |
if: matrix.api == '34' # Only report latest supported version | |
with: | |
name: android-quality-reports | |
path: | | |
**/reports/**/*.xml | |
**/TEST-*.xml | |
**/test-results/gordon/*.xml | |
# @TODO: sonarqube doesn't work with Java 11, it needs 17 version as minimum, but the project doesn't build when using Java 17 (there are Kapt errors, which needed to be fixed) | |
# quality-tests: | |
# runs-on: ubuntu-latest | |
# | |
# needs: | |
# - java-tests | |
# - android-tests | |
# | |
# steps: | |
# - name: Checkout (latest) | |
# uses: actions/checkout@v3 | |
# if: github.event.inputs.git-ref == '' | |
# with: | |
# # Fetch the whole history to activate the auto-assignment of Sonar issues. | |
# # Also, Sonar needs the base branch to be fetched in order to provide a good report. | |
# fetch-depth: 0 | |
# | |
# - name: Checkout (custom ref) | |
# uses: actions/checkout@v3 | |
# if: github.event.inputs.git-ref != '' | |
# with: | |
# fetch-depth: 0 # Same as above | |
# ref: ${{ github.event.inputs.git-ref }} | |
# | |
# # Sonar drops support of Java 11 in favor of the Java 17. | |
# # See https://docs.sonarsource.com/sonarcloud/appendices/announcements/#january-15-end-of-support-for-java-11 | |
# - name: Setup Java 17 | |
# uses: actions/setup-java@v3 | |
# with: | |
# distribution: 'temurin' | |
# java-version: '17' | |
# | |
# - name: Download quality reports of java-tests | |
# uses: actions/download-artifact@v3 | |
# with: | |
# name: java-quality-reports | |
# | |
# - name: Download quality reports of android-tests | |
# uses: actions/download-artifact@v3 | |
# with: | |
# name: android-quality-reports | |
# | |
# - name: SonarQube Analysis | |
# run: ./gradlew sonarqube | |
# env: | |
# SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} | |
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
deploy-development-artifacts: | |
runs-on: ubuntu-latest | |
if: github.event_name == 'push' # Only deploy on merge | |
needs: | |
- java-tests | |
- android-tests | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Disable TCP/UDP Offloading (Linux) | |
shell: bash | |
run: sudo ethtool -K eth0 tx off rx off | |
- name: Set up Android SDK | |
uses: malinskiy/action-android/install-sdk@release/0.1.4 | |
- name: Deploy artifacts and notify on Slack | |
env: | |
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }} | |
SONATYPE_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }} | |
MAVEN_SECRING_GPG_BASE64: ${{ secrets.MAVEN_SECRING_GPG_BASE64 }} | |
MAVEN_SECRING_PASSWORD: ${{ secrets.MAVEN_SECRING_PASSWORD }} | |
run: ./gradlew publishToSonatype closeAndReleaseSonatypeStagingRepository sendReleaseDeployedToSonatypeMessageToSlack |