Workflow improvements (#3891)

* add caching steps to build_check workflow

* add gradle.properites for github runner

* refactor ci-gradle.properties

* specify ndk versiion in build.gradle

* remove ndk install and cache steps from build_check

* moved runner files to separate folder

* refactor build_check.yml
This commit is contained in:
Aakash Singh 2020-10-04 22:14:04 +05:30 committed by GitHub
parent 4cbe497770
commit e8f5963a57
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 49 additions and 2 deletions

23
.github/runner-files/checksum.sh vendored Executable file
View file

@ -0,0 +1,23 @@
#!/bin/bash
RESULT_FILE=$1
if [ -f $RESULT_FILE ]; then
rm $RESULT_FILE
fi
touch $RESULT_FILE
checksum_file() {
echo $(openssl md5 $1 | awk '{print $2}')
}
FILES=()
while read -r -d ''; do
FILES+=("$REPLY")
done < <(find . -type f \( -name "build.gradle*" -o -name "Dependencies.kt" -o -name "gradle-wrapper.properties" \) -print0)
# Loop through files and append MD5 to result file
for FILE in ${FILES[@]}; do
echo $(checksum_file $FILE) >> $RESULT_FILE
done
# Now sort the file so that it is
sort $RESULT_FILE -o $RESULT_FILE

View file

@ -0,0 +1,6 @@
org.gradle.daemon=false
org.gradle.jvmargs=-Xmx5120m
org.gradle.workers.max=2
kotlin.incremental=false
kotlin.compiler.execution.strategy=in-process

View file

@ -16,8 +16,24 @@ jobs:
uses: actions/setup-java@v1
with:
java-version: 1.8
- name: Install NDK
run: sudo ${ANDROID_HOME}/tools/bin/sdkmanager --install "ndk;21.0.6113669" &> /dev/null
- name: Copy CI gradle.properties
run: |
mkdir -p ~/.gradle
cp .github/runner-files/ci-gradle.properties ~/.gradle/gradle.properties
- name: Generate Gradle cache key
run: ./.github/runner-files/checksum.sh checksum.txt
- name: Cache Gradle dependencies
uses: actions/cache@v2
continue-on-error: true # continue if the cache restore/upload fails
with:
path: |
~/.gradle/caches/build-cache-*
~/.gradle/caches/jars-*
~/.gradle/caches/modules-*
key: ${{ runner.os }}-gradle-${{ hashFiles('checksum.txt') }}
- name: Build app
run: ./gradlew assembleStandardDebug

View file

@ -34,6 +34,7 @@ ext {
android {
compileSdkVersion AndroidConfig.compileSdk
buildToolsVersion AndroidConfig.buildTools
ndkVersion AndroidConfig.ndk
defaultConfig {
applicationId "eu.kanade.tachiyomi"

View file

@ -3,4 +3,5 @@ object AndroidConfig {
const val minSdk = 21
const val targetSdk = 29
const val buildTools = "29.0.3"
const val ndk = "21.3.6528147"
}