-
Notifications
You must be signed in to change notification settings - Fork 48
105 lines (101 loc) · 3.15 KB
/
ci-maven.yaml
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
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
on:
push:
branches:
- main
pull_request:
name: ci-maven
jobs:
units:
runs-on: ubuntu-latest
strategy:
matrix:
java: [11, 17]
steps:
- uses: actions/checkout@v2
- uses: actions/setup-java@v3
with:
java-version: ${{ matrix.java }}
distribution: temurin
cache: maven
- run: java -version
- name: Unit Tests
run: |
mvn verify --batch-mode --no-transfer-progress -Dcheckstyle.skip \
-Dfmt.skip
units-java8:
name: "units (8) except gapic-generator-java"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
# Java 8 tests uses JDK 11 to compile and JDK 8 to run tests.
- uses: actions/setup-java@v3
with:
java-version: 8
distribution: temurin
cache: maven
- run: echo "JAVA8_HOME=${JAVA_HOME}" >> $GITHUB_ENV
- uses: actions/setup-java@v3
with:
java-version: 11
distribution: temurin
- run: echo "JAVA11_HOME=${JAVA_HOME}" >> $GITHUB_ENV
- name: Compile with Java 11
shell: bash
run: |
set -x
export JAVA_HOME=$JAVA11_HOME
export PATH=${JAVA_HOME}/bin:$PATH
# Why not compile? It's because the process needs to package jar so
# that gapic-generator-java module can use testlib modules of gax.
mvn verify --batch-mode --no-transfer-progress -Dcheckstyle.skip \
-DskipTests -Dfmt.skip
- name: Run test with Java 8 for all modules except gapic-generator-java
shell: bash
run: |
set -x
export JAVA_HOME=$JAVA8_HOME
export PATH=${JAVA_HOME}/bin:$PATH
# useIncrementalCompilation=false to avoid recompiling classes
# generated by Java 11 compiler above.
mvn -B -ntp test --projects '!gapic-generator-java' \
-Dcheckstyle.skip -Dmaven.compiler.useIncrementalCompilation=false \
-Dfmt.skip
units-java8-gapic-generator-java:
name: "units (8) for gapic-generator-java"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-java@v3
with:
java-version: 11
distribution: temurin
cache: maven
- name: Install modules outside gapic-generator-java
shell: bash
run: |
mvn -B -ntp install --projects '!gapic-generator-java' \
-Dcheckstyle.skip -Dfmt.skip -DskipTests
- uses: actions/setup-java@v3
with:
java-version: 8
distribution: temurin
cache: maven
- run: java -version
- name: Run test only for gapic-generator-java using Java 8
shell: bash
run: |
mvn -B -ntp verify --projects 'gapic-generator-java' \
-Dcheckstyle.skip -Dfmt.skip
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-java@v3
with:
java-version: 11
distribution: temurin
cache: maven
- run: java -version
- name: Java Linter
# Exclude the root project
run: mvn -B -ntp --projects '!.' fmt:check