(improvement)(build) Support CI for both JDK 8 and JDK 11 versions simultaneously. (#1437)

This commit is contained in:
lexluo09
2024-07-20 12:08:56 +08:00
committed by GitHub
parent b5768b27aa
commit 7d64aa893c
4 changed files with 58 additions and 25 deletions

View File

@@ -1,4 +1,4 @@
name: supersonic RHEL/CentOS CI
name: supersonic CentOS CI
on:
push:
@@ -14,31 +14,48 @@ jobs:
container:
image: quay.io/centos/centos:stream8 # 使用 CentOS Stream 8 容器
strategy:
matrix:
java-version: [8, 11] # 定义要测试的JDK版本
steps:
- uses: actions/checkout@v2
- name: Reset DNF repositories
run: |
cd /etc/yum.repos.d/
sed -i 's/mirrorlist/#mirrorlist/g' /etc/yum.repos.d/CentOS-*
sed -i 's|#baseurl=http://mirror.centos.org|baseurl=http://vault.centos.org|g' /etc/yum.repos.d/CentOS-*
- name: Update DNF package index
run: dnf makecache
- name: Install Java and Maven with retry
run: |
for i in {1..5}; do
dnf install -y java-1.8.0-openjdk-devel maven && break || sleep 15
done
if [ ${{ matrix.java-version }} -eq 8 ]; then
for i in {1..5}; do
dnf install -y java-1.8.0-openjdk-devel maven && break || sleep 15
done
else
for i in {1..5}; do
dnf install -y java-11-openjdk-devel maven && break || sleep 15
done
fi
- name: Verify Java and Maven installation
run: |
java -version
mvn -version
- name: Cache Maven packages
uses: actions/cache@v2
with:
path: ~/.m2
key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }}
restore-keys: ${{ runner.os }}-m2
- name: Build with Maven
run: mvn -B package --file pom.xml
- name: Test with Maven
run: mvn test

View File

@@ -12,13 +12,17 @@ jobs:
build:
runs-on: macos-latest # Specify a macOS runner
strategy:
matrix:
java-version: [8, 11] # Define the JDK versions to test
steps:
- uses: actions/checkout@v2
- name: Set up JDK 8
- name: Set up JDK ${{ matrix.java-version }}
uses: actions/setup-java@v2
with:
java-version: '8'
java-version: ${{ matrix.java-version }}
distribution: 'adopt'
- name: Cache Maven packages

View File

@@ -7,25 +7,33 @@ on:
pull_request:
branches:
- master
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
java-version: [8, 11] # 定义要测试的JDK版本
steps:
- uses: actions/checkout@v2
- name: Set up JDK 8
uses: actions/setup-java@v2
with:
java-version: '8'
distribution: 'adopt'
- name: Cache Maven packages
uses: actions/cache@v2
with:
path: ~/.m2
key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }}
restore-keys: ${{ runner.os }}-m2
- name: Build with Maven
run: mvn -B package --file pom.xml
- name: Test with Maven
run: mvn test
- uses: actions/checkout@v2
- name: Set up JDK ${{ matrix.java-version }}
uses: actions/setup-java@v2
with:
java-version: ${{ matrix.java-version }}
distribution: 'adopt'
- name: Cache Maven packages
uses: actions/cache@v2
with:
path: ~/.m2
key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }}
restore-keys: ${{ runner.os }}-m2
- name: Build with Maven
run: mvn -B package --file pom.xml
- name: Test with Maven
run: mvn test

View File

@@ -12,13 +12,17 @@ jobs:
build:
runs-on: windows-latest # Specify a Windows runner
strategy:
matrix:
java-version: [8, 11]
steps:
- uses: actions/checkout@v2
- name: Set up JDK 8
- name: Set up JDK ${{ matrix.java-version }}
uses: actions/setup-java@v2
with:
java-version: '8'
java-version: ${{ matrix.java-version }}
distribution: 'adopt'
- name: Cache Maven packages