unit-test.yml 3.2 KB

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