Skip to content

Commit b429763

Browse files
kylixsAlbumenJ
andauthored
improve dubbo cache and job depends (#7147)
* improve dubbo cache and job depends * Improve dubbo cache (#1) Merge Dubbo-Spring-Boot build with Dubbo * improve dubbo version Co-authored-by: Albumen Kevin <jhq0812@gmail.com>
1 parent 7ddf611 commit b429763

File tree

1 file changed

+21
-63
lines changed

1 file changed

+21
-63
lines changed

.github/workflows/build-and-test.yml

Lines changed: 21 additions & 63 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,17 @@ env:
1818
jobs:
1919
build-source:
2020
runs-on: ubuntu-18.04
21+
outputs:
22+
version: ${{ steps.dubbo-version.outputs.version }}
2123
steps:
2224
- uses: actions/checkout@v2
25+
with:
26+
path: dubbo
27+
- uses: actions/checkout@v2
28+
with:
29+
repository: 'apache/dubbo-spring-boot-project'
30+
ref: ${{env.DUBBO_SPRING_BOOT_REF}}
31+
path: dubbo-spring-boot-project
2332
- uses: actions/setup-java@v1
2433
with:
2534
java-version: 8
@@ -33,59 +42,20 @@ jobs:
3342
with:
3443
path: ~/.m2/repository/org/apache/dubbo
3544
key: ${{ runner.os }}-dubbo-snapshot-${{ github.sha }}
36-
- name: "Build with Maven"
37-
run: ./mvnw --batch-mode -U -e --no-transfer-progress clean install -Dmaven.wagon.httpconnectionManager.ttlSeconds=120 -Dmaven.wagon.http.retryHandler.count=5 -Dmaven.test.skip=true -Dmaven.test.skip.exec=true
38-
- name: "Calculate Dubbo Version"
45+
- name: "Build Dubbo with Maven"
3946
run: |
40-
REVISION=`awk '/<revision>[^<]+<\/revision>/{gsub(/<revision>|<\/revision>/,"",$1);print $1;exit;}' pom.xml`
41-
mkdir dubbo-version
42-
echo $REVISION > dubbo-version/dubbo-version
43-
- name: "Upload Dubbo version"
44-
uses: actions/upload-artifact@v2
45-
with:
46-
name: dubbo-version
47-
path: dubbo-version
48-
49-
build-dubbo-spring-boot:
50-
runs-on: ubuntu-latest
51-
outputs:
52-
commit_id: ${{ steps.git-checker.outputs.commit_id }}
53-
cache-hit: ${{ steps.dubbocache.outputs.cache-hit }}
54-
steps:
55-
- uses: actions/checkout@v2
56-
with:
57-
repository: 'apache/dubbo-spring-boot-project'
58-
ref: ${{env.DUBBO_SPRING_BOOT_REF}}
59-
- name: "Get commit id"
60-
id: git-checker
61-
run: |
62-
#compare dubbo commit id
63-
last_commit_id=`git log --format="%H" -n 1`
64-
echo "::set-output name=commit_id::$last_commit_id"
65-
echo "commit_id: $last_commit_id"
66-
- name: "Dubbo-spring-boot cache"
67-
id: dubbocache
68-
uses: actions/cache@v2
69-
with:
70-
path: ~/.m2/repository/org/apache/dubbo
71-
key: ${{ runner.os }}-dubbo-spring-boot-snapshot-${{steps.git-checker.outputs.commit_id}}
72-
- name: "Cache local Maven repository"
73-
if: steps.dubbocache.outputs.cache-hit != 'true'
74-
uses: actions/cache@v2
75-
with:
76-
path: ~/.m2/repository
77-
key: ${{ runner.os }}-dubbo-spring-boot-${{env.DUBBO_SPRING_BOOT_REF}}-maven-${{ hashFiles('**/pom.xml') }}
78-
restore-keys: |
79-
${{ runner.os }}-dubbo-spring-boot-${{env.DUBBO_SPRING_BOOT_REF}}-maven-
80-
- name: "Set up JDK 8"
81-
if: steps.dubbocache.outputs.cache-hit != 'true'
82-
uses: actions/setup-java@v1
83-
with:
84-
java-version: 8
85-
- name: "Build dubbo spring boot"
86-
if: steps.dubbocache.outputs.cache-hit != 'true'
47+
cd ./dubbo
48+
./mvnw --batch-mode -U -e --no-transfer-progress clean install -Dmaven.wagon.httpconnectionManager.ttlSeconds=120 -Dmaven.wagon.http.retryHandler.count=5 -Dmaven.test.skip=true -Dmaven.test.skip.exec=true
49+
- name: "Build Dubbo Spring Boot with Maven"
8750
run: |
51+
cd ./dubbo-spring-boot-project
8852
./mvnw --batch-mode --no-transfer-progress clean install -Dmaven.test.skip=true -Dmaven.test.skip.exec=true
53+
- name: "Calculate Dubbo Version"
54+
id: dubbo-version
55+
run: |
56+
REVISION=`awk '/<revision>[^<]+<\/revision>/{gsub(/<revision>|<\/revision>/,"",$1);print $1;exit;}' ./dubbo/pom.xml`
57+
echo "::set-output name=version::$REVISION"
58+
echo "dubbo version: $REVISION"
8959
9060
unit-test:
9161
needs: [build-source]
@@ -169,30 +139,18 @@ jobs:
169139
with:
170140
path: ~/.m2/repository/org/apache/dubbo
171141
key: ${{ runner.os }}-dubbo-snapshot-${{ github.sha }}
172-
restore-keys: |
173-
${{ runner.os }}-dubbo-
174-
- name: "Restore Dubbo-spring-boot cache"
175-
uses: actions/cache@v2
176-
with:
177-
path: ~/.m2/repository/org/apache/dubbo
178-
key: ${{ runner.os }}-dubbo-spring-boot-snapshot-${{needs.build-dubbo-spring-boot.outputs.commit_id}}
179142
- name: "Download test list"
180143
uses: actions/download-artifact@v2
181144
with:
182145
name: test-list
183146
path: test/jobs/
184-
- name: "Download Dubbo version"
185-
uses: actions/download-artifact@v2
186-
with:
187-
name: dubbo-version
188-
path: dubbo-version
189147
- name: "Set up JDK 8"
190148
uses: actions/setup-java@v1
191149
with:
192150
java-version: 8
193151
- name: "Init Candidate Versions"
194152
run: |
195-
DUBBO_VERSION=`cat dubbo-version/dubbo-version`
153+
DUBBO_VERSION="${{needs.build-source.outputs.version}}"
196154
CANDIDATE_VERSIONS="dubbo.version:$DUBBO_VERSION;$CANDIDATE_VERSIONS"
197155
echo "CANDIDATE_VERSIONS=$CANDIDATE_VERSIONS" >> $GITHUB_ENV
198156
- name: "Build test image"

0 commit comments

Comments
 (0)