maven.yml 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. # This workflow automatically tests new commits and pull requests as they come in.
  2. # Note that this does not upload any artifacts, you will need to compile mcMMO manually
  3. # if you wish to create the actual jar.
  4. name: Compile and test
  5. on:
  6. # We run our tests whenever the pom or a source file was touched.
  7. # There is no need to run Maven when only the changelog was touched.
  8. # We may also want to re-run this workflow when the workflow file itself
  9. # was updated too.
  10. push:
  11. paths:
  12. - 'src/**'
  13. - 'pom.xml'
  14. - '.github/workflows/maven.yml'
  15. # Whenever someone submits a new pull request which modified the pom or a source file,
  16. # we want to ensure it compiles successfully and that all tests will pass.
  17. pull_request:
  18. paths:
  19. - 'src/**'
  20. - 'pom.xml'
  21. jobs:
  22. compile:
  23. name: Maven compiler
  24. runs-on: ubuntu-latest
  25. steps:
  26. # 1. Check out the current working tree
  27. - name: Checkout repository
  28. uses: actions/checkout@v4
  29. # 2. Setup Java 17 JDK (Adopt)
  30. - name: Java 17 setup
  31. uses: actions/setup-java@v4
  32. with:
  33. distribution: 'adopt'
  34. java-package: jdk
  35. java-version: '17'
  36. # 3. Setup local Maven package cache to speed up building
  37. - name: Cache Maven packages
  38. uses: actions/cache@v4
  39. with:
  40. path: ~/.m2
  41. key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }}
  42. restore-keys: ${{ runner.os }}-m2
  43. # 4. Build via Maven
  44. - name: Build via Maven
  45. run: mvn verify -B --file pom.xml -DdisableXmlReport=true