Fedilab è un client Android multifunzionale per accedere al Fediverse distribuito, composto da microblogging, condivisione di foto e video hosting. Supporta: - Mastodon, Pleroma, Peertube, GNU Social, Friendica. https://devol.it/it/fediverso
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

97 lines
4.1 KiB

  1. image: hatsoftwares/mastalab-ci:latest
  2. before_script:
  3. - export ANDROID_HOME=/opt/android-sdk-linux
  4. - export PATH=$PATH:/opt/android-sdk-linux/platform-tools/
  5. - chmod +x gradlew
  6. stages:
  7. - build-and-test
  8. - tag
  9. - toot
  10. .no-upload: &no-upload
  11. stage: build-and-test
  12. retry: 2
  13. assembleDebug:
  14. <<: *no-upload
  15. cache:
  16. key: "${CI_COMMIT_TAG}"
  17. paths:
  18. - app/build/outputs/apk/fdroid/debug/app-fdroid-debug.apk
  19. - app/build/outputs/apk/playstore/debug/app-playstore-debug.apk
  20. policy: push
  21. script:
  22. - ./gradlew assembleDebug
  23. lintDebug:
  24. <<: *no-upload
  25. script:
  26. - ./gradlew -Pci --console=plain :app:lintFdroidDebug -PbuildDir=lint
  27. except:
  28. - tags
  29. debugTests:
  30. <<: *no-upload
  31. script:
  32. - ./gradlew -Pci --console=plain :app:testFdroidDebugUnitTest
  33. except:
  34. - tags
  35. ## PROTECTED VARIABLES TO SET IN GITLAB:
  36. # - GITLAB_API_TOKEN: token you create on Gitlab
  37. # - NC_REMOTE_DIR: like https://YOUR_NEXTCLOUD/remote.php/dav/files/YOUR_USER/mastalab (no trailing slash)
  38. # - NC_SHARE_URL: share the folder in Nextcloud with public link and put your public link here (no trailing slash)
  39. # - NC_USER: nextcloud user
  40. # - NC_PASSWORD: nextcloud password
  41. ## Protect all tags in Gitlab repo settings (do a wildcard, ie '*')
  42. # For now, it uses the assembleDebug builds, you'll need to create a job in build-and-test to create the apks, with only: - tags and add except: - tags to assembleDebug (like in debugTests)
  43. # In it, put something like this to get your signature key file:
  44. # - curl -s --output signature.jsk -u "${NC_USER}:${NC_PASSWORD}" "https://YOUR_NEXTCLOUD/remote.php/dav/files/YOUR_USER/signature.jsk"
  45. putApkOnTags:
  46. image: hatsoftwares/curl-jq:latest
  47. stage: tag
  48. retry: 2
  49. cache:
  50. key: "${CI_COMMIT_TAG}"
  51. paths:
  52. - app/build/outputs/apk/fdroid/debug/app-fdroid-debug.apk
  53. - app/build/outputs/apk/playstore/debug/app-playstore-debug.apk
  54. policy: pull
  55. script:
  56. - export PROJECT_API_URL="https://framagit.org/api/v4/projects/${CI_PROJECT_ID}"
  57. - export DESCRIPTION_URL="${PROJECT_API_URL}/repository/tags/${CI_COMMIT_TAG}"
  58. - export RELEASE_URL="${DESCRIPTION_URL}/release"
  59. - export NC_UPLOAD_URL="${NC_REMOTE_DIR}/${CI_COMMIT_TAG}"
  60. - export NC_DOWNLOAD_URL="${NC_SHARE_URL}/download?path=%2F${CI_COMMIT_TAG}%2F&files="
  61. - 'export HEADER="Private-Token: ${GITLAB_API_TOKEN}"'
  62. - export fdroidUrl="${NC_DOWNLOAD_URL}app-fdroid-debug.apk"
  63. - export playstoreUrl="${NC_DOWNLOAD_URL}app-playstore-debug.apk"
  64. - 'curl -s -u "${NC_USER}:${NC_PASSWORD}" -X MKCOL "${NC_UPLOAD_URL}"'
  65. - 'curl -s -u "${NC_USER}:${NC_PASSWORD}" -T app/build/outputs/apk/fdroid/debug/app-fdroid-debug.apk "${NC_UPLOAD_URL}/app-fdroid-debug.apk"'
  66. - 'curl -s -u "${NC_USER}:${NC_PASSWORD}" -T app/build/outputs/apk/playstore/debug/app-playstore-debug.apk "${NC_UPLOAD_URL}/app-playstore-debug.apk"'
  67. - export description=$(curl -s --header "${HEADER}" "${DESCRIPTION_URL}" | jq .release.description | sed -e 's@"@@g')
  68. - if [[ $description == 'null' ]]; then export METHOD="POST"; echo -e "[Get the fdroid apk](${fdroidUrl})\n\n[Get the play store apk](${playstoreUrl})" > /tmp/text; fi
  69. - if [[ $description != 'null' ]]; then export METHOD="PUT"; echo -e "${description}\n\n[Get the fdroid apk](${fdroidUrl})\n\n[Get the play store apk](${playstoreUrl})" > /tmp/text; fi
  70. - curl -s --request $METHOD --data-urlencode "description@/tmp/text" --header "${HEADER}" "${RELEASE_URL}"
  71. only:
  72. - tags
  73. pouet-it:
  74. image: hatsoftwares/pouet-it-from-ci:latest
  75. stage: toot
  76. dependencies:
  77. - putApkOnTags
  78. script:
  79. - cd /opt/pouet-it-from-ci
  80. # Make the project name first letter uppercase
  81. - export NC_DOWNLOAD_URL="${NC_SHARE_URL}?path=%2F${CI_COMMIT_TAG}%2F"
  82. - export project="$(tr '[:lower:]' '[:upper:]' <<< ${CI_PROJECT_NAME:0:1})${CI_PROJECT_NAME:1}"
  83. - export MESSAGE=$(echo -e "I just released a new version of "'#'"${APP_NAME}!""\n${CI_PROJECT_URL}/tags/${CI_COMMIT_TAG}\nYou can download the apks on ${NC_DOWNLOAD_URL}")
  84. - if [[ ! -z $HOST ]]; then carton exec ./pouet-it-from-ci.pl; fi
  85. only:
  86. - tags