AntennaPod/.circleci/config.yml

111 lines
4.2 KiB
YAML
Raw Normal View History

2019-10-04 22:25:40 +02:00
version: 2.1
jobs:
2019-10-04 22:25:40 +02:00
build:
parameters:
build-steps:
description: "Steps that will be executed for this build"
type: steps
default: []
2019-10-04 22:09:57 +02:00
docker:
2020-09-28 11:08:41 +02:00
- image: circleci/android:api-30
2019-10-04 22:09:57 +02:00
working_directory: ~/AntennaPod
environment:
GRADLE_OPTS: '-Dorg.gradle.jvmargs="-Xmx1536m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError"'
_JAVA_OPTIONS: "-Xms256m -Xmx1280m"
steps:
- checkout
- restore_cache:
keys:
- v1-android-{{ checksum "build.gradle" }}
- v1-android-
- run:
name: Create temporary release keystore
command: keytool -noprompt -genkey -v -keystore "app/keystore" -alias alias -storepass password -keypass password -keyalg RSA -validity 10 -dname "CN=antennapod.org, OU=dummy, O=dummy, L=dummy, S=dummy, C=US"
2019-10-04 22:25:40 +02:00
- steps: << parameters.build-steps >>
2019-10-04 22:09:57 +02:00
- save_cache:
paths:
- ~/.android
- ~/.gradle
- ~/android
key: v1-android-{{ checksum "build.gradle" }}
2019-09-24 11:12:35 +02:00
2019-09-24 10:50:51 +02:00
workflows:
unit-tests:
2019-09-24 10:50:51 +02:00
jobs:
2019-10-04 22:25:40 +02:00
- build:
2019-10-04 22:39:10 +02:00
name: Build debug
2019-10-04 22:25:40 +02:00
build-steps:
- run:
name: Build debug
command: ./gradlew assembleDebug -PdisablePreDex
2020-07-24 17:01:23 +02:00
- store_artifacts:
name: Uploading apk artifact
path: app/build/outputs/apk/play/debug/app-play-debug.apk
destination: app-play-debug.apk
2019-10-04 22:25:40 +02:00
- run:
name: Execute debug unit tests
2021-02-07 11:29:39 +01:00
command: ./gradlew testPlayDebugUnitTest -PdisablePreDex
2019-10-04 22:25:40 +02:00
- build:
2019-10-04 22:39:10 +02:00
name: Build release
2019-10-04 22:25:40 +02:00
build-steps:
- run:
name: Build release
command: ./gradlew assembleRelease -PdisablePreDex
- run:
name: Execute release unit tests
2021-02-07 11:29:39 +01:00
command: ./gradlew testPlayReleaseUnitTest -PdisablePreDex
2019-10-04 22:25:40 +02:00
- build:
2019-10-04 22:39:10 +02:00
name: Build integration tests
2019-10-04 22:25:40 +02:00
build-steps:
- run:
name: Build integration tests
2021-02-07 11:29:39 +01:00
command: ./gradlew assemblePlayDebugAndroidTest -PdisablePreDex
2019-10-04 22:25:40 +02:00
- build:
2019-10-04 22:39:10 +02:00
name: Build free
2019-10-04 22:25:40 +02:00
build-steps:
- run:
name: Build free (for F-Droid)
2021-02-23 17:11:32 +01:00
command: ./gradlew assembleFreeRelease -PdisablePreDex
2019-09-24 11:12:35 +02:00
static-analysis:
2019-09-24 11:12:35 +02:00
jobs:
2019-10-04 22:25:40 +02:00
- build:
2019-10-04 22:39:10 +02:00
name: Checkstyle
2019-10-04 22:25:40 +02:00
build-steps:
- run:
name: Checkstyle
command: ./gradlew checkstyle
2020-03-30 01:05:33 +02:00
- run:
name: Diff-Checkstyle
command: |
git fetch origin develop
branchBaseCommit=`git merge-base origin/develop HEAD`
echo "Comparing to $branchBaseCommit"
curl -s -L https://github.com/yangziwen/diff-checkstyle/releases/download/0.0.4/diff-checkstyle.jar > diff-checkstyle.jar
java -Dconfig_loc=config/checkstyle -jar diff-checkstyle.jar -c config/checkstyle/checkstyle-new-code.xml --git-dir . --base-rev $branchBaseCommit
2020-07-16 11:36:37 +02:00
- build:
2021-02-07 11:29:39 +01:00
name: Lint
2020-07-16 11:36:37 +02:00
build-steps:
- run:
2021-02-07 11:29:39 +01:00
name: Lint
2021-04-17 16:53:21 +02:00
command: ./gradlew lintPlayRelease lintRelease
2021-03-27 16:17:14 +01:00
- build:
name: SpotBugs
build-steps:
- run:
name: SpotBugs
command: ./gradlew spotbugsPlayDebug spotbugsDebug 2>&1 | grep -i "spotbugs"
2021-05-23 20:07:09 +02:00
- build:
name: XML
build-steps:
- run:
name: XML of changed files
command: |
git fetch origin develop
branchBaseCommit=`git merge-base origin/develop HEAD`
echo "Comparing to $branchBaseCommit"
curl -s -L https://github.com/ByteHamster/android-xml-formatter/releases/download/1.1.0/android-xml-formatter.jar > android-xml-formatter.jar
git diff --name-only $branchBaseCommit | { grep "res/layout/" || true; } | xargs java -jar android-xml-formatter.jar
test $(git diff | wc -l) -eq 0 || (echo -e "\n\n===== Found XML code style violations! See output below how to fix them. =====\n\n" && git --no-pager diff --color=always && false)