ci.yaml 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106
  1. # Licensed to the Apache Software Foundation (ASF) under one
  2. # or more contributor license agreements. See the NOTICE file
  3. # distributed with this work for additional information
  4. # regarding copyright ownership. The ASF licenses this file
  5. # to you under the Apache License, Version 2.0 (the
  6. # "License"); you may not use this file except in compliance
  7. # with the License. You may obtain a copy of the License at
  8. #
  9. # http://www.apache.org/licenses/LICENSE-2.0
  10. #
  11. # Unless required by applicable law or agreed to in writing,
  12. # software distributed under the License is distributed on an
  13. # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
  14. # KIND, either express or implied. See the License for the
  15. # specific language governing permissions and limitations
  16. # under the License.
  17. # This workflow will build a Java project with Maven
  18. # See also:
  19. # https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-maven
  20. name: CI
  21. on:
  22. push:
  23. branches: [ '*' ]
  24. pull_request:
  25. branches: [ '*' ]
  26. jobs:
  27. mvn:
  28. strategy:
  29. matrix:
  30. profile:
  31. - name: 'full-build-jdk8'
  32. jdk: 8
  33. args: '-Pfull-build apache-rat:check verify -DskipTests spotbugs:check checkstyle:check'
  34. - name: 'full-build-jdk11'
  35. jdk: 11
  36. args: '-Pfull-build apache-rat:check verify -DskipTests spotbugs:check checkstyle:check'
  37. - name: 'full-build-java-tests'
  38. jdk: 11
  39. args: '-Pfull-build verify -Dsurefire-forkcount=1 -DskipCppUnit -Dsurefire.rerunFailingTestsCount=5'
  40. - name: 'full-build-cppunit-tests'
  41. jdk: 11
  42. args: '-Pfull-build verify -Dtest=_ -DfailIfNoTests=false'
  43. fail-fast: false
  44. timeout-minutes: 360
  45. runs-on: ubuntu-latest
  46. steps:
  47. - uses: actions/checkout@v3
  48. - name: Set up JDK ${{ matrix.profile.jdk }}
  49. uses: actions/setup-java@v3
  50. with:
  51. java-version: ${{ matrix.profile.jdk }}
  52. distribution: temurin
  53. - name: Cache local maven repository
  54. uses: actions/cache@v3
  55. with:
  56. path: |
  57. ~/.m2/repository/
  58. !~/.m2/repository/org/apache/zookeeper
  59. key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }}
  60. restore-keys: ${{ runner.os }}-m2
  61. - name: Show the first log message
  62. run: git log -n1
  63. - name: Install C Dependencies
  64. run: |
  65. sudo apt update
  66. sudo apt install -y libcppunit-dev libsasl2-dev
  67. - name: Build with Maven (${{ matrix.profile.name }})
  68. run: mvn -B -V -e -ntp "-Dstyle.color=always" ${{ matrix.profile.args }}
  69. env:
  70. MAVEN_OPTS: -Djansi.force=true
  71. - name: Upload unit test results
  72. if: ${{ failure() }}
  73. uses: actions/upload-artifact@v3
  74. with:
  75. name: surefire-reports-${{ matrix.profile.name }}
  76. path: ./**/target/surefire-reports/
  77. if-no-files-found: ignore
  78. - name: Upload integration test results
  79. if: ${{ failure() }}
  80. uses: actions/upload-artifact@v3
  81. with:
  82. name: failsafe-reports-${{ matrix.profile.name }}
  83. path: ./**/target/failsafe-reports/
  84. if-no-files-found: ignore
  85. typo-check:
  86. name: Typo Check
  87. # only run on pull requests because of security reasons
  88. # we shouldn't trust external actions for builds within the repository
  89. if: ${{ github.event_name == 'pull_request' }}
  90. runs-on: ubuntu-latest
  91. steps:
  92. - uses: actions/checkout@v4
  93. - name: Check typos
  94. uses: crate-ci/typos@v1.22.4
  95. # To run the typo check locally, you can follow these steps:
  96. # 1. Install typos locally using cargo:
  97. # cargo install typos-cli
  98. # 2. Run the typo check with the following command:
  99. # typos
  100. # FP is configured in the project root directory in the `.typos.toml` file.
  101. # You can refer to the `.typos.toml` documentation here:
  102. # https://github.com/crate-ci/typos/blob/master/docs/reference.md