144 lines
4.8 KiB
YAML
144 lines
4.8 KiB
YAML
version: 3
|
|
jobs:
|
|
build:
|
|
docker:
|
|
- image: cimg/android:2022.03.1
|
|
working_directory: ~/ultrasonic
|
|
environment:
|
|
JVM_OPTS: -Xmx3200m
|
|
steps:
|
|
- checkout
|
|
- restore_cache:
|
|
keys:
|
|
- v2-ultrasonic-{{ .Branch }}-{{ checksum "gradle/libs.versions.toml" }}
|
|
- v2-ultrasonic-{{ .Branch }}
|
|
- v2-ultrasonic
|
|
- run:
|
|
name: configure gradle.properties for CI building
|
|
command: |
|
|
sed -i '/^org.gradle.jvmargs/d' gradle.properties
|
|
sed -i 's/^org.gradle.daemon=true/org.gradle.daemon=false/g' gradle.properties
|
|
- run:
|
|
name: checkstyle
|
|
command: ./gradlew -Pqc ktlintCheck
|
|
- run:
|
|
name: static analysis
|
|
command: ./gradlew -Pqc detekt
|
|
- run:
|
|
name: build debug
|
|
command: ./gradlew assembleDebug
|
|
- run:
|
|
name: unit-tests
|
|
command: |
|
|
./gradlew ciTest testDebugUnitTest
|
|
./gradlew jacocoFullReport
|
|
- run:
|
|
name: lint
|
|
command: ./gradlew :ultrasonic:lintRelease
|
|
- run:
|
|
name: build
|
|
command: ./gradlew buildRelease
|
|
- run:
|
|
name: assemble release
|
|
command: ./gradlew assembleRelease
|
|
- save_cache:
|
|
paths:
|
|
- ~/.gradle
|
|
key: v1-ultrasonic-{{ .Branch }}-{{ checksum "gradle/libs.versions.toml" }}
|
|
- store_artifacts:
|
|
path: ultrasonic/build/reports
|
|
destination: reports
|
|
- store_artifacts:
|
|
path: subsonic-api/build/reports
|
|
destination: reports
|
|
- store_artifacts:
|
|
path: build/reports/jacoco/jacocoFullReport/
|
|
push_translations:
|
|
docker:
|
|
- image: cimg/python:3.6
|
|
working_directory: ~/ultrasonic
|
|
steps:
|
|
- checkout
|
|
- run:
|
|
name: install transifex client
|
|
command: |
|
|
python -m venv ~/venv
|
|
. ~/venv/bin/activate
|
|
pip install transifex-client
|
|
- run:
|
|
name: configure transifex client
|
|
command: echo $'[https://www.transifex.com]\nhostname = https://www.transifex.com\nusername = api\npassword = '"${TRANSIFEX_PASSWORD}"$'\n' > ~/.transifexrc
|
|
- run:
|
|
name: push changes in translation files
|
|
command: |
|
|
. ~/venv/bin/activate
|
|
tx push -s
|
|
generate_signed_apk:
|
|
docker:
|
|
- image: cimg/android:2022.03.1
|
|
working_directory: ~/ultrasonic
|
|
steps:
|
|
- checkout
|
|
- restore_cache:
|
|
keys:
|
|
- v2-ultrasonic-{{ .Branch }}-{{ checksum "gradle/libs.versions.toml" }}
|
|
- v2-ultrasonic-{{ .Branch }}
|
|
- v2-ultrasonic
|
|
- run:
|
|
name: decrypt ultrasonic-keystore
|
|
command: openssl aes-256-cbc -K ${ULTRASONIC_KEYSTORE_KEY} -iv ${ULTRASONIC_KEYSTORE_IV} -in ultrasonic-keystore.enc -out ultrasonic-keystore -d
|
|
- run:
|
|
name: build release apk
|
|
command: ./gradlew build assembleRelease
|
|
- run:
|
|
name: sign release apk
|
|
command: |
|
|
export PATH="${JAVA_HOME}/bin:${PATH}"
|
|
mkdir -p /tmp/ultrasonic-release
|
|
${ANDROID_HOME}/build-tools/30.0.0/zipalign -v 4 ultrasonic/build/outputs/apk/release/ultrasonic-release-unsigned.apk /tmp/ultrasonic-release/ultrasonic-${CIRCLE_TAG}.apk
|
|
${ANDROID_HOME}/build-tools/30.0.0/apksigner sign --verbose --ks ~/ultrasonic/ultrasonic-keystore --ks-pass pass:${ULTRASONIC_KEYSTORE_STOREPASS} --key-pass pass:${ULTRASONIC_KEYSTORE_KEYPASS} /tmp/ultrasonic-release/ultrasonic-${CIRCLE_TAG}.apk
|
|
${ANDROID_HOME}/build-tools/30.0.0/apksigner verify --verbose /tmp/ultrasonic-release/ultrasonic-${CIRCLE_TAG}.apk
|
|
- persist_to_workspace:
|
|
root: /tmp/ultrasonic-release
|
|
paths:
|
|
- ultrasonic-*.apk*
|
|
publish_github_signed_apk:
|
|
docker:
|
|
- image: cimg/golang
|
|
steps:
|
|
- attach_workspace:
|
|
at: /tmp/ultrasonic-release
|
|
- run:
|
|
name: install ghr
|
|
command: go get -v github.com/tcnksm/ghr
|
|
- run:
|
|
name: publish release on github tag
|
|
command: ghr -u ${CIRCLE_PROJECT_USERNAME} -r ${CIRCLE_PROJECT_REPONAME} ${CIRCLE_TAG} /tmp/ultrasonic-release
|
|
workflows:
|
|
version: 2
|
|
build_and_push_translations:
|
|
jobs:
|
|
- build
|
|
- push_translations:
|
|
requires:
|
|
- build
|
|
filters:
|
|
branches:
|
|
only:
|
|
- develop
|
|
- generate_signed_apk:
|
|
filters:
|
|
tags:
|
|
only: /^[0-9]+(\.[0-9]+)*/
|
|
branches:
|
|
ignore: /.*/
|
|
- publish_github_signed_apk:
|
|
requires:
|
|
- generate_signed_apk
|
|
filters:
|
|
tags:
|
|
only: /^[0-9]+(\.[0-9]+)*/
|
|
branches:
|
|
ignore: /.*/
|
|
|