Skip to content

Commit 2cfd612

Browse files
committed
[ci] Improve caches, reduce command outputs
1 parent 733ebde commit 2cfd612

File tree

4 files changed

+23
-8
lines changed

4 files changed

+23
-8
lines changed

.github/workflows/build.yml

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,12 @@ jobs:
2424
with:
2525
distribution: 'temurin'
2626
java-version: '17'
27-
cache: 'maven'
27+
- uses: actions/cache@v3
28+
with:
29+
path: ~/.m2/repository
30+
key: ${{ runner.os }}-maven-${{ hashFiles('custom-rules/maven-java/**/pom.xml') }}
31+
restore-keys: |
32+
${{ runner.os }}-maven-
2833
2934
- name: Run .ci/build.sh
3035
run: |
@@ -40,7 +45,12 @@ jobs:
4045
with:
4146
distribution: 'temurin'
4247
java-version: '17'
43-
cache: 'maven'
48+
- uses: actions/cache@v3
49+
with:
50+
path: ~/.m2/repository
51+
key: ${{ runner.os }}-maven-${{ hashFiles('custom-rules/maven-plsql/**/pom.xml') }}
52+
restore-keys: |
53+
${{ runner.os }}-maven-
4454
4555
- name: Run .ci/build.sh
4656
run: |
@@ -60,6 +70,8 @@ jobs:
6070
with:
6171
path: custom-rules/plain-java/code
6272
key: ${{ runner.os }}-pmd-${{ hashFiles('custom-rules/plain-java/.ci/build.sh') }}
73+
restore-keys: |
74+
${{ runner.os }}-pmd-
6375
6476
- name: Run .ci/build.sh
6577
run: |
@@ -75,7 +87,12 @@ jobs:
7587
with:
7688
distribution: 'temurin'
7789
java-version: '17'
78-
cache: 'maven'
90+
- uses: actions/cache@v3
91+
with:
92+
path: ~/.m2/repository
93+
key: ${{ runner.os }}-maven-${{ hashFiles('maven/simple-project/**/pom.xml') }}
94+
restore-keys: |
95+
${{ runner.os }}-maven-
7996
8097
- name: Run .ci/build.sh
8198
run: |

custom-rules/maven-java/.ci/build.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ echo "======================================================="
1010
echo "Building..."
1111
echo "======================================================="
1212
echo
13-
./mvnw clean verify
13+
./mvnw --show-version --batch-mode clean verify
1414

1515
echo
1616
echo "======================================================="

custom-rules/maven-plsql/.ci/build.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ echo "======================================================="
1010
echo "Building..."
1111
echo "======================================================="
1212
echo
13-
./mvnw clean verify
13+
./mvnw --show-version --batch-mode clean verify
1414

1515
echo
1616
echo "======================================================="

maven/simple-project/.ci/build.sh

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,8 @@
22

33
# exit immediately if a command fails
44
set -e
5-
java -version
6-
mvn --version
75

8-
mvn verify | tee build.log
6+
mvn --show-version --batch-mode verify | tee build.log
97
grep "You have 2 PMD violations" build.log || (echo -e "\n\n\x1b[31mMissing expected rule violation\e[0m"; exit 1)
108

119
echo -e "\n\n\x1b[32mTest successful\e[0m"

0 commit comments

Comments
 (0)