build.yml 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. #
  2. # Copyright 2022 Apollo Authors
  3. #
  4. # Licensed under the Apache License, Version 2.0 (the "License");
  5. # you may not use this file except in compliance with the License.
  6. # You may obtain a copy of the License at
  7. #
  8. # http://www.apache.org/licenses/LICENSE-2.0
  9. #
  10. # Unless required by applicable law or agreed to in writing, software
  11. # distributed under the License is distributed on an "AS IS" BASIS,
  12. # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13. # See the License for the specific language governing permissions and
  14. # limitations under the License.
  15. #
  16. # This workflow will build a Java project with Maven
  17. # For more information see: https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-maven
  18. name: build
  19. on:
  20. push:
  21. branches: [ master ]
  22. pull_request:
  23. branches: [ master ]
  24. jobs:
  25. build:
  26. runs-on: ubuntu-latest
  27. strategy:
  28. matrix:
  29. jdk: [8, 11, 17]
  30. steps:
  31. - uses: actions/checkout@v2
  32. - name: Set up JDK
  33. uses: actions/setup-java@v1
  34. with:
  35. java-version: ${{ matrix.jdk }}
  36. - name: Cache Maven packages
  37. uses: actions/cache@v1
  38. with:
  39. path: ~/.m2
  40. key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }}
  41. restore-keys: ${{ runner.os }}-m2
  42. - name: JDK 8
  43. if: matrix.jdk == '8'
  44. run: mvn -B clean package -P travis jacoco:report -Dmaven.gitcommitid.skip=true
  45. - name: JDK 11
  46. if: matrix.jdk == '11'
  47. run: mvn -B clean compile -Dmaven.gitcommitid.skip=true
  48. - name: JDK 17
  49. if: matrix.jdk == '17'
  50. run: mvn -B clean compile -Dmaven.gitcommitid.skip=true
  51. - name: Upload coverage to Codecov
  52. if: matrix.jdk == '8'
  53. uses: codecov/codecov-action@v1
  54. with:
  55. file: ${{ github.workspace }}/apollo-*/target/site/jacoco/jacoco.xml