2021-03-26 23:52:06 +01:00
|
|
|
name: APK Build
|
2021-03-25 12:26:26 +01:00
|
|
|
|
|
|
|
on:
|
2021-03-26 21:19:48 +01:00
|
|
|
pull_request: { }
|
2021-03-25 12:26:26 +01:00
|
|
|
push:
|
2021-05-06 18:25:34 +02:00
|
|
|
branches: [ main, develop ]
|
2021-03-25 12:26:26 +01:00
|
|
|
|
2021-09-08 13:03:51 +02:00
|
|
|
# Enrich gradle.properties for CI/CD
|
|
|
|
env:
|
2023-09-13 12:43:03 +02:00
|
|
|
GRADLE_OPTS: -Dorg.gradle.jvmargs="-Xmx3072m -Dfile.encoding=UTF-8 -XX:+HeapDumpOnOutOfMemoryError -XX:MaxMetaspaceSize=1g" -Dkotlin.daemon.jvm.options="-Xmx2560m" -Dkotlin.incremental=false
|
2022-08-03 16:53:27 +02:00
|
|
|
CI_GRADLE_ARG_PROPERTIES: --stacktrace -PpreDexEnable=false --max-workers 2 --no-daemon
|
2022-02-24 10:30:28 +01:00
|
|
|
|
2021-03-25 12:26:26 +01:00
|
|
|
jobs:
|
|
|
|
debug:
|
2021-05-19 17:38:32 +02:00
|
|
|
name: Build debug APKs (${{ matrix.target }})
|
2021-03-25 12:26:26 +01:00
|
|
|
runs-on: ubuntu-latest
|
2021-05-06 18:25:34 +02:00
|
|
|
if: github.ref != 'refs/heads/main'
|
2021-03-25 12:26:26 +01:00
|
|
|
strategy:
|
2021-03-25 13:33:46 +01:00
|
|
|
fail-fast: false
|
2021-03-25 12:26:26 +01:00
|
|
|
matrix:
|
|
|
|
target: [ Gplay, Fdroid ]
|
2022-02-28 13:31:36 +01:00
|
|
|
# Allow all jobs on develop. Just one per PR.
|
2022-02-23 23:58:51 +01:00
|
|
|
concurrency:
|
|
|
|
group: ${{ github.ref == 'refs/heads/develop' && format('integration-tests-develop-{0}-{1}', matrix.target, github.sha) || format('build-debug-{0}-{1}', matrix.target, github.ref) }}
|
|
|
|
cancel-in-progress: true
|
2021-03-25 12:26:26 +01:00
|
|
|
steps:
|
2024-07-15 18:12:08 +02:00
|
|
|
- uses: actions/checkout@v4
|
2023-02-16 17:49:52 +01:00
|
|
|
with:
|
|
|
|
# https://github.com/actions/checkout/issues/881
|
|
|
|
ref: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.sha || github.sha }}
|
2024-10-25 10:29:16 +02:00
|
|
|
- name: Use JDK 21
|
2024-07-15 18:12:08 +02:00
|
|
|
uses: actions/setup-java@v4
|
|
|
|
with:
|
|
|
|
distribution: 'temurin' # See 'Supported distributions' for available options
|
2024-10-25 10:29:16 +02:00
|
|
|
java-version: '21'
|
2023-01-19 12:20:16 +01:00
|
|
|
- name: Configure gradle
|
2024-07-15 18:12:08 +02:00
|
|
|
uses: gradle/actions/setup-gradle@v3
|
2021-03-25 12:26:26 +01:00
|
|
|
with:
|
2023-01-19 12:20:16 +01:00
|
|
|
cache-read-only: ${{ github.ref != 'refs/heads/develop' }}
|
2021-03-25 12:26:26 +01:00
|
|
|
- name: Assemble ${{ matrix.target }} debug apk
|
2023-10-02 13:58:51 +02:00
|
|
|
run: ./gradlew assemble${{ matrix.target }}Debug $CI_GRADLE_ARG_PROPERTIES
|
2021-03-25 13:53:35 +01:00
|
|
|
- name: Upload ${{ matrix.target }} debug APKs
|
2022-04-12 01:08:54 +02:00
|
|
|
uses: actions/upload-artifact@v3
|
2021-03-25 12:26:26 +01:00
|
|
|
with:
|
2021-05-19 17:38:32 +02:00
|
|
|
name: vector-${{ matrix.target }}-debug
|
2021-03-25 12:26:26 +01:00
|
|
|
path: |
|
2022-08-03 13:06:06 +02:00
|
|
|
vector-app/build/outputs/apk/*/debug/*.apk
|
2021-03-25 12:26:26 +01:00
|
|
|
|
2021-05-19 17:38:32 +02:00
|
|
|
release:
|
|
|
|
name: Build unsigned GPlay APKs
|
2021-03-25 12:26:26 +01:00
|
|
|
runs-on: ubuntu-latest
|
2022-06-14 17:01:38 +02:00
|
|
|
concurrency:
|
|
|
|
group: ${{ github.ref == 'refs/head/main' && format('build-release-apk-main-{0}', github.sha) || github.ref == 'refs/heads/develop' && format('build-release-apk-develop-{0}', github.sha) || format('build-debug-{0}', github.ref) }}
|
|
|
|
cancel-in-progress: ${{ github.ref != 'refs/head/main' }}
|
2021-03-25 12:26:26 +01:00
|
|
|
steps:
|
2024-07-15 18:12:08 +02:00
|
|
|
- uses: actions/checkout@v4
|
2023-02-16 17:49:52 +01:00
|
|
|
with:
|
|
|
|
# https://github.com/actions/checkout/issues/881
|
2023-02-23 10:05:45 +01:00
|
|
|
ref: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.sha || github.ref }}
|
2024-10-25 10:29:16 +02:00
|
|
|
- name: Use JDK 21
|
2024-07-15 18:12:08 +02:00
|
|
|
uses: actions/setup-java@v4
|
|
|
|
with:
|
|
|
|
distribution: 'temurin' # See 'Supported distributions' for available options
|
2024-10-25 10:29:16 +02:00
|
|
|
java-version: '21'
|
2023-01-19 12:20:16 +01:00
|
|
|
- name: Configure gradle
|
2024-07-15 18:12:08 +02:00
|
|
|
uses: gradle/actions/setup-gradle@v3
|
2021-03-25 12:26:26 +01:00
|
|
|
with:
|
2023-01-19 12:20:16 +01:00
|
|
|
cache-read-only: ${{ github.ref != 'refs/heads/develop' }}
|
2021-03-25 12:26:26 +01:00
|
|
|
- name: Assemble GPlay unsigned apk
|
2023-10-02 13:58:51 +02:00
|
|
|
run: ./gradlew clean assembleGplayRelease $CI_GRADLE_ARG_PROPERTIES
|
2021-03-25 13:53:35 +01:00
|
|
|
- name: Upload Gplay unsigned APKs
|
2022-04-12 01:08:54 +02:00
|
|
|
uses: actions/upload-artifact@v3
|
2021-03-25 12:26:26 +01:00
|
|
|
with:
|
2021-05-19 17:38:32 +02:00
|
|
|
name: vector-gplay-release-unsigned
|
2021-03-25 12:26:26 +01:00
|
|
|
path: |
|
2022-08-03 13:06:06 +02:00
|
|
|
vector-app/build/outputs/apk/*/release/*.apk
|
2021-03-25 12:26:26 +01:00
|
|
|
|
2022-06-14 17:01:38 +02:00
|
|
|
exodus:
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
needs: release
|
|
|
|
steps:
|
|
|
|
- name: Obtain apk from artifact
|
|
|
|
id: download
|
|
|
|
uses: actions/download-artifact@v3
|
|
|
|
with:
|
|
|
|
name: vector-gplay-release-unsigned
|
|
|
|
- name: Show apks in artifact
|
|
|
|
run: ls -R ${{steps.download.outputs.download-path}}
|
|
|
|
- name: Execute exodus-standalone
|
|
|
|
uses: docker://exodusprivacy/exodus-standalone:latest
|
|
|
|
with:
|
2024-01-02 08:16:27 +01:00
|
|
|
# Don't fail when finding trackers so they can be reported later
|
|
|
|
args: /github/workspace/gplay/release/vector-gplay-universal-release-unsigned.apk -j -o /github/workspace/exodus.json -e 0
|
2022-06-14 17:01:38 +02:00
|
|
|
- name: Upload exodus json report
|
|
|
|
uses: actions/upload-artifact@v3
|
|
|
|
with:
|
|
|
|
name: exodus.json
|
|
|
|
path: |
|
2022-06-17 14:36:07 +02:00
|
|
|
exodus.json
|
2022-06-14 17:01:38 +02:00
|
|
|
- name: Check for trackers
|
2024-01-02 08:16:27 +01:00
|
|
|
env:
|
|
|
|
SENTRY_ID: 447
|
|
|
|
# Should only contain a Sentry item
|
|
|
|
run: |
|
|
|
|
TRACKER_IDS=$(jq ".trackers[] | .id" exodus.json)
|
|
|
|
[ $TRACKER_IDS = ${{ env.SENTRY_ID }} ] || { echo '::error static analysis identified user tracking library' ; exit 1; }
|