element-android-Github/.github/workflows/build.yml

91 lines
3.6 KiB
YAML
Raw Normal View History

2021-03-27 06:52:06 +08:00
name: APK Build
on:
2021-03-27 04:19:48 +08:00
pull_request: { }
push:
2021-05-07 00:25:34 +08:00
branches: [ main, develop ]
# Enrich gradle.properties for CI/CD
env:
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 22:53:27 +08:00
CI_GRADLE_ARG_PROPERTIES: --stacktrace -PpreDexEnable=false --max-workers 2 --no-daemon
2022-02-24 17:30:28 +08:00
jobs:
debug:
2021-05-19 23:38:32 +08:00
name: Build debug APKs (${{ matrix.target }})
runs-on: ubuntu-latest
2021-05-07 00:25:34 +08:00
if: github.ref != 'refs/heads/main'
strategy:
fail-fast: false
matrix:
target: [ Gplay, Fdroid ]
2022-02-28 20:31:36 +08:00
# Allow all jobs on develop. Just one per PR.
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
steps:
- uses: actions/checkout@v3
with:
# https://github.com/actions/checkout/issues/881
ref: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.sha || github.sha }}
- name: Configure gradle
uses: gradle/gradle-build-action@v2
with:
cache-read-only: ${{ github.ref != 'refs/heads/develop' }}
- name: Assemble ${{ matrix.target }} debug apk
run: ./gradlew assemble${{ matrix.target }}RustCryptoDebug $CI_GRADLE_ARG_PROPERTIES
- name: Upload ${{ matrix.target }} debug APKs
uses: actions/upload-artifact@v3
with:
2021-05-19 23:38:32 +08:00
name: vector-${{ matrix.target }}-debug
path: |
vector-app/build/outputs/apk/*/debug/*.apk
2021-05-19 23:38:32 +08:00
release:
name: Build unsigned GPlay APKs
runs-on: ubuntu-latest
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' }}
steps:
- uses: actions/checkout@v3
with:
# https://github.com/actions/checkout/issues/881
ref: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.sha || github.ref }}
- name: Configure gradle
uses: gradle/gradle-build-action@v2
with:
cache-read-only: ${{ github.ref != 'refs/heads/develop' }}
- name: Assemble GPlay unsigned apk
run: ./gradlew clean assembleGplayRustCryptoRelease $CI_GRADLE_ARG_PROPERTIES
- name: Upload Gplay unsigned APKs
uses: actions/upload-artifact@v3
with:
2021-05-19 23:38:32 +08:00
name: vector-gplay-release-unsigned
path: |
vector-app/build/outputs/apk/*/release/*.apk
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:
2023-05-03 20:01:16 +08:00
args: /github/workspace/gplayRustCrypto/release/vector-gplay-rustCrypto-universal-release-unsigned.apk -j -o /github/workspace/exodus.json
- name: Upload exodus json report
uses: actions/upload-artifact@v3
with:
name: exodus.json
path: |
2022-06-17 20:36:07 +08:00
exodus.json
- name: Check for trackers
run: "jq -e '.trackers == []' exodus.json > /dev/null || { echo '::error static analysis identified user tracking library' ; exit 1; }"