Skip to content

Commit

Permalink
Merge branch 'master' of github.com:ooni/probe-android into dw-media-…
Browse files Browse the repository at this point in the history
…probe
  • Loading branch information
aanorbel committed Mar 26, 2024
2 parents 57a90cb + a8a7ccd commit b0d0f5d
Show file tree
Hide file tree
Showing 12 changed files with 304 additions and 165 deletions.
9 changes: 9 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# Please see the documentation for all configuration options:
# https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates
version: 2
updates:
- package-ecosystem: gradle
directory: "/"
schedule:
interval: "weekly"
open-pull-requests-limit: 10
19 changes: 0 additions & 19 deletions .github/workflows/archive.yml

This file was deleted.

19 changes: 0 additions & 19 deletions .github/workflows/build.yml

This file was deleted.

38 changes: 0 additions & 38 deletions .github/workflows/emulator.yml

This file was deleted.

38 changes: 0 additions & 38 deletions .github/workflows/firebase-app-distribution.yml

This file was deleted.

20 changes: 0 additions & 20 deletions .github/workflows/test.yml

This file was deleted.

180 changes: 180 additions & 0 deletions .github/workflows/validate.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,180 @@
# This workflow is triggered on push events to the repository
# It runs the following jobs:
# - build: Ensure the code builds
# - unit-test: Run unit tests
# - instrumented-test: Run instrumented tests
# - assemble-archive: Archive APKs
# - distribute: Upload artifact to Firebase App Distribution
name: Validate
on: [ push ]
jobs:
build:
name: Ensure the code builds
runs-on: ubuntu-latest

strategy:
matrix:
version:
- "StableFullRelease"
- "StableFdroidRelease"

steps:
- name: Set up JDK 17
uses: actions/setup-java@v4
with:
java-version: '17'
distribution: 'temurin'

- name: checkout
uses: actions/checkout@v4

- name: Build `StableFullRelease` and `StableFdroidRelease` variants
run: ./gradlew build${{ matrix.version }} && ./gradlew clean

unit-test:
name: Run unit tests
runs-on: ubuntu-latest
needs: [ build ]

steps:
- name: Set up JDK 17
uses: actions/setup-java@v4
with:
java-version: '17'
distribution: 'temurin'

- name: checkout
uses: actions/checkout@v4

- name: Run unit tests
run: ./gradlew testStableFullRelease

- name: Uploads test reports
uses: actions/upload-artifact@v4
if: failure()
with:
name: test-report
path: app/build/test-results/testStableFullDebugUnitTest

instrumented-test:
name: Run instrumented tests
runs-on: ubuntu-latest
needs: [ build ]

strategy:
matrix:
api-level: [ 29 ]
target: [ google_apis ]

steps:
- name: Set up JDK 17
uses: actions/setup-java@v4
with:
java-version: '17'
distribution: 'temurin'

- name: checkout
uses: actions/checkout@v4

- name: Run instrumented tests
uses: reactivecircus/android-emulator-runner@v2
with:
api-level: ${{ matrix.api-level }}
target: ${{ matrix.target }}
arch: x86_64
profile: pixel_3_xl
ram-size: 4096M
disable-animations: true
script: ./gradlew connectedStableFullDebugAndroidTest

- name: uploads test reports
uses: actions/upload-artifact@v4
if: failure()
with:
name: emulator-test-reports
path: app/build/reports/androidTests/connected/debug/flavors/stableFull/

assemble-archive:
name: Archive APKs
runs-on: ubuntu-latest

strategy:
matrix:
version:
- "StableFullDebug"
- "StableFdroidDebug"
- "DevFullDebug"
- "DevFullDebugAndroidTest"
needs: [ build ]

steps:
- name: checkout
uses: actions/checkout@v4

- name: Get issue number
uses: actions/github-script@v6
id: get_issue_number
with:
script: |
if (context.issue.number) {
// Return issue number if present
return context.issue.number;
} else {
// Otherwise return issue number from commit
return (
await github.rest.repos.listPullRequestsAssociatedWithCommit({
commit_sha: context.sha,
owner: context.repo.owner,
repo: context.repo.repo,
})
).data[0].number;
}
result-encoding: string

- name: Set up JDK 17
uses: actions/setup-java@v4
with:
java-version: '17'
distribution: 'temurin'

- name: Assemble APKs
if: success() && steps.get_issue_number.outputs.result
run: ./gradlew assemble${{ matrix.version }}
env:
PR_NUMBER: ${{ steps.get_issue_number.outputs.result }}

- name: uploads dev apk
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.version }}Apk
path: |
app/build/outputs/apk/devFull/debug/app-dev-full-debug.apk
app/build/outputs/apk/androidTest/devFull/debug/app-dev-full-debug-androidTest.apk
app/build/outputs/apk/stableFull/debug/app-stable-full-debug.apk
app/build/outputs/apk/stableFdroid/debug/app-stable-fdroid-debug.apk
distribute:
name: Upload artifact to Firebase App Distribution
runs-on: ubuntu-latest
needs: [ assemble-archive ]
steps:

- name: checkout
uses: actions/checkout@v4

- name: Download app APK
uses: actions/download-artifact@v4
with:
name: DevFullDebugApk

- name: Upload artifact to Firebase App Distribution
uses: wzieba/Firebase-Distribution-Github-Action@v1.7.0
id: uploadArtifact
with:
appId: ${{secrets.FIREBASE_APP_ID}}
serviceCredentialsFileContent: ${{ secrets.CREDENTIAL_FILE_CONTENT }}
groups: testers
file: devFull/debug/app-dev-full-debug.apk
- name: Write Summary
run: |
echo "View this release in the Firebase console: ${{ steps.uploadArtifact.outputs.FIREBASE_CONSOLE_URI }}" >> $GITHUB_STEP_SUMMARY
Loading

0 comments on commit b0d0f5d

Please sign in to comment.