ci_ut.yml 3.8 KB
Newer Older
K
khadgarmage 已提交
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
#
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements.  See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use this file except in compliance with
# the License.  You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#

K
khadgarmage 已提交
18 19 20 21 22
on:
  pull_request:
  push:
    branches:
      - dev
23 24
env:
  LOG_DIR: /tmp/dolphinscheduler
K
khadgarmage 已提交
25

K
khadgarmage 已提交
26
name: Unit Test
K
khadgarmage 已提交
27 28 29 30 31 32 33 34

jobs:

  build:
    name: Build
    runs-on: ubuntu-latest
    steps:

K
khadgarmage 已提交
35 36 37 38 39 40 41
      - uses: actions/checkout@v2
      # In the checkout@v2, it doesn't support git submodule. Execute the commands manually.
      - name: checkout submodules
        shell: bash
        run: |
          git submodule sync --recursive
          git -c protocol.version=2 submodule update --init --force --recursive --depth=1
K
khadgarmage 已提交
42 43 44 45 46 47
      - uses: actions/cache@v1
        with:
          path: ~/.m2/repository
          key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
          restore-keys: |
            ${{ runner.os }}-maven-
48
      - name: Bootstrap database
X
xiaochun.liu 已提交
49 50 51 52 53
        run: |
          sed -i "s/: root/: test/g" $(pwd)/docker/docker-swarm/docker-compose.yml
          docker-compose -f $(pwd)/docker/docker-swarm/docker-compose.yml create --force-recreate dolphinscheduler-zookeeper dolphinscheduler-postgresql
          sudo cp $(pwd)/sql/dolphinscheduler-postgre.sql $(docker volume inspect docker-swarm_dolphinscheduler-postgresql-initdb | grep "Mountpoint" | awk -F "\"" '{print $4}')
          docker-compose -f $(pwd)/docker/docker-swarm/docker-compose.yml up -d dolphinscheduler-zookeeper dolphinscheduler-postgresql
K
khadgarmage 已提交
54 55 56 57
      - name: Set up JDK 1.8
        uses: actions/setup-java@v1
        with:
          java-version: 1.8
K
khadgarmage 已提交
58 59 60 61 62
      - name: Git fetch unshallow
        run: |
          git fetch --unshallow
          git config remote.origin.fetch "+refs/heads/*:refs/remotes/origin/*"
          git fetch origin
K
khadgarmage 已提交
63 64
      - name: Compile
        run: |
K
khadgarmage 已提交
65
          export MAVEN_OPTS='-Dmaven.repo.local=.m2/repository -XX:+TieredCompilation -XX:TieredStopAtLevel=1 -XX:+CMSClassUnloadingEnabled -XX:+UseConcMarkSweepGC -XX:-UseGCOverheadLimit -Xmx3g'
K
khadgarmage 已提交
66
          mvn test -B -Dmaven.test.skip=false
K
khadgarmage 已提交
67 68
      - name: Upload coverage report to codecov
        run: |
K
khadgarmage 已提交
69
          CODECOV_TOKEN="09c2663f-b091-4258-8a47-c981827eb29a" bash <(curl -s https://codecov.io/bash)
70 71 72 73 74
      # Set up JDK 11 for SonarCloud.
      - name: Set up JDK 1.11
        uses: actions/setup-java@v1
        with:
          java-version: 1.11
75
      - name: Run SonarCloud Analysis
76
        run: >
77
          mvn --batch-mode verify sonar:sonar
K
khadgarmage 已提交
78
          -Dsonar.coverage.jacoco.xmlReportPaths=target/site/jacoco/jacoco.xml
79
          -Dmaven.test.skip=true
80 81
          -Dsonar.host.url=https://sonarcloud.io
          -Dsonar.organization=apache
K
khadgarmage 已提交
82
          -Dsonar.core.codeCoveragePlugin=jacoco
83 84
          -Dsonar.projectKey=apache-dolphinscheduler
          -Dsonar.login=e4058004bc6be89decf558ac819aa1ecbee57682
C
CalvinKirs 已提交
85
          -Dsonar.exclusions=dolphinscheduler-ui/src/**/i18n/locale/*.js,dolphinscheduler-microbench/src/**/*
86
        env:
87 88
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
          SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
89 90 91
      - name: Collect logs
        run: |
          mkdir -p ${LOG_DIR}
X
xiaochun.liu 已提交
92
          docker-compose -f $(pwd)/docker/docker-swarm/docker-compose.yml logs dolphinscheduler-postgresql > ${LOG_DIR}/db.txt
93
        continue-on-error: true