|
@@ -15,69 +15,71 @@
|
|
# limitations under the License.
|
|
# limitations under the License.
|
|
#
|
|
#
|
|
|
|
|
|
|
|
+name: Test
|
|
|
|
+
|
|
on:
|
|
on:
|
|
pull_request:
|
|
pull_request:
|
|
|
|
+ paths-ignore:
|
|
|
|
+ - '**/*.md'
|
|
|
|
+ - 'dolphinscheduler-ui'
|
|
push:
|
|
push:
|
|
|
|
+ paths-ignore:
|
|
|
|
+ - '**/*.md'
|
|
|
|
+ - 'dolphinscheduler-ui'
|
|
branches:
|
|
branches:
|
|
- dev
|
|
- dev
|
|
|
|
+
|
|
env:
|
|
env:
|
|
LOG_DIR: /tmp/dolphinscheduler
|
|
LOG_DIR: /tmp/dolphinscheduler
|
|
|
|
|
|
-name: Unit Test
|
|
|
|
|
|
+concurrency:
|
|
|
|
+ group: unit-test-${{ github.event.pull_request.number || github.ref }}
|
|
|
|
+ cancel-in-progress: true
|
|
|
|
|
|
jobs:
|
|
jobs:
|
|
-
|
|
|
|
- build:
|
|
|
|
- name: Build
|
|
|
|
|
|
+ unit-test:
|
|
|
|
+ name: Unit Test
|
|
runs-on: ubuntu-latest
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
steps:
|
|
-
|
|
|
|
- uses: actions/checkout@v2
|
|
- uses: actions/checkout@v2
|
|
with:
|
|
with:
|
|
- submodule: true
|
|
|
|
- - name: Check License Header
|
|
|
|
- uses: apache/skywalking-eyes@ec88b7d850018c8983f87729ea88549e100c5c82
|
|
|
|
- env:
|
|
|
|
- GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Only enable review / suggestion here
|
|
|
|
- - uses: actions/cache@v1
|
|
|
|
|
|
+ submodules: true
|
|
|
|
+ - name: Sanity Check
|
|
|
|
+ uses: ./.github/actions/sanity-check
|
|
|
|
+ - name: Set up JDK 1.8
|
|
|
|
+ uses: actions/setup-java@v2
|
|
|
|
+ with:
|
|
|
|
+ java-version: 8
|
|
|
|
+ distribution: 'adopt'
|
|
|
|
+ - uses: actions/cache@v2
|
|
with:
|
|
with:
|
|
path: ~/.m2/repository
|
|
path: ~/.m2/repository
|
|
- key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
|
|
|
|
- restore-keys: |
|
|
|
|
- ${{ runner.os }}-maven-
|
|
|
|
|
|
+ key: ${{ runner.os }}-maven
|
|
- name: Bootstrap database
|
|
- name: Bootstrap database
|
|
run: |
|
|
run: |
|
|
sed -i "/image: bitnami\/postgresql/a\ ports:\n - 5432:5432" $(pwd)/docker/docker-swarm/docker-compose.yml
|
|
sed -i "/image: bitnami\/postgresql/a\ ports:\n - 5432:5432" $(pwd)/docker/docker-swarm/docker-compose.yml
|
|
sed -i "/image: bitnami\/zookeeper/a\ ports:\n - 2181:2181" $(pwd)/docker/docker-swarm/docker-compose.yml
|
|
sed -i "/image: bitnami\/zookeeper/a\ ports:\n - 2181:2181" $(pwd)/docker/docker-swarm/docker-compose.yml
|
|
docker-compose -f $(pwd)/docker/docker-swarm/docker-compose.yml up -d dolphinscheduler-zookeeper dolphinscheduler-postgresql
|
|
docker-compose -f $(pwd)/docker/docker-swarm/docker-compose.yml up -d dolphinscheduler-zookeeper dolphinscheduler-postgresql
|
|
until docker logs docker-swarm_dolphinscheduler-postgresql_1 2>&1 | grep 'listening on IPv4 address'; do echo "waiting for postgresql ready ..."; sleep 1; done
|
|
until docker logs docker-swarm_dolphinscheduler-postgresql_1 2>&1 | grep 'listening on IPv4 address'; do echo "waiting for postgresql ready ..."; sleep 1; done
|
|
- docker run --rm --network docker-swarm_dolphinscheduler -v $(pwd)/sql/dolphinscheduler_postgre.sql:/docker-entrypoint-initdb.d/dolphinscheduler_postgre.sql bitnami/postgresql:latest bash -c "PGPASSWORD=root psql -h docker-swarm_dolphinscheduler-postgresql_1 -U root -d dolphinscheduler -v ON_ERROR_STOP=1 -f /docker-entrypoint-initdb.d/dolphinscheduler_postgre.sql"
|
|
|
|
- - name: Set up JDK 1.8
|
|
|
|
- uses: actions/setup-java@v1
|
|
|
|
- with:
|
|
|
|
- java-version: 1.8
|
|
|
|
- - name: Git fetch unshallow
|
|
|
|
- run: |
|
|
|
|
- git fetch --unshallow
|
|
|
|
- git config remote.origin.fetch "+refs/heads/*:refs/remotes/origin/*"
|
|
|
|
- git fetch origin
|
|
|
|
- - name: Compile
|
|
|
|
- run: |
|
|
|
|
- export MAVEN_OPTS='-Dmaven.repo.local=.m2/repository -Dhttp.keepAlive=false -Dmaven.wagon.http.pool=false -Dmaven.wagon.httpconnectionManager.ttlSeconds=120 -XX:+TieredCompilation -XX:TieredStopAtLevel=1 -XX:+CMSClassUnloadingEnabled -XX:+UseConcMarkSweepGC -XX:-UseGCOverheadLimit -Xmx5g'
|
|
|
|
- mvn clean verify -B -Dmaven.test.skip=false
|
|
|
|
|
|
+ docker run --rm --network docker-swarm_dolphinscheduler -v $(pwd)/sql/dolphinscheduler_postgre.sql:/docker-entrypoint-initdb.d/dolphinscheduler_postgre.sql bitnami/postgresql:11.11.0 bash -c "PGPASSWORD=root psql -h docker-swarm_dolphinscheduler-postgresql_1 -U root -d dolphinscheduler -v ON_ERROR_STOP=1 -f /docker-entrypoint-initdb.d/dolphinscheduler_postgre.sql"
|
|
|
|
+
|
|
|
|
+ - name: Run Unit tests
|
|
|
|
+ run: ./mvnw clean verify -B -Dmaven.test.skip=false
|
|
- name: Upload coverage report to codecov
|
|
- name: Upload coverage report to codecov
|
|
- run: |
|
|
|
|
- CODECOV_TOKEN="09c2663f-b091-4258-8a47-c981827eb29a" bash <(curl -s https://codecov.io/bash)
|
|
|
|
|
|
+ run: CODECOV_TOKEN="09c2663f-b091-4258-8a47-c981827eb29a" bash <(curl -s https://codecov.io/bash)
|
|
|
|
+
|
|
# Set up JDK 11 for SonarCloud.
|
|
# Set up JDK 11 for SonarCloud.
|
|
- - name: Set up JDK 1.11
|
|
|
|
- uses: actions/setup-java@v1
|
|
|
|
|
|
+ - name: Set up JDK 11
|
|
|
|
+ uses: actions/setup-java@v2
|
|
with:
|
|
with:
|
|
- java-version: 1.11
|
|
|
|
|
|
+ java-version: 11
|
|
|
|
+ distribution: 'adopt'
|
|
- name: Run SonarCloud Analysis
|
|
- name: Run SonarCloud Analysis
|
|
run: >
|
|
run: >
|
|
- mvn --batch-mode verify sonar:sonar
|
|
|
|
|
|
+ ./mvnw --batch-mode verify sonar:sonar
|
|
-Dsonar.coverage.jacoco.xmlReportPaths=target/site/jacoco/jacoco.xml
|
|
-Dsonar.coverage.jacoco.xmlReportPaths=target/site/jacoco/jacoco.xml
|
|
-Dmaven.test.skip=true
|
|
-Dmaven.test.skip=true
|
|
|
|
+ -Dcheckstyle.skip=true
|
|
-Dsonar.host.url=https://sonarcloud.io
|
|
-Dsonar.host.url=https://sonarcloud.io
|
|
-Dsonar.organization=apache
|
|
-Dsonar.organization=apache
|
|
-Dsonar.core.codeCoveragePlugin=jacoco
|
|
-Dsonar.core.codeCoveragePlugin=jacoco
|
|
@@ -88,31 +90,16 @@ jobs:
|
|
env:
|
|
env:
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
|
|
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
|
|
|
|
+
|
|
- name: Collect logs
|
|
- name: Collect logs
|
|
|
|
+ continue-on-error: true
|
|
run: |
|
|
run: |
|
|
mkdir -p ${LOG_DIR}
|
|
mkdir -p ${LOG_DIR}
|
|
docker-compose -f $(pwd)/docker/docker-swarm/docker-compose.yml logs dolphinscheduler-postgresql > ${LOG_DIR}/db.txt
|
|
docker-compose -f $(pwd)/docker/docker-swarm/docker-compose.yml logs dolphinscheduler-postgresql > ${LOG_DIR}/db.txt
|
|
- continue-on-error: true
|
|
|
|
|
|
|
|
- Checkstyle:
|
|
|
|
- name: Check code style
|
|
|
|
- runs-on: ubuntu-latest
|
|
|
|
- steps:
|
|
|
|
- - name: Checkout
|
|
|
|
- uses: actions/checkout@v2
|
|
|
|
|
|
+ - name: Upload logs
|
|
|
|
+ uses: actions/upload-artifact@v2
|
|
|
|
+ continue-on-error: true
|
|
with:
|
|
with:
|
|
- submodule: true
|
|
|
|
- - name: check code style
|
|
|
|
- env:
|
|
|
|
- WORKDIR: ./
|
|
|
|
- REVIEWDOG_GITHUB_API_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
- CHECKSTYLE_CONFIG: style/checkstyle.xml
|
|
|
|
- REVIEWDOG_VERSION: v0.10.2
|
|
|
|
- run: |
|
|
|
|
- wget -O - -q https://github.com/checkstyle/checkstyle/releases/download/checkstyle-8.43/checkstyle-8.43-all.jar > /opt/checkstyle.jar
|
|
|
|
- wget -O - -q https://raw.githubusercontent.com/reviewdog/reviewdog/master/install.sh | sh -s -- -b /opt ${REVIEWDOG_VERSION}
|
|
|
|
- java -jar /opt/checkstyle.jar "${WORKDIR}" -c "${CHECKSTYLE_CONFIG}" -f xml \
|
|
|
|
- | /opt/reviewdog -f=checkstyle \
|
|
|
|
- -reporter="${INPUT_REPORTER:-github-pr-check}" \
|
|
|
|
- -filter-mode="${INPUT_FILTER_MODE:-added}" \
|
|
|
|
- -fail-on-error="${INPUT_FAIL_ON_ERROR:-false}"
|
|
|
|
|
|
+ name: unit-test-logs
|
|
|
|
+ path: ${LOG_DIR}
|