Skip to content

Update okhttp to v4.12.0 - autoclosed #1301

Update okhttp to v4.12.0 - autoclosed

Update okhttp to v4.12.0 - autoclosed #1301

Workflow file for this run

---
name: Build and Test
"on":
merge_group:
pull_request:
types:
- labeled
- synchronize
push:
branches:
- master
jobs:
ktlint:
name: ktlint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@3df4ab11eba7bda6032a0b82a6bb43b11571feac # v4
- uses: actions/setup-java@v3
with:
distribution: "temurin"
java-version: "17"
- uses: dorny/paths-filter@v2
id: changes
with:
filters: |
src:
- "**/*.kt"
- name: Gradle build
id: build
uses: gradle/gradle-build-action@v2
if: steps.changes.outputs.src == 'true'
with:
build-root-directory: project
arguments: |
ktlintCheck
build-test-lint:
name: Build, test & lint
runs-on: self-hosted
outputs:
apk-generated: ${{ steps.output.outputs.apk_generated}}
permissions:
contents: read
checks: write
steps:
- uses: actions/checkout@3df4ab11eba7bda6032a0b82a6bb43b11571feac # v4
- uses: actions/setup-java@v3
with:
distribution: "temurin"
java-version: "17"
- uses: dorny/paths-filter@v2
id: changes
with:
filters: |
src:
- ".github/workflows/build-and-test.yml"
- "project/app/src/**"
- "project/app/*.pro"
- "project/buildSrc/src/**"
- "project/*.gradle.kts"
- "project/app/*.gradle.kts"
- "project/gradle.properties"
- "project/gradle/wrapper/gradle-wrapper.properties"
- "project/gradle/libs.versions.toml"
- name: Gradle build
id: build
uses: gradle/gradle-build-action@v2
if: steps.changes.outputs.src == 'true'
with:
build-root-directory: project
arguments: |
assembleDebug
assembleAndroidTest
:app:compileOssReleaseSources
:app:assembleGmsDebugAndroidTest
:app:assembleOssDebugAndroidTest
:app:packageGmsDebugAndroidTest
:app:packageOssDebugAndroidTest
lint
app:createGmsDebugUnitTestCoverageReport --scan --stacktrace
- name: Upload apk artifact
if: steps.changes.outputs.src == 'true'
uses: actions/upload-artifact@v3
with:
name: apks
path: |
./project/app/build/outputs/apk/oss/debug/app-oss-debug.apk
- name: Generate output flag for other jobs
if: steps.changes.outputs.src == 'true'
id: output
run: echo "apk_generated=true" >> "$GITHUB_OUTPUT"
- name: Upload coverage
if: ${{ steps.changes.outputs.src == 'true' && (github.event_name == 'pull_request' && contains(github.event.pull_request.labels.*.name, 'integration-test-required')) || (github.event_name == 'push' && github.ref == 'refs/heads/master') }}
uses: codecov/codecov-action@v3
with:
files: ./project/app/build/reports/coverage/test/gms/debug/report.xml
flags: unittests
token: ${{ secrets.CODECOV_TOKEN }}
- name: JUnit Report Action
uses: mikepenz/action-junit-report@v3
if: steps.changes.outputs.src == 'true'
with:
report_paths: "**/build/test-results/test*UnitTest/TEST-*.xml"
- name: Upload lint report
uses: actions/upload-artifact@v3
with:
name: lint-report
path: project/app/build/reports/lint-results-gmsDebug.html
if: steps.changes.outputs.src == 'true'
fdroid-scanner:
name: F-Droid scanner
runs-on: ubuntu-latest
needs: build-test-lint
container:
image: registry.gitlab.com/fdroid/docker-executable-fdroidserver:master
steps:
- name: Download APK
uses: actions/download-artifact@v3
if: ${{ needs.build-test-lint.outputs.apk-generated }}
with:
name: apks
- name: Scan OSS APK
if: ${{ needs.build-test-lint.outputs.apk-generated }}
run: |
. /etc/profile.d/bsenv.sh && GRADLE_USER_HOME=${home_vagrant}/.gradle ${fdroidserver}/fdroid scanner app-oss-debug.apk
espresso-test:
name: "Espresso test"
runs-on: self-hosted
if: ${{ (github.event_name == 'push' && github.ref == 'refs/heads/master') || github.event_name == 'pull_request' || github.event_name == 'merge_group' }}
permissions:
contents: read
checks: write
needs: build-test-lint
strategy:
fail-fast: false
matrix:
android-api: [31]
flavour: [Oss, Gms]
steps:
- uses: nschloe/action-cached-lfs-checkout@v1
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
distribution: "temurin"
java-version: 17
- uses: dorny/paths-filter@v2
id: changes
with:
filters: |
src:
- ".github/workflows/build-and-test.yml"
- "project/app/src/**"
- "project/app/*.pro"
- "project/buildSrc/src/**"
- "project/*.gradle.kts"
- "project/app/*.gradle.kts"
- "project/gradle.properties"
- "project/gradle/wrapper/gradle-wrapper.properties"
- "project/gradle/libs.versions.toml"
- id: run-espresso-guard
run: |
if ${{ steps.changes.outputs.src == 'true' && github.event_name != 'pull_request' }}
then
echo "run-espresso=true" >> $GITHUB_OUTPUT
else
echo "run-espresso=false" >> $GITHUB_OUTPUT
fi
- run: echo "/android-sdk/platform-tools/" >> $GITHUB_PATH
- run: /android-sdk/cmdline-tools/latest/bin/sdkmanager "platforms;android-$API"
env:
API: ${{ matrix.android-api }}
- name: "Check snapshot exists"
id: check_snapshot_exists
uses: andstor/file-existence-action@v2
with:
files: "/android-sdk/user_home/avd/owntracks-test-${{ matrix.android-api }}-${{ matrix.flavour }}.avd/snapshots/default_boot/screenshot.png"
- name: Create AVD and generate snapshot for caching
if: steps.run-espresso-guard.outputs.run-espresso == 'true' && steps.check_snapshot_exists.outputs.files_exists == 'false'
uses: reactivecircus/android-emulator-runner@v2
with:
api-level: ${{ matrix.android-api }}
force-avd-creation: false
emulator-options: -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none -camera-front none
profile: pixel_3a
target: ${{ matrix.flavour == 'Gms' && 'google_apis' || 'default' }}
ram-size: 6000M
avd-name: owntracks-test-${{ matrix.android-api }}-${{ matrix.flavour }}
disable-animations: true
arch: x86_64
cores: 2
sdcard-path-or-size: 1000M
script: |
echo "Created AVD snapshot"
- name: Espresso Test
uses: reactivecircus/android-emulator-runner@v2
if: steps.run-espresso-guard.outputs.run-espresso == 'true'
timeout-minutes: 60
env:
# Only run the smoke tests on merge group events
FLAVOUR: ${{ matrix.flavour }}
with:
api-level: ${{ matrix.android-api }}
force-avd-creation: false
emulator-options: -no-snapshot-save -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none -camera-front none
profile: pixel_3a
target: ${{ matrix.flavour == 'Gms' && 'google_apis' || 'default' }}
ram-size: 6000M
disable-animations: true
avd-name: owntracks-test-${{ matrix.android-api }}-${{ matrix.flavour }}
arch: x86_64
cores: 2
sdcard-path-or-size: 1000M
script: |
adb logcat -d > emulator-startup.log
adb shell settings put global bluetooth_on 0
adb shell rm -rf /sdcard/googletest || echo "Couldn't delete googletest folder"
adb uninstall org.owntracks.android.debug || echo "org.owntracks.android not installed"
adb uninstall org.owntracks.android.debug.test || echo "org.owntracks.android.test not installed"
adb logcat -c
adb logcat > emulator.log & echo $! > logcat_file.pid
adb logcat "*:S MonitoringInstr:V AndroidJUnitRunner:V TestRequestBuilder:V TestExecutor:V TestRunner:V" --format=color & echo $! > logcat_console.pid
echo 0 > gradle.exit # Set a default exit code.
./project/gradlew -p project create${FLAVOUR}DebugCoverageReport --max-workers=1 --stacktrace --scan --no-daemon || echo $? > gradle.exit
# Stop capturing logcat output.
kill $(cat logcat_file.pid) || echo "::warning file=.github/workflows/ci.yml::Logcat process $(cat logcat_file.pid) didn't exist."
kill $(cat logcat_console.pid) || echo "::warning file=.github/workflows/ci.yml::Logcat process $(cat logcat_console.pid) didn't exist."
adb logcat -d --buffer=crash --format=color
exit $(cat gradle.exit)
- name: Upload logcat
if: always() && steps.run-espresso-guard.outputs.run-espresso == 'true'
uses: actions/upload-artifact@v3
with:
name: logcat-${{ matrix.android-api }}-${{ matrix.flavour }}
path: |
${{ github.workspace }}/emulator.log
${{ github.workspace }}/emulator-startup.log
- name: Upload connected test result artifact
uses: actions/upload-artifact@v3
with:
name: espresso-test-reports-${{ matrix.android-api }}-${{ matrix.flavour }}
path: ./project/app/build/reports/androidTests/connected/
if: always() && steps.run-espresso-guard.outputs.run-espresso == 'true'
- name: Espresso JUnit Report
uses: mikepenz/action-junit-report@v3
if: always() && steps.run-espresso-guard.outputs.run-espresso == 'true'
with:
report_paths: app/build/outputs/androidTest-results/connected/*.xml
- name: Upload connected test coverage artifact
uses: ./.github/actions/upload-artifact
with:
name: espresso-test-coverage-${{ matrix.android-api }}-${{ matrix.flavour }}
path: ./project/app/build/reports/coverage/androidTest/
if: always() && steps.run-espresso-guard.outputs.run-espresso == 'true'
- name: Upload coverage
if: ${{ (github.event_name == 'pull_request' && contains(github.event.pull_request.labels.*.name, 'integration-test-required')) || (github.event_name == 'push' && github.ref == 'refs/heads/master') }}
uses: codecov/codecov-action@v3
with:
files: ./project/app/build/reports/coverage/androidTest/${{ matrix.flavour == 'Gms' && 'gms' || 'oss' }}/debug/connected/report.xml
flags: uitests
token: ${{ secrets.CODECOV_TOKEN }}
publish-to-play-store:
name: "Publish to Play Store"
runs-on: self-hosted
permissions:
contents: read
checks: write
needs: espresso-test
if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/master' }}
steps:
- uses: actions/checkout@3df4ab11eba7bda6032a0b82a6bb43b11571feac # v4
- uses: actions/setup-java@v3
with:
distribution: "temurin"
java-version: "17"
- uses: dorny/paths-filter@v2
id: changes
with:
filters: |
src:
- ".github/workflows/build-and-test.yml"
- "project/app/src/**"
- "project/app/*.pro"
- "project/buildSrc/src/**"
- "project/*.gradle.kts"
- "project/app/*.gradle.kts"
- "project/gradle.properties"
- "project/gradle/wrapper/gradle-wrapper.properties"
- "project/gradle/libs.versions.toml"
- name: Create keystore
if: steps.changes.outputs.src == 'true'
run: |
echo -n $KEYSTORE_BASE64 | base64 -d > project/owntracks.release.keystore.jks
env:
KEYSTORE_BASE64: ${{ secrets.KEYSTORE_BASE64 }}
- name: Gradle build
if: steps.changes.outputs.src == 'true'
uses: gradle/gradle-build-action@v2
env:
KEYSTORE_PASSPHRASE: ${{ secrets.KEYSTORE_PASSPHRASE }}
ANDROID_PUBLISHER_CREDENTIALS: ${{ secrets.GOOGLE_CLOUD_SERVICE_ACCOUNT_CREDENTIALS }}
GOOGLE_MAPS_API_KEY: ${{ secrets.GOOGLE_MAPS_API_KEY }}
with:
build-root-directory: project
arguments: |
publishGmsReleaseBundle --stacktrace --scan