Skip to content
Permalink
Browse files
Suport test multi versions (#260)
  • Loading branch information
kylixs committed Jan 15, 2021
1 parent 3d1408d commit 3e6551b0d3cc771a930cc936e2fd8b12eb80690c
Show file tree
Hide file tree
Showing 97 changed files with 2,718 additions and 679 deletions.
@@ -0,0 +1,370 @@
name: Dubbo 2

on:
pull_request:
paths:
- "**"
push:
paths:
- '**'

env:
FORK_COUNT: 2
FAIL_FAST: 0
SHOW_ERROR_DETAIL: 1
BUILD_OPTS: -U --batch-mode --no-transfer-progress --settings ${{github.workspace}}/.mvn/settings.xml clean package dependency:copy-dependencies -DskipTests
#multi-version size limit
VERSIONS_LIMIT: 4
CANDIDATE_VERSIONS: '
dubbo.version:2.7.8,2.7.9-SNAPSHOT;
spring.version:4.3.30.RELEASE;
spring-boot.version:1.5.22.RELEASE;
spring-boot.version:2.4.1;
'

jobs:
build-samples:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
java: [8, 11]
steps:
- uses: actions/checkout@v1
- name: Cache local Maven repository
uses: actions/cache@v2
with:
path: ~/.m2/repository
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
restore-keys: |
${{ runner.os }}-maven-
- name: Set up JDK ${{matrix.java}}
uses: actions/setup-java@v1
with:
java-version: ${{matrix.java}}
- name: Build with Maven
run: |
./mvnw $BUILD_OPTS
build-dubbo:
runs-on: ubuntu-latest
strategy:
fail-fast: false
steps:
- uses: actions/checkout@v2
with:
repository: 'apache/dubbo'
ref: master
- name: Dubbo cache
uses: actions/cache@v2
with:
path: ~/.m2/repository/org/apache/dubbo
key: ${{ runner.os }}-dubbo-snapshot
- name: Get last git commit hash
id: git-hash
run: |
#compare dubbo commit id
last_commit_id=`git log --format="%H" -n 1`
echo "::set-output name=commit_id::$last_commit_id"
if [ -f ~/.m2/repository/org/apache/dubbo/dubbo-commit-id ];then
cache_commit_id=`cat ~/.m2/repository/org/apache/dubbo/dubbo-commit-id`
fi
if [ "$last_commit_id" == "$cache_commit_id" ];then
echo "::set-output name=cache-hit::true"
else
echo "::set-output name=cache-hit::false"
fi
- name: Cache local Maven repository
if: steps.git-hash.outputs.cache-hit != 'true'
uses: actions/cache@v2
with:
path: ~/.m2/repository
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
restore-keys: |
${{ runner.os }}-maven-
- name: Set up JDK 8
if: steps.git-hash.outputs.cache-hit != 'true'
uses: actions/setup-java@v1
with:
java-version: 8
- name: Build dubbo
if: steps.git-hash.outputs.cache-hit != 'true'
run: |
./mvnw -U --batch-mode --no-transfer-progress clean install -Dmaven.test.skip=true -Dmaven.test.skip.exec=true
- name: Update commit id
run: |
echo commit_id: ${{steps.git-hash.outputs.commit_id}}
echo ${{steps.git-hash.outputs.commit_id}} > ~/.m2/repository/org/apache/dubbo/dubbo-commit-id
prepare_test:
runs-on: ubuntu-latest
env:
#'JOB_COUNT' MUST match needs job list of 'test_result' job
JOB_COUNT: 5
steps:
- uses: actions/checkout@v1
- name: Prepare test list
run: |
cd test
bash ./prepare-test.sh
- name: Upload test list
uses: actions/upload-artifact@v2
with:
name: test-list
path: test/jobs

test_result:
#testjob list MUST match 'JOB_COUNT' of 'prepare_test' job
needs: [testjob_1,testjob_2,testjob_3,testjob_4,testjob_5]
if: always()
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
java: [8, 11]
env:
JAVA_VER: ${{matrix.java}}
steps:
- uses: actions/checkout@v1
- name: Download test result
uses: actions/download-artifact@v2
with:
name: test-result
path: test/jobs/
- name: Merge test result - java ${{matrix.java}}
run: ./test/merge-test-results.sh

testjob_1:
needs: [prepare_test, build-dubbo]
runs-on: ubuntu-latest
env:
JAVA_VER: ${{matrix.java}}
TEST_CASE_FILE: jobs/${{github.job}}.txt
strategy:
fail-fast: false
matrix:
java: [8, 11]
steps:
- uses: actions/checkout@v1
- name: Cache local Maven repository
uses: actions/cache@v2
with:
path: ~/.m2/repository
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
restore-keys: |
${{ runner.os }}-maven-
- name: Dubbo cache
uses: actions/cache@v2
with:
path: ~/.m2/repository/org/apache/dubbo
key: ${{ runner.os }}-dubbo-snapshot
restore-keys: |
${{ runner.os }}-dubbo-
- name: Download test list
uses: actions/download-artifact@v2
with:
name: test-list
path: test/jobs/
- name: Set up JDK ${{matrix.java}}
uses: actions/setup-java@v1
with:
java-version: ${{matrix.java}}
- name: Build test image
run: |
cd test && bash ./build-test-image.sh
- name: Run tests
run: cd test && bash ./run-tests.sh
- name: Upload test result
if: always()
uses: actions/upload-artifact@v2
with:
name: test-result
path: test/jobs/*-result*

testjob_2:
needs: [prepare_test, build-dubbo]
runs-on: ubuntu-latest
env:
JAVA_VER: ${{matrix.java}}
TEST_CASE_FILE: jobs/${{github.job}}.txt
strategy:
fail-fast: false
matrix:
java: [8, 11]
steps:
- uses: actions/checkout@v1
- name: Cache local Maven repository
uses: actions/cache@v2
with:
path: ~/.m2/repository
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
restore-keys: |
${{ runner.os }}-maven-
- name: Dubbo cache
uses: actions/cache@v2
with:
path: ~/.m2/repository/org/apache/dubbo
key: ${{ runner.os }}-dubbo-snapshot
restore-keys: |
${{ runner.os }}-dubbo-
- name: Download test list
uses: actions/download-artifact@v2
with:
name: test-list
path: test/jobs/
- name: Set up JDK ${{matrix.java}}
uses: actions/setup-java@v1
with:
java-version: ${{matrix.java}}
- name: Build test image
run: |
cd test && bash ./build-test-image.sh
- name: Run tests
run: cd test && bash ./run-tests.sh
- name: Upload test result
if: always()
uses: actions/upload-artifact@v2
with:
name: test-result
path: test/jobs/*-result*

testjob_3:
needs: [prepare_test, build-dubbo]
runs-on: ubuntu-latest
env:
JAVA_VER: ${{matrix.java}}
TEST_CASE_FILE: jobs/${{github.job}}.txt
strategy:
fail-fast: false
matrix:
java: [8, 11]
steps:
- uses: actions/checkout@v1
- name: Cache local Maven repository
uses: actions/cache@v2
with:
path: ~/.m2/repository
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
restore-keys: |
${{ runner.os }}-maven-
- name: Dubbo cache
uses: actions/cache@v2
with:
path: ~/.m2/repository/org/apache/dubbo
key: ${{ runner.os }}-dubbo-snapshot
restore-keys: |
${{ runner.os }}-dubbo-
- name: Download test list
uses: actions/download-artifact@v2
with:
name: test-list
path: test/jobs/
- name: Set up JDK ${{matrix.java}}
uses: actions/setup-java@v1
with:
java-version: ${{matrix.java}}
- name: Build test image
run: |
cd test && bash ./build-test-image.sh
- name: Run tests
run: cd test && bash ./run-tests.sh
- name: Upload test result
if: always()
uses: actions/upload-artifact@v2
with:
name: test-result
path: test/jobs/*-result*

testjob_4:
needs: [prepare_test, build-dubbo]
runs-on: ubuntu-latest
env:
JAVA_VER: ${{matrix.java}}
TEST_CASE_FILE: jobs/${{github.job}}.txt
strategy:
fail-fast: false
matrix:
java: [8, 11]
steps:
- uses: actions/checkout@v1
- name: Cache local Maven repository
uses: actions/cache@v2
with:
path: ~/.m2/repository
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
restore-keys: |
${{ runner.os }}-maven-
- name: Dubbo cache
uses: actions/cache@v2
with:
path: ~/.m2/repository/org/apache/dubbo
key: ${{ runner.os }}-dubbo-snapshot
restore-keys: |
${{ runner.os }}-dubbo-
- name: Download test list
uses: actions/download-artifact@v2
with:
name: test-list
path: test/jobs/
- name: Set up JDK ${{matrix.java}}
uses: actions/setup-java@v1
with:
java-version: ${{matrix.java}}
- name: Build test image
run: |
cd test && bash ./build-test-image.sh
- name: Run tests
run: cd test && bash ./run-tests.sh
- name: Upload test result
if: always()
uses: actions/upload-artifact@v2
with:
name: test-result
path: test/jobs/*-result*

testjob_5:
needs: [prepare_test, build-dubbo]
runs-on: ubuntu-latest
env:
JAVA_VER: ${{matrix.java}}
TEST_CASE_FILE: jobs/${{github.job}}.txt
strategy:
fail-fast: false
matrix:
java: [8, 11]
steps:
- uses: actions/checkout@v1
- name: Cache local Maven repository
uses: actions/cache@v2
with:
path: ~/.m2/repository
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
restore-keys: |
${{ runner.os }}-maven-
- name: Dubbo cache
uses: actions/cache@v2
with:
path: ~/.m2/repository/org/apache/dubbo
key: ${{ runner.os }}-dubbo-snapshot
restore-keys: |
${{ runner.os }}-dubbo-
- name: Download test list
uses: actions/download-artifact@v2
with:
name: test-list
path: test/jobs/
- name: Set up JDK ${{matrix.java}}
uses: actions/setup-java@v1
with:
java-version: ${{matrix.java}}
- name: Build test image
run: |
cd test && bash ./build-test-image.sh
- name: Run tests
run: cd test && bash ./run-tests.sh
- name: Upload test result
if: always()
uses: actions/upload-artifact@v2
with:
name: test-result
path: test/jobs/*-result*

0 comments on commit 3e6551b

Please sign in to comment.