WIP: NS is broken at this commit, but I am working on migrating the m… #361
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: Network Survey CI | |
on: | |
pull_request: | |
branches: | |
- 'develop' | |
push: | |
branches: | |
- 'develop' | |
# Allows you to run this workflow manually from the Actions tab | |
workflow_dispatch: | |
jobs: | |
build: | |
if: "! startsWith(github.event.head_commit.message, 'Bump version to')" | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout the code | |
uses: actions/checkout@v4 | |
- name: Set up JDK 17 | |
uses: actions/setup-java@v4 | |
with: | |
java-version: 17 | |
distribution: 'temurin' | |
cache: 'gradle' | |
- name: Build CDR APK | |
env: | |
NS_API_KEY: ${{ secrets.NS_API_KEY }} | |
run: ./gradlew assembleCdrDebug | |
-PnsApiKey=$NS_API_KEY | |
- name: Get APK name | |
run: echo "base_name=`./gradlew :networksurvey:properties -q | grep 'archivesBaseName:' | awk '{print $2}'`" >> $GITHUB_ENV | |
- name: Upload CDR APK | |
uses: actions/upload-artifact@v4 | |
with: | |
name: Network Survey CDR Debug APK | |
path: networksurvey/build/outputs/apk/cdr/debug/${{ env.base_name }}-cdr-debug.apk | |
- name: Save google-services.json | |
env: | |
GOOGLE_SERVICES: ${{ secrets.GOOGLE_SERVICES }} | |
run: echo "$GOOGLE_SERVICES" > networksurvey/google-services.json | |
- name: Build Regular APK | |
env: | |
NS_API_KEY: ${{ secrets.NS_API_KEY }} | |
run: ./gradlew assembleRegularDebug | |
-PnsApiKey=$NS_API_KEY | |
- name: Upload Regular APK | |
uses: actions/upload-artifact@v4 | |
with: | |
name: Network Survey Regular Debug APK | |
path: networksurvey/build/outputs/apk/regular/debug/${{ env.base_name }}-regular-debug.apk | |
test: | |
if: "! startsWith(github.event.head_commit.message, 'Bump version to')" | |
name: Run Tests | |
runs-on: macos-latest | |
strategy: | |
matrix: | |
api-level: [ 26, 35 ] | |
target: [ default, google_apis ] | |
steps: | |
- name: Checkout the code | |
uses: actions/checkout@v4 | |
- name: Set up JDK 17 | |
uses: actions/setup-java@v4 | |
with: | |
java-version: 17 | |
distribution: 'temurin' | |
cache: 'gradle' | |
- name: Save google-services.json | |
env: | |
GOOGLE_SERVICES: ${{ secrets.GOOGLE_SERVICES }} | |
run: echo "$GOOGLE_SERVICES" > networksurvey/google-services.json | |
- name: Unit Tests | |
run: ./gradlew test --stacktrace | |
# Need to work through a permissions error to get these working | |
# - name: Instrumentation Tests | |
# uses: reactivecircus/android-emulator-runner@v2 | |
# with: | |
# api-level: ${{ matrix.api-level }} | |
# target: ${{ matrix.target }} | |
# arch: x86_64 | |
# profile: Nexus 6 | |
# script: ./gradlew test check connectedCheck -x lint --stacktrace | |
# Only upload the reports on failure | |
- name: Upload Reports | |
uses: actions/upload-artifact@v4 | |
with: | |
name: Test-Reports | |
path: networksurvey/build/reports | |
if: failure() |