build.yml 6.2 KB

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