-
Notifications
You must be signed in to change notification settings - Fork 0
76 lines (73 loc) · 2.8 KB
/
test-java.yml
File metadata and controls
76 lines (73 loc) · 2.8 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
# test java version of library
name: Test Java
permissions:
contents: read
on: [push]
env:
CODE_CACHE_VERSION: 'code-v1'
M2_CACHE_VERSION: 'm2-v1'
jobs:
compile:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-java@v4
with:
distribution: 'adopt'
java-version: '17' # maven won't accept --release argument with java < 8; and 11 is next LTS
- id: 'read-cache-maven-packages'
name: Read Cached Maven packages
uses: actions/cache@v4
with:
path: ~/.m2
key: ${{ runner.os }}-${{ env.M2_CACHE_VERSION }}-${{ hashFiles('**/pom.xml') }}
- name: Maven compile
run: |
cd java/
mvn clean compile
- name: Cache compiled classes
# Compiled classes are cached, later restored for tests
uses: actions/cache/save@v4
with:
path: ${{ github.workspace }}/**/target/**/*.*
key: ${{ runner.os }}-${{ env.CODE_CACHE_VERSION }}-${{ github.ref_name }}-${{ github.sha }}
- id: 'cache-maven-packages'
name: Cache Maven packages
uses: actions/cache/save@v4
with:
path: ~/.m2
key: ${{ runner.os }}-${{ env.M2_CACHE_VERSION }}-${{ hashFiles('**/pom.xml') }}
test:
runs-on: ubuntu-latest
needs: compile
strategy:
matrix:
package: [ "com.google.appengine.tools.cloudtasktest.**",
"com.google.appengine.tools.mapreduce.impl.**",
"com.google.appengine.tools.mapreduce.inputs.**",
"com.google.appengine.tools.mapreduce.outputs.**",
"com.google.appengine.tools.mapreduce.*Test",
"com.google.appengine.tools.pipeline.**" ]
steps:
- uses: actions/checkout@v4
- uses: actions/setup-java@v4
with:
distribution: 'adopt'
java-version: '17' # maven won't accept --release argument with java < 8; and 11 is next LTS
- id: 'read-cache-maven-packages'
name: Read Cached Maven packages
uses: actions/cache@v4
with:
path: ~/.m2
key: ${{ runner.os }}-${{ env.M2_CACHE_VERSION }}-${{ hashFiles('**/pom.xml') }}
- name: Restore compiled classes from cache
uses: actions/cache@v4
with:
path: ${{ github.workspace }}/**/target/**/*.*
key: ${{ runner.os }}-${{ env.CODE_CACHE_VERSION }}-${{ github.ref_name }}-${{ github.sha }}
- name: Run Tests for Package ${{ matrix.package }}
env:
APPENGINE_MAPREDUCE_CI_SERVICE_ACCOUNT_KEY: ${{ secrets.APPENGINE_MAPREDUCE_CI_SERVICE_ACCOUNT_KEY }}
run: |
cd java/
mvn test -T 1C -B -Dtest=${{ matrix.package }} -Dversions.logOutput=false -DprocessDependencies=false -DprocessDependencyManagement=false