continuous_integration.yml 6.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184
  1. name: 🧪 Android packages
  2. on:
  3. push:
  4. branches:
  5. - master
  6. - release-**
  7. pull_request:
  8. release:
  9. types: ['published', 'released']
  10. jobs:
  11. # Build Android packages
  12. build:
  13. runs-on: ubuntu-20.04
  14. env:
  15. TX_TOKEN: ${{ secrets.TX_TOKEN }}
  16. strategy:
  17. matrix:
  18. arch: [armv7, arm64_v8a, x86, x86_64]
  19. steps:
  20. - name: Checkout
  21. uses: actions/checkout@v2
  22. - name: Setup signing key
  23. env:
  24. SIGNINGKEY: ${{ secrets.PLAYSTORE_SIGNINGKEY }}
  25. run: |
  26. echo "$SIGNINGKEY" | base64 --decode > ./keystore.p12
  27. - name: Setup build environment
  28. run: |
  29. echo ::group::install packages
  30. sudo apt update && sudo apt install -y qttools5-dev-tools qt5-default transifex-client
  31. echo ::endgroup::
  32. sed -i 's/git@github.com:/https:\/\/github.com\//' .gitmodules
  33. git submodule update --init --recursive
  34. ./scripts/ci/env_gh.sh
  35. pip install wheel
  36. - name: "🌍 Pull Translations"
  37. run: |
  38. if [[ -z "${TX_TOKEN}" ]]; then
  39. echo "TX_TOKEN not set, skip tx pull"
  40. else
  41. ./scripts/ci/pull_translations.sh
  42. fi
  43. # - uses: actions/cache@v2
  44. # with:
  45. # path: |
  46. # ~/cache/.gradle/caches
  47. # ~/cache/.gradle/wrapper
  48. # key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*') }}
  49. # restore-keys: |
  50. # ${{ runner.os }}-gradle-
  51. - name: Free additional space
  52. run: |
  53. df -h
  54. rm -rf /tmp/workspace
  55. rm -rf /usr/share/dotnet/sdk
  56. sudo apt remove llvm-* ghc-* google-chrome-* dotnet-sdk-*
  57. dpkg-query -Wf '${Installed-Size}\t${Package}\n' | sort -n | tail -n 100
  58. du -a /usr/share | sort -n -r | head -n 10
  59. du -a /usr/local/share | sort -n -r | head -n 10
  60. df -h
  61. sudo apt clean
  62. df -h
  63. - name: Build
  64. env:
  65. ARCH: ${{ matrix.arch }}
  66. KEYNAME: qfield
  67. KEYPASS: ${{ secrets.KEYPASS }}
  68. STOREPASS: ${{ secrets.STOREPASS }}
  69. CACHE_DIR: ${{ env.GITHUB_WORKSPACE }}/cache
  70. run: |
  71. ./scripts/ci/docker_pull.sh
  72. source ./scripts/version_number.sh
  73. source ./scripts/ci/generate-version-details.sh
  74. ./scripts/build.sh
  75. ls $CACHE_DIR
  76. - name: 🍺 Deploy
  77. run: |
  78. sudo apt install -y s3cmd
  79. ./scripts/ci/upload_artifacts.sh
  80. env:
  81. S3CFG: ${{ secrets.S3CFG }}
  82. ARCH: ${{ matrix.arch }}
  83. - name: Upload release assets
  84. uses: AButler/upload-release-assets@v2.0
  85. if: ${{ github.event_name == 'release' }}
  86. with:
  87. files: /tmp/qfield-*.apk
  88. repo-token: ${{ secrets.GITHUB_TOKEN }}
  89. release-tag: ${{ env.CI_TAG }}
  90. deploy_to_playstore:
  91. runs-on: ubuntu-20.04
  92. needs: build
  93. if: ${{ github.event_name == 'released' || ( github.event_name == 'push' && github.ref == 'refs/heads/master' ) }}
  94. steps:
  95. - name: Checkout
  96. uses: actions/checkout@v2
  97. - name: Vars
  98. id: vars
  99. run: |
  100. ./scripts/ci/env_gh.sh
  101. - name: Download apks
  102. run: |
  103. wget https://sos-ch-dk-2.exo.io/qfieldapks/ci-builds/${{ steps.vars.outputs.CI_PACKAGE_FILE_BASENAME }}-arm64_v8a.apk
  104. wget https://sos-ch-dk-2.exo.io/qfieldapks/ci-builds/${{ steps.vars.outputs.CI_PACKAGE_FILE_BASENAME }}-armv7.apk
  105. wget https://sos-ch-dk-2.exo.io/qfieldapks/ci-builds/${{ steps.vars.outputs.CI_PACKAGE_FILE_BASENAME }}-x86_64.apk
  106. wget https://sos-ch-dk-2.exo.io/qfieldapks/ci-builds/${{ steps.vars.outputs.CI_PACKAGE_FILE_BASENAME }}-x86.apk
  107. - name: Upload to Google Play Store
  108. run: |
  109. pip install google-api-python-client google-auth-httplib2 google-auth-oauthlib oauth2client
  110. ./scripts/basic_upload_apks_service_account.py ch.opengis.${{ steps.vars.outputs.APP_PACKAGE_NAME }} beta "Update from commit ${GITHUB_SHA}" \
  111. ${{ steps.vars.outputs.CI_PACKAGE_FILE_BASENAME }}-arm64_v8a.apk \
  112. ${{ steps.vars.outputs.CI_PACKAGE_FILE_BASENAME }}-armv7.apk \
  113. ${{ steps.vars.outputs.CI_PACKAGE_FILE_BASENAME }}-x86_64.apk \
  114. ${{ steps.vars.outputs.CI_PACKAGE_FILE_BASENAME }}-x86.apk
  115. env:
  116. GOOGLE_SERVICE_ACCOUNT: ${{ secrets.GOOGLE_SERVICE_ACCOUNT }}
  117. comment_pr:
  118. runs-on: ubuntu-20.04
  119. needs: build
  120. if: ${{ github.event_name == 'pull_request' }}
  121. steps:
  122. - name: Checkout
  123. uses: actions/checkout@v2
  124. - name: Vars
  125. id: vars
  126. run: |
  127. ./scripts/ci/env_gh.sh
  128. - uses: kanga333/comment-hider@master
  129. name: Hide outdated comments from the default github user
  130. with:
  131. github_token: ${{ secrets.GITHUB_TOKEN }}
  132. hide_user_name: github-actions[bot]
  133. - uses: kanga333/comment-hider@master
  134. name: Hide outdated comments from qfield-fairy
  135. with:
  136. github_token: ${{ secrets.GITHUB_TOKEN }}
  137. hide_user_name: qfield-fairy
  138. - name: Comment PR
  139. uses: thollander/actions-comment-pull-request@main
  140. with:
  141. GITHUB_TOKEN: ${{ secrets.FAIRY_TOKEN }}
  142. message: |
  143. 🎉 Ta-daaa, freshly created APKs are available for ${{ github.event.pull_request.head.sha }}:
  144. - [**arm64_v8a**](https://sos-ch-dk-2.exo.io/qfieldapks/ci-builds/${{ steps.vars.outputs.CI_PACKAGE_FILE_BASENAME }}-arm64_v8a.apk)
  145. Other architectures: [armv7](https://sos-ch-dk-2.exo.io/qfieldapks/ci-builds/${{ steps.vars.outputs.CI_PACKAGE_FILE_BASENAME }}-armv7.apk), [x86_64](https://sos-ch-dk-2.exo.io/qfieldapks/ci-builds/${{ steps.vars.outputs.CI_PACKAGE_FILE_BASENAME }}-x86_64.apk), [x86](https://sos-ch-dk-2.exo.io/qfieldapks/ci-builds/${{ steps.vars.outputs.CI_PACKAGE_FILE_BASENAME }}-x86.apk)
  146. comment_commit:
  147. runs-on: ubuntu-20.04
  148. needs: build
  149. if: ${{ github.event_name == 'push' }}
  150. steps:
  151. - name: Checkout
  152. uses: actions/checkout@v2
  153. - name: Vars
  154. id: vars
  155. run: |
  156. ./scripts/ci/env_gh.sh
  157. - name: Comment commit
  158. uses: peter-evans/commit-comment@v1
  159. with:
  160. token: ${{ secrets.FAIRY_TOKEN }}
  161. body: |
  162. 🎉 Ta-daaa, freshly created APKs are available:
  163. - [**arm64_v8a**](https://sos-ch-dk-2.exo.io/qfieldapks/ci-builds/${{ steps.vars.outputs.CI_PACKAGE_FILE_BASENAME }}-arm64_v8a.apk)
  164. Other architectures: [armv7](https://sos-ch-dk-2.exo.io/qfieldapks/ci-builds/${{ steps.vars.outputs.CI_PACKAGE_FILE_BASENAME }}-armv7.apk), [x86_64](https://sos-ch-dk-2.exo.io/qfieldapks/ci-builds/${{ steps.vars.outputs.CI_PACKAGE_FILE_BASENAME }}-x86_64.apk), [x86](https://sos-ch-dk-2.exo.io/qfieldapks/ci-builds/${{ steps.vars.outputs.CI_PACKAGE_FILE_BASENAME }}-x86.apk)