api-test.yml 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139
  1. #
  2. # Licensed to the Apache Software Foundation (ASF) under one or more
  3. # contributor license agreements. See the NOTICE file distributed with
  4. # this work for additional information regarding copyright ownership.
  5. # The ASF licenses this file to You under the Apache License, Version 2.0
  6. # (the "License"); you may not use this file except in compliance with
  7. # 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, software
  12. # distributed under the License is distributed on an "AS IS" BASIS,
  13. # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  14. # See the License for the specific language governing permissions and
  15. # limitations under the License.
  16. #
  17. on:
  18. pull_request:
  19. push:
  20. branches:
  21. - dev
  22. name: API-Test
  23. concurrency:
  24. group: api-test-${{ github.event.pull_request.number || github.ref }}
  25. cancel-in-progress: true
  26. jobs:
  27. paths-filter:
  28. name: API-Test-Path-Filter
  29. runs-on: ubuntu-latest
  30. outputs:
  31. not-ignore: ${{ steps.filter.outputs.not-ignore }}
  32. steps:
  33. - uses: actions/checkout@v2
  34. - uses: dorny/paths-filter@b2feaf19c27470162a626bd6fa8438ae5b263721
  35. id: filter
  36. with:
  37. filters: |
  38. not-ignore:
  39. - '!(docs/**)'
  40. build:
  41. name: API-Test-Build
  42. needs: paths-filter
  43. if: ${{ (needs.paths-filter.outputs.not-ignore == 'true') || (github.event_name == 'push') }}
  44. runs-on: ubuntu-latest
  45. timeout-minutes: 20
  46. steps:
  47. - uses: actions/checkout@v2
  48. with:
  49. submodules: true
  50. - name: Sanity Check
  51. uses: ./.github/actions/sanity-check
  52. - name: Cache local Maven repository
  53. uses: actions/cache@v3
  54. with:
  55. path: ~/.m2/repository
  56. key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
  57. restore-keys: ${{ runner.os }}-maven-
  58. - name: Build Image
  59. run: |
  60. ./mvnw -B clean install \
  61. -Dmaven.test.skip \
  62. -Dmaven.javadoc.skip \
  63. -Dcheckstyle.skip=true \
  64. -Pdocker,release -Ddocker.tag=ci \
  65. -pl dolphinscheduler-standalone-server -am
  66. - name: Export Docker Images
  67. run: |
  68. docker save apache/dolphinscheduler-standalone-server:ci -o /tmp/standalone-image.tar \
  69. && du -sh /tmp/standalone-image.tar
  70. - uses: actions/upload-artifact@v2
  71. name: Upload Docker Images
  72. with:
  73. name: standalone-image
  74. path: /tmp/standalone-image.tar
  75. retention-days: 1
  76. api-test:
  77. name: ${{ matrix.case.name }}
  78. needs: build
  79. runs-on: ubuntu-latest
  80. timeout-minutes: 30
  81. strategy:
  82. matrix:
  83. case:
  84. - name: Tenant
  85. class: org.apache.dolphinscheduler.api.test.cases.TenantAPITest
  86. env:
  87. RECORDING_PATH: /tmp/recording-${{ matrix.case.name }}
  88. steps:
  89. - uses: actions/checkout@v2
  90. with:
  91. submodules: true
  92. - name: Cache local Maven repository
  93. uses: actions/cache@v3
  94. with:
  95. path: ~/.m2/repository
  96. key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
  97. restore-keys: ${{ runner.os }}-maven-
  98. - uses: actions/download-artifact@v2
  99. name: Download Docker Images
  100. with:
  101. name: standalone-image
  102. path: /tmp
  103. - name: Load Docker Images
  104. run: |
  105. docker load -i /tmp/standalone-image.tar
  106. - name: Run Test
  107. run: |
  108. ./mvnw -B -f dolphinscheduler-api-test/pom.xml -am \
  109. -DfailIfNoTests=false \
  110. -Dtest=${{ matrix.case.class }} test
  111. - uses: actions/upload-artifact@v2
  112. if: always()
  113. name: Upload Recording
  114. with:
  115. name: recording-${{ matrix.case.name }}
  116. path: ${{ env.RECORDING_PATH }}
  117. retention-days: 1
  118. result:
  119. name: API-Test-Result
  120. runs-on: ubuntu-latest
  121. timeout-minutes: 30
  122. needs: [ api-test, paths-filter ]
  123. if: always()
  124. steps:
  125. - name: Status
  126. run: |
  127. if [[ ${{ needs.paths-filter.outputs.not-ignore }} == 'false' && ${{ github.event_name }} == 'pull_request' ]]; then
  128. echo "Skip API Test!"
  129. exit 0
  130. fi
  131. if [[ ${{ needs.api-test.result }} != 'success' ]]; then
  132. echo "API test Failed!"
  133. exit -1
  134. fi