ci_ut.yml 3.1 KB

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