build.yml 7.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225
  1. name: Build
  2. on:
  3. [push]
  4. env:
  5. JAVA_VERSION: 16
  6. defaults:
  7. run:
  8. shell: bash
  9. jobs:
  10. test:
  11. name: Build and Test
  12. runs-on: ubuntu-latest
  13. if: "!contains(github.event.head_commit.message, '[ci skip]') && !contains(github.event.head_commit.message, '[skip ci]')"
  14. steps:
  15. - uses: actions/checkout@v2
  16. - uses: actions/setup-java@v1
  17. with:
  18. java-version: ${{ env.JAVA_VERSION }}
  19. - uses: actions/cache@v2
  20. with:
  21. path: ~/.m2/repository
  22. key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
  23. restore-keys: |
  24. ${{ runner.os }}-maven-
  25. - name: Ensure to use tagged version
  26. run: mvn versions:set -DnewVersion=${GITHUB_REF##*/} # use shell parameter expansion to strip of 'refs/tags'
  27. if: startsWith(github.ref, 'refs/tags/')
  28. - name: Build and Test
  29. run: mvn -B clean install jacoco:report -Pcoverage,dependency-check
  30. - name: Upload code coverage report
  31. id: codacyCoverageReporter
  32. run: bash <(curl -Ls https://coverage.codacy.com/get.sh)
  33. env:
  34. CODACY_PROJECT_TOKEN: ${{ secrets.CODACY_PROJECT_TOKEN }}
  35. continue-on-error: true
  36. #
  37. # Buildkit
  38. #
  39. buildkit:
  40. name: Build buildkit-${{ matrix.profile }}
  41. needs: test
  42. runs-on: ${{ matrix.os }}
  43. strategy:
  44. fail-fast: true
  45. matrix:
  46. include:
  47. - os: ubuntu-latest
  48. profile: linux
  49. launcher: launcher-linux.sh
  50. - os: windows-latest
  51. profile: win
  52. launcher: launcher-win.bat
  53. - os: macOS-latest
  54. profile: mac
  55. launcher: launcher-mac.sh
  56. steps:
  57. - uses: actions/checkout@v2
  58. - uses: actions/setup-java@v1
  59. with:
  60. java-version: ${{ env.JAVA_VERSION }}
  61. - uses: actions/cache@v2
  62. with:
  63. path: ~/.m2/repository
  64. key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
  65. restore-keys: |
  66. ${{ runner.os }}-maven-
  67. - name: Copy .jar files
  68. run: mvn -B clean package -DskipTests -P${{ matrix.profile }}
  69. - name: Archive buildkit-${{ matrix.profile }}.tar.gz
  70. run: |
  71. cp LICENSE.txt target
  72. cp dist/${{ matrix.launcher }} target
  73. cp target/cryptomator-*.jar target/mods
  74. - name: Upload buildkit-${{ matrix.profile }}
  75. uses: actions/upload-artifact@v2
  76. with:
  77. name: buildkit-${{ matrix.profile }}
  78. path: |
  79. target/libs
  80. target/mods
  81. target/LICENSE.txt
  82. target/${{ matrix.launcher }}
  83. if-no-files-found: error
  84. #
  85. # jlink
  86. #
  87. jlink:
  88. name: Create runtime-${{ matrix.profile }}
  89. needs: test
  90. runs-on: ${{ matrix.os }}
  91. strategy:
  92. fail-fast: true
  93. matrix:
  94. include:
  95. - os: ubuntu-latest
  96. profile: linux
  97. - os: windows-latest
  98. profile: win
  99. - os: macOS-latest
  100. profile: mac
  101. steps:
  102. - uses: actions/checkout@v2
  103. - uses: actions/setup-java@v1
  104. with:
  105. java-version: ${{ env.JAVA_VERSION }}
  106. - name: Create Runtime Image
  107. run: >
  108. ${JAVA_HOME}/bin/jlink
  109. --verbose
  110. --output runtime
  111. --module-path "${JAVA_HOME}/jmods"
  112. --add-modules java.base,java.desktop,java.logging,java.naming,java.net.http,java.scripting,java.sql,java.xml,jdk.unsupported,jdk.crypto.ec,jdk.accessibility
  113. --no-header-files
  114. --no-man-pages
  115. --strip-debug
  116. --compress=1
  117. - name: Upload runtime-${{ matrix.profile }}
  118. uses: actions/upload-artifact@v2
  119. with:
  120. name: runtime-${{ matrix.profile }}
  121. path: runtime
  122. if-no-files-found: error
  123. # release:
  124. # name: Draft a Release on GitHub Releases
  125. # runs-on: ubuntu-latest
  126. # needs: test
  127. # if: startsWith(github.ref, 'refs/tags/') && github.repository == 'cryptomator/cryptomator'
  128. # steps:
  129. # - uses: actions/checkout@v2
  130. # - name: Download buildkit-linux.zip
  131. # uses: actions/download-artifact@v1
  132. # with:
  133. # name: buildkit-linux.zip
  134. # path: .
  135. # - name: Download buildkit-mac.zip
  136. # uses: actions/download-artifact@v1
  137. # with:
  138. # name: buildkit-mac.zip
  139. # path: .
  140. # - name: Download buildkit-win.zip
  141. # uses: actions/download-artifact@v1
  142. # with:
  143. # name: buildkit-win.zip
  144. # path: .
  145. # - name: Create tarball
  146. # run: git archive --prefix="cryptomator-${{ github.ref }}/" -o "cryptomator-${{ github.ref }}.tar.gz" ${{ github.ref }}
  147. # - name: Sign tarball with key 615D449FE6E6A235
  148. # run: |
  149. # echo "${GPG_PRIVATE_KEY}" | gpg --batch --quiet --import
  150. # echo "${GPG_PASSPHRASE}" | gpg --batch --quiet --passphrase-fd 0 --pinentry-mode loopback -u 615D449FE6E6A235 --detach-sign -a "cryptomator-${{ github.ref }}.tar.gz"
  151. # env:
  152. # GPG_PRIVATE_KEY: ${{ secrets.RELEASES_GPG_PRIVATE_KEY }}
  153. # GPG_PASSPHRASE: ${{ secrets.RELEASES_GPG_PASSPHRASE }}
  154. # - name: Create Release
  155. # id: create_release
  156. # uses: actions/create-release@v1
  157. # env:
  158. # GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
  159. # with:
  160. # tag_name: ${{ github.ref }}
  161. # release_name: ${{ github.ref }}
  162. # body: |
  163. # :construction: Work in Progress
  164. # TODO:
  165. # * [ ] add Linux appimage, zsync file and signature file
  166. # * [ ] add Windows installer and signature file
  167. # * [ ] add MacOs disk image and signature file
  168. # ## What's new
  169. # ## Bugfixes
  170. # ## Misc
  171. # ---
  172. # :scroll: A complete list of closed issues is available [here](LINK)
  173. # draft: true
  174. # prerelease: false
  175. # - name: Upload buildkit-linux.zip to GitHub Releases
  176. # uses: actions/upload-release-asset@v1.0.1
  177. # env:
  178. # GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
  179. # with:
  180. # upload_url: ${{ steps.create_release.outputs.upload_url }}
  181. # asset_path: buildkit-linux.zip
  182. # asset_name: buildkit-linux.zip
  183. # asset_content_type: application/zip
  184. # - name: Upload buildkit-mac.zip to GitHub Releases
  185. # uses: actions/upload-release-asset@v1.0.1
  186. # env:
  187. # GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
  188. # with:
  189. # upload_url: ${{ steps.create_release.outputs.upload_url }}
  190. # asset_path: buildkit-mac.zip
  191. # asset_name: buildkit-mac.zip
  192. # asset_content_type: application/zip
  193. # - name: Upload buildkit-win.zip to GitHub Releases
  194. # uses: actions/upload-release-asset@v1.0.1
  195. # env:
  196. # GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
  197. # with:
  198. # upload_url: ${{ steps.create_release.outputs.upload_url }}
  199. # asset_path: buildkit-win.zip
  200. # asset_name: buildkit-win.zip
  201. # asset_content_type: application/zip
  202. # - name: Upload tarball signature to GitHub Releases
  203. # uses: actions/upload-release-asset@v1.0.1
  204. # env:
  205. # GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
  206. # with:
  207. # upload_url: ${{ steps.create_release.outputs.upload_url }}
  208. # asset_path: "cryptomator-${{ github.ref }}.tar.gz.asc"
  209. # asset_name: "cryptomator-${{ github.ref }}.tar.gz.asc"
  210. # asset_content_type: application/octet-stream