Skip to content

Commit 745c67f

Browse files
committed
chore: upgrade CI jdk; improve pom 🤖
1 parent d494d78 commit 745c67f

File tree

4 files changed

+50
-19
lines changed

4 files changed

+50
-19
lines changed

.github/dependabot.yml

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,11 @@
11
version: 2
22
updates:
3-
- package-ecosystem: maven
4-
directory: "/"
5-
schedule:
6-
interval: daily
7-
open-pull-requests-limit: 10
3+
- package-ecosystem: maven
4+
directory: "/"
5+
schedule:
6+
interval: daily
7+
open-pull-requests-limit: 10
8+
- package-ecosystem: "github-actions"
9+
directory: "/"
10+
schedule:
11+
interval: "daily"

.github/workflows/ci.yaml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,18 +9,18 @@ jobs:
99
timeout-minutes: 10
1010
strategy:
1111
matrix:
12-
java: [ 8, 11, 17, 19 ]
12+
java: [ 8, 11, 17, 21 ]
1313
fail-fast: false
1414
max-parallel: 64
15-
name: Test JDK ${{ matrix.java }}
15+
name: CI JDK ${{ matrix.java }}
1616

1717
steps:
18-
- uses: actions/checkout@v3
19-
- uses: actions/setup-java@v3
18+
- uses: actions/checkout@v4
19+
- uses: actions/setup-java@v4
2020
with:
2121
java-version: ${{ matrix.java }}
22-
distribution: 'zulu'
23-
cache: 'maven'
22+
distribution: zulu
23+
cache: maven
2424
- run: scripts/integration_test
2525
# https://github.com/marketplace/actions/codecov
2626
- run: ./mvnw -V --no-transfer-progress -P gen-code-cov clean package

pom.xml

Lines changed: 29 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,13 @@
2525
<url>git@github.com:oldratlee/log4j2-ttl-thread-context-map.git</url>
2626
</scm>
2727
<issueManagement>
28-
<url>https://github.com/oldratlee/log4j2-ttl-thread-context-map/issues</url>
2928
<system>GitHub Issues</system>
29+
<url>https://github.com/oldratlee/log4j2-ttl-thread-context-map/issues</url>
3030
</issueManagement>
31+
<ciManagement>
32+
<system>GitHub Actions</system>
33+
<url>https://github.com/oldratlee/log4j2-ttl-thread-context-map/actions</url>
34+
</ciManagement>
3135
<organization>
3236
<name>Alibaba</name>
3337
<url>https://www.alibaba.com</url>
@@ -130,7 +134,7 @@
130134
<!--
131135
official docs: https://maven.apache.org/enforcer/enforcer-rules/requireMavenVersion.html
132136
133-
add maven-enforce-plugin to make sure the right jdk is used
137+
add maven-enforcer-plugin to make sure the right jdk is used
134138
https://stackoverflow.com/a/18420462/922688
135139
-->
136140
<plugin>
@@ -143,12 +147,35 @@
143147
</goals>
144148
<configuration>
145149
<rules>
150+
<requireJavaVersion>
151+
<version>1.8</version>
152+
</requireJavaVersion>
146153
<requireMavenVersion>
147154
<version>3.3.9</version>
148155
</requireMavenVersion>
149156
</rules>
150157
</configuration>
151158
</execution>
159+
<execution>
160+
<id>enforce-property</id>
161+
<goals>
162+
<goal>enforce</goal>
163+
</goals>
164+
<configuration>
165+
<rules>
166+
<!-- https://maven.apache.org/enforcer/enforcer-rules/requireProperty.html -->
167+
<requireProperty>
168+
<property>project.version</property>
169+
<regex>^\d\.\d+\.\d+(-(Alpha|Beta|RC)\d+)?$|^\d(\.\d+)?\.(\d+|x)-SNAPSHOT$</regex>
170+
<regexMessage>"Project version(${project.version}) format is invalid!"</regexMessage>
171+
</requireProperty>
172+
<requireProperty>
173+
<property>maven.multiModuleProjectDirectory</property>
174+
</requireProperty>
175+
</rules>
176+
<fail>true</fail>
177+
</configuration>
178+
</execution>
152179
</executions>
153180
</plugin>
154181
<plugin>

scripts/integration_test

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,12 @@ color_echo() {
1111
local color=$1
1212
shift
1313

14-
# NOTE: $'foo' is the escape sequence syntax of bash
15-
local -r ec=$'\033' # escape char
16-
local -r eend=$'\033[0m' # escape end
17-
18-
# if stdout is the console, turn on color output.
19-
[ -t 1 ] && echo "${ec}[1;${color}m$*${eend}" || echo "$*"
14+
# if stdout is the terminal, turn on color output.
15+
if [[ -t 1 || "${GITHUB_ACTIONS:-}" = true ]]; then
16+
printf "\e[1;%sm%s\e[0m\n" "$color" "$*"
17+
else
18+
echo "$*"
19+
fi
2020
}
2121

2222
die() {

0 commit comments

Comments
 (0)