-
Notifications
You must be signed in to change notification settings - Fork 320
125 lines (110 loc) · 3.93 KB
/
maven.yml
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
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
name: Build
on:
push:
branches: ['*'] # Run on any pushed branch, but not on any pushed tag
paths-ignore:
- '**.md'
pull_request:
paths-ignore:
- '**.md'
jobs:
build:
strategy:
matrix: # 'macos-14' is arm64
os: ['ubuntu-22.04', 'macos-14', 'windows-2022']
java: [ 21 ]
additional-maven-args: ['']
additional-label: ['']
include:
- os: ubuntu-22.04
java: 21
additional-maven-args: -Pstrict-jdk-21
additional-label: -strict
fail-fast: false
runs-on: ${{ matrix.os }}
steps:
- name: 'Check out repository'
uses: actions/checkout@v4
- name: 'Set up Java ${{ matrix.java }}'
uses: actions/setup-java@v4
with:
java-version: ${{ matrix.java }}
distribution: 'temurin'
- name: 'Cache Maven packages'
uses: actions/cache@v4
with:
path: ~/.m2
key: ${{ runner.os }}-m2-${{ matrix.java }}${{ matrix.additional-label }}-${{ hashFiles('**/pom.xml', '**/*.target') }}
- name: Set Maven Home environment variable
run: echo "MAVEN_WRAPPER_HOME=$(./mvnw --version | grep "Maven home:" | cut -c 13-)" >> "$GITHUB_ENV"
if: runner.os != 'Windows'
- name: Set Maven Home environment variable on Windows
run: echo "MAVEN_WRAPPER_HOME=$(./mvnw --version | grep "Maven home:" | cut -c 13-)" | Out-File -FilePath $env:GITHUB_ENV -Append
# In Windows the syntax for setting environment variable is different
if: runner.os == 'Windows'
- name: Build and test
uses: coactions/[email protected]
with:
run: >
./mvnw "-Dmaven.home=${{ env.MAVEN_WRAPPER_HOME }}"
clean verify
-f org.eclipse.xtext.full.releng
-B -fae -PuseJenkinsSnapshots
${{ matrix.additional-maven-args }}
- name: Archive Test Results
uses: actions/upload-artifact@v4
if: always()
with:
name: test-results-${{ runner.os }}-${{ matrix.java }}${{ matrix.additional-label }}
path: '**/*.tests/target/surefire-reports'
- name: Archive Logs
uses: actions/upload-artifact@v4
if: ${{ failure() || cancelled() }}
with:
name: logs-${{ runner.os }}-${{ matrix.java }}${{ matrix.additional-label }}
path: '**/*.tests/target/**/*.log'
build-maven-artifacts:
runs-on: ubuntu-22.04
steps:
- name: 'Check out repository'
uses: actions/checkout@v4
- name: 'Set up Java'
uses: actions/setup-java@v4
with:
java-version: 21
distribution: 'temurin'
- name: 'Cache Maven packages'
uses: actions/cache@v4
with:
path: ~/.m2
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml', '**/*.target') }}
- name: Set Maven Home environment variable
run: echo "MAVEN_WRAPPER_HOME=$(./mvnw --version | grep "Maven home:" | cut -c 13-)" >> "$GITHUB_ENV"
- name: Build Maven artifacts
run: >
./mvnw "-Dmaven.home=${{ env.MAVEN_WRAPPER_HOME }}"
clean verify
-f org.eclipse.xtext.maven.releng
-B -fae -PuseJenkinsSnapshots
-Pstrict-jdk-21
- name: Archive Test Results
uses: actions/upload-artifact@v4
if: always()
with:
name: build-maven-artifacts-test-results-${{ runner.os }}
path: '**/target/surefire-reports'
- name: Archive Logs
uses: actions/upload-artifact@v4
if: ${{ failure() || cancelled() }}
with:
name: build-maven-artifacts-logs-${{ runner.os }}
path: '**/target/**/*.log'
event_file:
name: "Upload Event File"
runs-on: ubuntu-latest
steps:
- name: Upload
uses: actions/upload-artifact@834a144ee995460fba8ed112a2fc961b36a5ec5a # v4.3.6
with:
name: Event File
path: ${{ github.event_path }}