Skip to content

Commit 5e5a440

Browse files
committed
Test actions/cache with 'maven', 'gradle', 'sbt'
1 parent 11214d9 commit 5e5a440

File tree

3 files changed

+81
-5
lines changed

3 files changed

+81
-5
lines changed
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
name: Test cache option
2+
3+
on:
4+
push:
5+
branches:
6+
- sapMachine
7+
workflow_dispatch:
8+
9+
jobs:
10+
test:
11+
runs-on: ${{ matrix.os }}
12+
strategy:
13+
fail-fast: false
14+
matrix:
15+
os: [ubuntu-latest, windows-latest, macos-latest] # Include macos-latest for all except where overridden
16+
build-system: ['maven', 'gradle', 'sbt']
17+
include:
18+
- build-system: 'sbt'
19+
os: macos-12 # Override to use macOS-12 specifically for SBT builds
20+
exclude:
21+
- build-system: 'sbt'
22+
os: macos-latest # Exclude macos-latest specifically for SBT builds
23+
24+
steps:
25+
- name: Checkout code
26+
uses: actions/checkout@v4
27+
28+
- name: Set up Java
29+
uses: Shegox/setup-java@main
30+
with:
31+
distribution: 'sapmachine'
32+
java-version: '21'
33+
cache: ${{ matrix.build-system }}
34+
35+
- name: Build with Maven
36+
if: matrix.build-system == 'maven'
37+
run: mvn -B package --file pom.xml
38+
39+
- name: Build with Gradle
40+
if: matrix.build-system == 'gradle'
41+
run: ./gradlew build --no-daemon
42+
43+
- name: Build with SBT
44+
if: matrix.build-system == 'sbt'
45+
run: sbt package
46+
47+
- name: Verify Java version
48+
run: java -version

.github/workflows/test-cache.yml

Lines changed: 30 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Test cache option
1+
name: Test actions/cache with 'maven', 'gradle', 'sbt'
22

33
on:
44
# push:
@@ -30,7 +30,35 @@ jobs:
3030
with:
3131
distribution: 'sapmachine'
3232
java-version: '21'
33-
cache: ${{ matrix.build-system }}
33+
34+
35+
- name: Cache Maven packages
36+
if: matrix.build-system == 'maven'
37+
uses: actions/cache@v3
38+
with:
39+
path: ~/.m2/repository
40+
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
41+
restore-keys: |
42+
${{ runner.os }}-maven-
43+
- name: Cache Gradle packages
44+
if: matrix.build-system == 'gradle'
45+
uses: actions/cache@v3
46+
with:
47+
path: |
48+
~/.gradle/caches
49+
~/.gradle/wrapper
50+
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}
51+
restore-keys: |
52+
${{ runner.os }}-gradle-
53+
- name: Cache SBT packages
54+
if: matrix.build-system == 'sbt'
55+
uses: actions/cache@v3
56+
with:
57+
path: |
58+
~/.sbt
59+
key: ${{ runner.os }}-sbt-${{ hashFiles('**/*.sbt', '**/build.properties', '**/plugins.sbt') }}
60+
restore-keys: |
61+
${{ runner.os }}-sbt-
3462
3563
- name: Build with Maven
3664
if: matrix.build-system == 'maven'

.github/workflows/test-publishing-using-gradle.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
name: Test PublishinG to GPR using Gradle
22

33
on:
4-
push:
5-
branches:
6-
- sapMachine
4+
# push:
5+
# branches:
6+
# - sapMachine
77

88
workflow_dispatch:
99

0 commit comments

Comments
 (0)