Skip to content

Commit ff5e4f6

Browse files
authored
Improve dubbo cache (#1)
Merge Dubbo-Spring-Boot build with Dubbo
1 parent 5f75c2f commit ff5e4f6

File tree

1 file changed

+15
-58
lines changed

1 file changed

+15
-58
lines changed

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

Lines changed: 15 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,13 @@ jobs:
2020
runs-on: ubuntu-18.04
2121
steps:
2222
- uses: actions/checkout@v2
23+
with:
24+
path: dubbo
25+
- uses: actions/checkout@v2
26+
with:
27+
repository: 'apache/dubbo-spring-boot-project'
28+
ref: ${{env.DUBBO_SPRING_BOOT_REF}}
29+
path: dubbo-spring-boot-project
2330
- uses: actions/setup-java@v1
2431
with:
2532
java-version: 8
@@ -33,16 +40,17 @@ jobs:
3340
with:
3441
path: ~/.m2/repository/org/apache/dubbo
3542
key: ${{ runner.os }}-dubbo-snapshot-${{ github.sha }}
36-
- name: "Build with Maven"
43+
- name: "Build Dubbo with Maven"
3744
run: |
45+
cd ./dubbo
3846
./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
39-
# just keep dubbo modules, remove dubbo-spring-boot-* modules from maven local repo
40-
cd ~/.m2/repository/org/apache/dubbo
41-
ls | grep dubbo-spring-boot | xargs -I {} rm -rf {}
42-
echo "removed dubbo-spring-boot* modules in local repo"
47+
- name: "Build Dubbo Spring Boot with Maven"
48+
run: |
49+
cd ./dubbo-spring-boot-project
50+
./mvnw --batch-mode --no-transfer-progress clean install -Dmaven.test.skip=true -Dmaven.test.skip.exec=true
4351
- name: "Calculate Dubbo Version"
4452
run: |
45-
REVISION=`awk '/<revision>[^<]+<\/revision>/{gsub(/<revision>|<\/revision>/,"",$1);print $1;exit;}' pom.xml`
53+
REVISION=`awk '/<revision>[^<]+<\/revision>/{gsub(/<revision>|<\/revision>/,"",$1);print $1;exit;}' ./dubbo/pom.xml`
4654
mkdir dubbo-version
4755
echo $REVISION > dubbo-version/dubbo-version
4856
- name: "Upload Dubbo version"
@@ -51,52 +59,6 @@ jobs:
5159
name: dubbo-version
5260
path: dubbo-version
5361

54-
build-dubbo-spring-boot:
55-
needs: build-source
56-
runs-on: ubuntu-latest
57-
outputs:
58-
commit_id: ${{ steps.git-checker.outputs.commit_id }}
59-
cache-hit: ${{ steps.dubbocache.outputs.cache-hit }}
60-
steps:
61-
- uses: actions/checkout@v2
62-
with:
63-
repository: 'apache/dubbo-spring-boot-project'
64-
ref: ${{env.DUBBO_SPRING_BOOT_REF}}
65-
- name: "Get commit id"
66-
id: git-checker
67-
run: |
68-
#compare dubbo commit id
69-
last_commit_id=`git log --format="%H" -n 1`
70-
echo "::set-output name=commit_id::$last_commit_id"
71-
echo "commit_id: $last_commit_id"
72-
- name: "Dubbo-spring-boot cache"
73-
id: dubbocache
74-
uses: actions/cache@v2
75-
with:
76-
path: ~/.m2/repository/org/apache/dubbo
77-
key: ${{ runner.os }}-dubbo-spring-boot-snapshot-${{steps.git-checker.outputs.commit_id}}
78-
- name: "Cache local Maven repository"
79-
if: steps.dubbocache.outputs.cache-hit != 'true'
80-
uses: actions/cache@v2
81-
with:
82-
path: ~/.m2/repository
83-
key: ${{ runner.os }}-dubbo-spring-boot-${{env.DUBBO_SPRING_BOOT_REF}}-maven-${{ hashFiles('**/pom.xml') }}
84-
restore-keys: |
85-
${{ runner.os }}-dubbo-spring-boot-${{env.DUBBO_SPRING_BOOT_REF}}-maven-
86-
- name: "Set up JDK 8"
87-
if: steps.dubbocache.outputs.cache-hit != 'true'
88-
uses: actions/setup-java@v1
89-
with:
90-
java-version: 8
91-
- name: "Build dubbo spring boot"
92-
if: steps.dubbocache.outputs.cache-hit != 'true'
93-
run: |
94-
./mvnw --batch-mode --no-transfer-progress clean install -Dmaven.test.skip=true -Dmaven.test.skip.exec=true
95-
# just keep dubbo-spring-boot-* modules, remove other dubbo modules from maven local repo
96-
cd ~/.m2/repository/org/apache/dubbo
97-
ls | grep -v dubbo-spring-boot | xargs -I {} rm -rf {}
98-
echo "modules in `pwd`:" && ls
99-
10062
unit-test:
10163
needs: [build-source]
10264
name: "Unit Test On ${{ matrix.os }} (JDK: ${{ matrix.jdk }})"
@@ -151,7 +113,7 @@ jobs:
151113
path: test/jobs
152114

153115
integration-test-job:
154-
needs: [build-source, build-dubbo-spring-boot, integration-test-prepare]
116+
needs: [build-source, integration-test-prepare]
155117
name: "Integration Test on ubuntu-18.04 (JobId: ${{matrix.job_id}})"
156118
runs-on: ubuntu-18.04
157119
timeout-minutes: 30
@@ -174,11 +136,6 @@ jobs:
174136
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
175137
restore-keys: |
176138
${{ runner.os }}-maven-
177-
- name: "Restore Dubbo-spring-boot cache"
178-
uses: actions/cache@v2
179-
with:
180-
path: ~/.m2/repository/org/apache/dubbo
181-
key: ${{ runner.os }}-dubbo-spring-boot-snapshot-${{needs.build-dubbo-spring-boot.outputs.commit_id}}
182139
- name: "Restore Dubbo cache"
183140
uses: actions/cache@v2
184141
with:

0 commit comments

Comments
 (0)