unit-test.yml 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
  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. name: Test
  18. on:
  19. pull_request:
  20. paths-ignore:
  21. - '**/*.md'
  22. - 'dolphinscheduler-ui'
  23. - 'dolphinscheduler-python/pydolphinscheduler'
  24. push:
  25. paths-ignore:
  26. - '**/*.md'
  27. - 'dolphinscheduler-ui'
  28. - 'dolphinscheduler-python/pydolphinscheduler'
  29. branches:
  30. - dev
  31. env:
  32. LOG_DIR: /tmp/dolphinscheduler
  33. concurrency:
  34. group: unit-test-${{ github.event.pull_request.number || github.ref }}
  35. cancel-in-progress: true
  36. jobs:
  37. unit-test:
  38. name: Unit Test
  39. runs-on: ubuntu-latest
  40. steps:
  41. - uses: actions/checkout@v2
  42. with:
  43. submodules: true
  44. - name: Sanity Check
  45. uses: ./.github/actions/sanity-check
  46. - name: Set up JDK 1.8
  47. uses: actions/setup-java@v2
  48. with:
  49. java-version: 8
  50. distribution: 'adopt'
  51. - uses: actions/cache@v2
  52. with:
  53. path: ~/.m2/repository
  54. key: ${{ runner.os }}-maven
  55. - name: Run Unit tests
  56. run: ./mvnw clean verify -B -Dmaven.test.skip=false
  57. - name: Upload coverage report to codecov
  58. run: CODECOV_TOKEN="09c2663f-b091-4258-8a47-c981827eb29a" bash <(curl -s https://codecov.io/bash)
  59. # Set up JDK 11 for SonarCloud.
  60. - name: Set up JDK 11
  61. uses: actions/setup-java@v2
  62. with:
  63. java-version: 11
  64. distribution: 'adopt'
  65. - name: Run SonarCloud Analysis
  66. run: >
  67. ./mvnw --batch-mode verify sonar:sonar
  68. -Dsonar.coverage.jacoco.xmlReportPaths=target/site/jacoco/jacoco.xml
  69. -Dmaven.test.skip=true
  70. -Dcheckstyle.skip=true
  71. -Dsonar.host.url=https://sonarcloud.io
  72. -Dsonar.organization=apache
  73. -Dsonar.core.codeCoveragePlugin=jacoco
  74. -Dsonar.projectKey=apache-dolphinscheduler
  75. -Dsonar.login=e4058004bc6be89decf558ac819aa1ecbee57682
  76. -Dsonar.exclusions=dolphinscheduler-ui/src/**/i18n/locale/*.js,dolphinscheduler-microbench/src/**/*
  77. -Dhttp.keepAlive=false -Dmaven.wagon.http.pool=false -Dmaven.wagon.httpconnectionManager.ttlSeconds=120
  78. env:
  79. GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
  80. SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
  81. - name: Collect logs
  82. continue-on-error: true
  83. run: |
  84. mkdir -p ${LOG_DIR}
  85. docker-compose -f $(pwd)/docker/docker-swarm/docker-compose.yml logs dolphinscheduler-postgresql > ${LOG_DIR}/db.txt
  86. - name: Upload logs
  87. uses: actions/upload-artifact@v2
  88. continue-on-error: true
  89. with:
  90. name: unit-test-logs
  91. path: ${LOG_DIR}