-
Notifications
You must be signed in to change notification settings - Fork 5
89 lines (84 loc) · 2.78 KB
/
Copy pathmaven.yml
File metadata and controls
89 lines (84 loc) · 2.78 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
77
78
79
80
81
82
83
84
85
86
87
88
89
---
# This workflow will build a Java project with Maven
# For more information see:
# https://help.github.com/actions/language-and-framework-guides
# /building-and-testing-java-with-maven
name: Maven
on:
push:
pull_request:
schedule:
- cron: "0 0 * * 0"
workflow_dispatch:
permissions: {}
env:
MAVEN_OPTS: >
-Dhttps.protocols=TLSv1.2
-Dmaven.repo.local=.m2/repository
-Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=WARN
-Dorg.slf4j.simpleLogger.showDateTime=true
-Djava.awt.headless=true
MAVEN_CLI_OPTS: >
--batch-mode
--errors
--fail-at-end
--show-version
-DinstallAtEnd=true
-DdeployAtEnd=true
jobs:
maven:
runs-on: ubuntu-latest
strategy:
matrix:
java: [17, 21, 25, 26]
name: Java ${{ matrix.java }}
steps:
- name: Set REPOSITORY
shell: bash
run: |
set -euo pipefail
IFS=$'\n\t'
echo "REPOSITORY=${GITHUB_REPOSITORY#*/}" >> "${GITHUB_ENV}"
- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
with:
fetch-depth: 1
persist-credentials: false
- name: Set SOURCE_DATE_EPOCH
run: |
set -euo pipefail
IFS=$'\n\t'
echo "SOURCE_DATE_EPOCH=$(git log -1 --pretty=%ct)" >> "${GITHUB_ENV}"
- name: Set up JDK ${{ matrix.java }}
uses: actions/setup-java@1bcf9fb12cf4aa7d266a90ae39939e61372fe520 # v5.4.0
with:
distribution: temurin
java-version: ${{ matrix.java }}
- name: Cache Maven dependencies
# The build redirects the local repo to .m2/repository (see
# -Dmaven.repo.local in MAVEN_OPTS), so cache it at the location the
# build actually uses rather than setup-java's default ~/.m2/repository.
uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
with:
path: .m2/repository
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
restore-keys: |
${{ runner.os }}-maven-
- name: Build with Maven
shell: bash
run: |
set -euo pipefail
# Do not set IFS=$'\n\t', breaks ${MAVEN_CLI_OPTS}
# shellcheck disable=SC2086 # [Double quote to prevent globbing and word splitting]: splitting is desired for MAVEN_CLI_OPTS
./mvnw ${MAVEN_CLI_OPTS} -DdependencyCheck.skip=true verify
- name: Upload artifacts
if: ${{ matrix.java == 17 }}
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: ${{ env.REPOSITORY }}
path: target/
- name: Clean up
shell: bash
run: |
set -euo pipefail
IFS=$'\n\t'
rm "${HOME}/.m2/settings.xml"