Skip to content

Commit df634d5

Browse files
committed
Improved GitHub cache management
1 parent 4626f9f commit df634d5

File tree

2 files changed

+32
-12
lines changed

2 files changed

+32
-12
lines changed

.github/workflows/main.yml

Lines changed: 19 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,13 @@ jobs:
77
build:
88
runs-on: ubuntu-latest
99
steps:
10-
- uses: actions/checkout@v2
10+
- uses: actions/checkout@v3
11+
with:
12+
path: main
13+
- uses: actions/checkout@v3
14+
with:
15+
repository: ISAITB/itb-commons
16+
path: commons
1117
- name: Set up JDK 11
1218
uses: actions/setup-java@v2
1319
with:
@@ -17,9 +23,9 @@ jobs:
1723
uses: actions/cache@v2
1824
with:
1925
path: ~/.m2/repository
20-
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
26+
key: ${{ runner.os }}-maven-${{ secrets.CACHE_VERSION }}-${{ hashFiles('**/pom.xml') }}
2127
restore-keys: |
22-
${{ runner.os }}-maven-|
28+
${{ runner.os }}-maven-${{ secrets.CACHE_VERSION }}|
2329
- name: Generate Maven settings
2430
uses: whelk-io/maven-settings-xml-action@v18
2531
with:
@@ -44,25 +50,30 @@ jobs:
4450
[
4551
"itbRepoRead"
4652
]
53+
- name: Install commons
54+
run: mvn -B install -DskipTests=true
55+
working-directory: commons
4756
- name: Build with Maven
4857
run: mvn -B package --file pom.xml
58+
working-directory: main
4959
- name: Generate coverage badge
5060
id: jacoco
5161
uses: cicirello/jacoco-badge-generator@v2.3.0
5262
with:
5363
generate-branches-badge: true
5464
jacoco-csv-file: >
55-
jsonvalidator-common/target/site/jacoco/jacoco.csv
56-
jsonvalidator-jar/target/site/jacoco/jacoco.csv
57-
jsonvalidator-service/target/site/jacoco/jacoco.csv
58-
jsonvalidator-web/target/site/jacoco/jacoco.csv
59-
jsonvalidator-war/target/site/jacoco/jacoco.csv
65+
main/jsonvalidator-common/target/site/jacoco/jacoco.csv
66+
main/jsonvalidator-jar/target/site/jacoco/jacoco.csv
67+
main/jsonvalidator-service/target/site/jacoco/jacoco.csv
68+
main/jsonvalidator-web/target/site/jacoco/jacoco.csv
69+
main/jsonvalidator-war/target/site/jacoco/jacoco.csv
6070
- name: Log coverage percentage
6171
run: |
6272
echo "coverage = ${{ steps.jacoco.outputs.coverage }}"
6373
echo "branch coverage = ${{ steps.jacoco.outputs.branches }}"
6474
- name: Commit coverage badge (if changed)
6575
run: |
76+
cd main
6677
set +e
6778
if [[ `git status --porcelain` ]]; then
6879
git config --global user.name 'ISA2ITB'

.github/workflows/quality.yml

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,14 @@ jobs:
99
name: Build
1010
runs-on: ubuntu-latest
1111
steps:
12-
- uses: actions/checkout@v2
12+
- uses: actions/checkout@v3
1313
with:
1414
fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis
15+
path: main
16+
- uses: actions/checkout@v3
17+
with:
18+
repository: ISAITB/itb-commons
19+
path: commons
1520
- name: Set up JDK 11
1621
uses: actions/setup-java@v1
1722
with:
@@ -26,8 +31,8 @@ jobs:
2631
uses: actions/cache@v1
2732
with:
2833
path: ~/.m2
29-
key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }}
30-
restore-keys: ${{ runner.os }}-m2
34+
key: ${{ runner.os }}-m2-${{ secrets.CACHE_VERSION }}-${{ hashFiles('**/pom.xml') }}
35+
restore-keys: ${{ runner.os }}-m2-${{ secrets.CACHE_VERSION }}
3136
- name: Generate Maven settings
3237
uses: whelk-io/maven-settings-xml-action@v18
3338
with:
@@ -52,8 +57,12 @@ jobs:
5257
[
5358
"itbRepoRead"
5459
]
60+
- name: Install commons
61+
run: mvn -B install -DskipTests=true
62+
working-directory: commons
5563
- name: Build and analyze
5664
env:
5765
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any
5866
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
59-
run: mvn -B verify org.sonarsource.scanner.maven:sonar-maven-plugin:sonar -Dsonar.projectKey=ISAITB_json-validator
67+
run: mvn -B verify org.sonarsource.scanner.maven:sonar-maven-plugin:sonar -Dsonar.projectKey=ISAITB_json-validator
68+
working-directory: main

0 commit comments

Comments
 (0)