ci_ut.yml 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  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: ["pull_request"]
  18. env:
  19. DOCKER_DIR: ./docker
  20. LOG_DIR: /tmp/dolphinscheduler
  21. name: Unit Test
  22. jobs:
  23. build:
  24. name: Build
  25. runs-on: ubuntu-latest
  26. steps:
  27. - uses: actions/checkout@v2
  28. # In the checkout@v2, it doesn't support git submodule. Execute the commands manually.
  29. - name: checkout submodules
  30. shell: bash
  31. run: |
  32. git submodule sync --recursive
  33. git -c protocol.version=2 submodule update --init --force --recursive --depth=1
  34. - uses: actions/cache@v1
  35. with:
  36. path: ~/.m2/repository
  37. key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
  38. restore-keys: |
  39. ${{ runner.os }}-maven-
  40. - name: Bootstrap database
  41. run: cd ${DOCKER_DIR} && docker-compose up -d
  42. - name: Set up JDK 1.8
  43. uses: actions/setup-java@v1
  44. with:
  45. java-version: 1.8
  46. - name: Compile
  47. run: |
  48. export MAVEN_OPTS='-Dmaven.repo.local=.m2/repository -XX:+TieredCompilation -XX:TieredStopAtLevel=1 -XX:+CMSClassUnloadingEnabled -XX:+UseConcMarkSweepGC -XX:-UseGCOverheadLimit -Xmx3g'
  49. mvn test -B -Dmaven.test.skip=false
  50. CODECOV_TOKEN="09c2663f-b091-4258-8a47-c981827eb29a" bash <(curl -s https://codecov.io/bash)
  51. - name: Run SonarCloud Analysis
  52. run: >
  53. mvn verify --batch-mode
  54. org.sonarsource.scanner.maven:sonar-maven-plugin:3.6.1.1688:sonar
  55. -Dsonar.coverage.jacoco.xmlReportPaths=target/site/jacoco/jacoco.xml
  56. -Dmaven.test.skip=true
  57. -Dsonar.host.url=https://sonarcloud.io
  58. -Dsonar.organization=apache
  59. -Dsonar.core.codeCoveragePlugin=jacoco
  60. -Dsonar.projectKey=apache-dolphinscheduler
  61. -Dsonar.login=e4058004bc6be89decf558ac819aa1ecbee57682
  62. env:
  63. GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
  64. SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
  65. - name: Collect logs
  66. run: |
  67. mkdir -p ${LOG_DIR}
  68. cd ${DOCKER_DIR}
  69. docker-compose logs db > ${LOG_DIR}/db.txt
  70. continue-on-error: true