build.yml 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114
  1. name: Build
  2. on:
  3. [push]
  4. jobs:
  5. build:
  6. name: Build and Test
  7. runs-on: ubuntu-latest
  8. #This check is case insensitive
  9. if: "!contains(github.event.head_commit.message, '[ci skip]') && !contains(github.event.head_commit.message, '[skip ci]')"
  10. steps:
  11. - uses: actions/checkout@v2
  12. - uses: actions/setup-java@v1
  13. with:
  14. java-version: 14
  15. - uses: actions/cache@v1
  16. with:
  17. path: ~/.m2/repository
  18. key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
  19. restore-keys: |
  20. ${{ runner.os }}-maven-
  21. - name: Ensure to use tagged version
  22. run: mvn versions:set --file main/pom.xml -DnewVersion=${GITHUB_REF##*/} # use shell parameter expansion to strip of 'refs/tags'
  23. if: startsWith(github.ref, 'refs/tags/')
  24. - name: Build and Test
  25. run: mvn -B install --file main/pom.xml -Pcoverage
  26. - name: Run Codacy Coverage Reporter
  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 -jar ~/codacy-coverage-reporter.jar report -l Java -r main/commons/target/site/jacoco/jacoco.xml --partial
  30. $JAVA_HOME/bin/java -jar ~/codacy-coverage-reporter.jar report -l Java -r main/ui/target/site/jacoco/jacoco.xml --partial
  31. $JAVA_HOME/bin/java -jar ~/codacy-coverage-reporter.jar report -l Java -r main/launcher/target/site/jacoco/jacoco.xml --partial
  32. $JAVA_HOME/bin/java -jar ~/codacy-coverage-reporter.jar final
  33. env:
  34. CODACY_PROJECT_TOKEN: ${{ secrets.CODACY_PROJECT_TOKEN }}
  35. - name: Assemble Buildkit
  36. run: mvn -B package -DskipTests --file main/pom.xml --resume-from=buildkit -Prelease
  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: Upload buildkit-mac.zip
  43. uses: actions/upload-artifact@v1
  44. with:
  45. name: buildkit-mac.zip
  46. path: main/buildkit/target/buildkit-mac.zip
  47. - name: Upload buildkit-win.zip
  48. uses: actions/upload-artifact@v1
  49. with:
  50. name: buildkit-win.zip
  51. path: main/buildkit/target/buildkit-win.zip
  52. release:
  53. name: Draft a Release on GitHub Releases
  54. runs-on: ubuntu-latest
  55. needs: build
  56. if: startsWith(github.ref, 'refs/tags/')
  57. steps:
  58. - name: Download buildkit-linux.zip
  59. uses: actions/download-artifact@v1
  60. with:
  61. name: buildkit-linux.zip
  62. path: .
  63. - name: Download buildkit-mac.zip
  64. uses: actions/download-artifact@v1
  65. with:
  66. name: buildkit-mac.zip
  67. path: .
  68. - name: Download buildkit-win.zip
  69. uses: actions/download-artifact@v1
  70. with:
  71. name: buildkit-win.zip
  72. path: .
  73. - name: Create Release
  74. id: create_release
  75. uses: actions/create-release@v1
  76. env:
  77. GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
  78. with:
  79. tag_name: ${{ github.ref }}
  80. release_name: ${{ github.ref }}
  81. body: |
  82. :construction: Work in Progress
  83. draft: true
  84. prerelease: false
  85. - name: Upload buildkit-linux.zip to GitHub Releases
  86. uses: actions/upload-release-asset@v1.0.1
  87. env:
  88. GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
  89. with:
  90. upload_url: ${{ steps.create_release.outputs.upload_url }}
  91. asset_path: buildkit-linux.zip
  92. asset_name: buildkit-linux.zip
  93. asset_content_type: application/zip
  94. - name: Upload buildkit-mac.zip to GitHub Releases
  95. uses: actions/upload-release-asset@v1.0.1
  96. env:
  97. GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
  98. with:
  99. upload_url: ${{ steps.create_release.outputs.upload_url }}
  100. asset_path: buildkit-mac.zip
  101. asset_name: buildkit-mac.zip
  102. asset_content_type: application/zip
  103. - name: Upload buildkit-win.zip to GitHub Releases
  104. uses: actions/upload-release-asset@v1.0.1
  105. env:
  106. GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
  107. with:
  108. upload_url: ${{ steps.create_release.outputs.upload_url }}
  109. asset_path: buildkit-win.zip
  110. asset_name: buildkit-win.zip
  111. asset_content_type: application/zip