build.yml 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123
  1. name: Build
  2. on:
  3. [push]
  4. jobs:
  5. build:
  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@v1
  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 --file main/pom.xml -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 install --file main/pom.xml -Pcoverage
  25. - name: Run Codacy Coverage Reporter
  26. if: github.repository == 'cryptomator/cryptomator'
  27. run: |
  28. curl -o ~/codacy-coverage-reporter.jar https://repo.maven.apache.org/maven2/com/codacy/codacy-coverage-reporter/7.1.0/codacy-coverage-reporter-7.1.0-assembly.jar
  29. $JAVA_HOME/bin/java --illegal-access=permit -jar ~/codacy-coverage-reporter.jar report -l Java -r main/commons/target/site/jacoco/jacoco.xml --partial
  30. $JAVA_HOME/bin/java --illegal-access=permit -jar ~/codacy-coverage-reporter.jar report -l Java -r main/ui/target/site/jacoco/jacoco.xml --partial
  31. $JAVA_HOME/bin/java --illegal-access=permit -jar ~/codacy-coverage-reporter.jar report -l Java -r main/launcher/target/site/jacoco/jacoco.xml --partial
  32. $JAVA_HOME/bin/java --illegal-access=permit -jar ~/codacy-coverage-reporter.jar final
  33. env:
  34. CODACY_PROJECT_TOKEN: ${{ secrets.CODACY_PROJECT_TOKEN }}
  35. - name: Assemble buildkit-linux.zip
  36. run: mvn -B clean package -DskipTests --file main/pom.xml --resume-from=buildkit -Prelease,linux
  37. - name: Upload buildkit-linux.zip
  38. uses: actions/upload-artifact@v1
  39. with:
  40. name: buildkit-linux.zip
  41. path: main/buildkit/target/buildkit-linux.zip
  42. - name: Assemble buildkit-mac.zip
  43. run: mvn -B clean package -DskipTests --file main/pom.xml --resume-from=buildkit -Prelease,mac
  44. - name: Upload buildkit-mac.zip
  45. uses: actions/upload-artifact@v1
  46. with:
  47. name: buildkit-mac.zip
  48. path: main/buildkit/target/buildkit-mac.zip
  49. - name: Assemble buildkit-win.zip
  50. run: mvn -B clean package -DskipTests --file main/pom.xml --resume-from=buildkit -Prelease,windows
  51. - name: Upload buildkit-win.zip
  52. uses: actions/upload-artifact@v1
  53. with:
  54. name: buildkit-win.zip
  55. path: main/buildkit/target/buildkit-win.zip
  56. release:
  57. name: Draft a Release on GitHub Releases
  58. runs-on: ubuntu-latest
  59. needs: build
  60. if: startsWith(github.ref, 'refs/tags/') && github.repository == 'cryptomator/cryptomator'
  61. steps:
  62. - name: Download buildkit-linux.zip
  63. uses: actions/download-artifact@v1
  64. with:
  65. name: buildkit-linux.zip
  66. path: .
  67. - name: Download buildkit-mac.zip
  68. uses: actions/download-artifact@v1
  69. with:
  70. name: buildkit-mac.zip
  71. path: .
  72. - name: Download buildkit-win.zip
  73. uses: actions/download-artifact@v1
  74. with:
  75. name: buildkit-win.zip
  76. path: .
  77. - name: Create Release
  78. id: create_release
  79. uses: actions/create-release@v1
  80. env:
  81. GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
  82. with:
  83. tag_name: ${{ github.ref }}
  84. release_name: ${{ github.ref }}
  85. body: |
  86. :construction: Work in Progress
  87. TODO:
  88. * [ ] add Linux appimage, zsync file and signature file
  89. * [ ] add Windows installer and signature file
  90. * [ ] add MacOs disk image and signature file
  91. draft: true
  92. prerelease: false
  93. - name: Upload buildkit-linux.zip to GitHub Releases
  94. uses: actions/upload-release-asset@v1.0.1
  95. env:
  96. GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
  97. with:
  98. upload_url: ${{ steps.create_release.outputs.upload_url }}
  99. asset_path: buildkit-linux.zip
  100. asset_name: buildkit-linux.zip
  101. asset_content_type: application/zip
  102. - name: Upload buildkit-mac.zip to GitHub Releases
  103. uses: actions/upload-release-asset@v1.0.1
  104. env:
  105. GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
  106. with:
  107. upload_url: ${{ steps.create_release.outputs.upload_url }}
  108. asset_path: buildkit-mac.zip
  109. asset_name: buildkit-mac.zip
  110. asset_content_type: application/zip
  111. - name: Upload buildkit-win.zip to GitHub Releases
  112. uses: actions/upload-release-asset@v1.0.1
  113. env:
  114. GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
  115. with:
  116. upload_url: ${{ steps.create_release.outputs.upload_url }}
  117. asset_path: buildkit-win.zip
  118. asset_name: buildkit-win.zip
  119. asset_content_type: application/zip