Commit 9d0db46c authored by Christophe Henry's avatar Christophe Henry

Fix Jenkinsfile

- Fix broken build
- Fix Workspace not deleted
parent 4afc5a27
Pipeline #4398 passed with stage
in 0 seconds
......@@ -77,16 +77,3 @@ fastlane/Preview.html
fastlane/screenshots
fastlane/test_output
fastlane/readme.md
Supprimerait .gitignore
Supprimerait app/.gitignore
Supprimerait app/build.gradle
Supprimerait app/libs/
Supprimerait app/proguard-rules.pro
Supprimerait app/src/
Supprimerait build.gradle
Supprimerait gradle.properties
Supprimerait gradle/
Supprimerait gradlew
Supprimerait gradlew.bat
Supprimerait settings.gradle
def dockerImage = "bitriseio/docker-android"
pipeline {
agent {
docker {
image "bitriseio/docker-android"
image dockerImage
args "-v /etc/passwd:/etc/passwd:ro " +
"-v /home/android/android-sdk-linux/:/opt/android-sdk-linux/:rw " +
// Disable for now, see https://stackoverflow.com/a/55590096
// "-v /home/android/.gradle/:/root/.gradle/:rw " +
"-v /home/android/freshrss_signkey.jks:/home/android/freshrss_signkey.jks:ro " +
"-u root --privileged"
"--privileged -u root"
}
}
......@@ -19,6 +19,7 @@ pipeline {
ANDROID_HOME = "/opt/android-sdk-linux"
SIGN_KEY_PATH = "/home/android/freshrss_signkey.jks"
SIGN_KEY_CREDENTIALS = credentials "freshrss-signkey"
APK_BUILD_BRANCH = "develop"
}
options {
......@@ -60,13 +61,13 @@ pipeline {
steps {
gitlabCommitStatus("Lint") {
sh "./gradlew spotlessCheck lint"
androidLint pattern: "**/lint-results-*.xml"
androidLint pattern: "**/lint-results*.xml"
publishHTML([
allowMissing : false,
alwaysLinkToLastBuild: true,
keepAll : false,
reportDir : "$WORKSPACE/app/build/reports/",
reportFiles : "lint-results-release.html",
reportFiles : "lint-results.html",
reportName : "HTML Report",
reportTitles : ""
])
......@@ -83,7 +84,7 @@ pipeline {
allowMissing : false,
alwaysLinkToLastBuild: true,
keepAll : false,
reportDir : "$WORKSPACE/app/build/reports/tests/testReleaseUnitTest",
reportDir : "$WORKSPACE/app/build/reports/tests/",
reportFiles : "index.html",
reportName : "Junit test report",
reportTitles : ""
......@@ -121,11 +122,20 @@ pipeline {
-Pandroid.injected.signing.key.alias=${env.SIGN_KEY_CREDENTIALS_USR} \
-Pandroid.injected.signing.key.password=${env.SIGN_KEY_CREDENTIALS_PSW}
""")
archiveArtifacts artifacts: "**/*.apk", fingerprint: true
archiveArtifacts artifacts: "**/*.apk", fingerprint: true, onlyIfSuccessful: true
}
}
when { branch "develop" }
when { branch env.APK_BUILD_BRANCH }
}
}
post {
cleanup {
script {
docker.image(dockerImage).inside("-u root") { sh "find . -user root -name '*' | xargs chmod 777" }
}
deleteDir()
}
}
}
......@@ -137,6 +147,6 @@ def getBuildSteps(String branch) {
"Instrumented tests on min SDK image",
"Instrumented tests on max SDK image",
]
if (branch == "develop") return buildSteps + ["Build APK"]
if (branch == env.APK_BUILD_BRANCH) return buildSteps + ["Build APK"]
return buildSteps
}
\ No newline at end of file
......@@ -49,7 +49,7 @@ android {
}
applicationVariants.all { variant ->
if (variant.name.contains("elease")) {
if (variant.name != "debug") {
variant.mergeAssetsProvider.get().doLast {
delete new FileNameFinder().getFileNames(buildDir.absolutePath, "**/config.properties")
}
......@@ -69,7 +69,6 @@ android {
dataBinding = true
}
testOptions {
unitTests.all {
testLogging {
......
......@@ -29,10 +29,6 @@ allprojects {
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
tasks.withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompile).all {
kotlinOptions.freeCompilerArgs += ["-Xuse-experimental=kotlin.Experimental"]
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment