Skip to content

Commit

Permalink
Workflow improvements (#3891)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
sainak authored Oct 4, 2020
1 parent 4cbe497 commit e8f5963
Show file tree
Hide file tree
Showing 5 changed files with 49 additions and 2 deletions.
23 changes: 23 additions & 0 deletions .github/runner-files/checksum.sh
Original file line number Diff line number Diff line change
@@ -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
6 changes: 6 additions & 0 deletions .github/runner-files/ci-gradle.properties
Original file line number Diff line number Diff line change
@@ -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
20 changes: 18 additions & 2 deletions .github/workflows/build_check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
1 change: 1 addition & 0 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ ext {
android {
compileSdkVersion AndroidConfig.compileSdk
buildToolsVersion AndroidConfig.buildTools
ndkVersion AndroidConfig.ndk

defaultConfig {
applicationId "eu.kanade.tachiyomi"
Expand Down
1 change: 1 addition & 0 deletions buildSrc/src/main/kotlin/AndroidConfig.kt
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}

0 comments on commit e8f5963

Please sign in to comment.